Skip to content

Conversation

@AgentsLogic
Copy link

@AgentsLogic AgentsLogic commented Jan 5, 2026

Fixes #2239

Summary

This PR sets up pandacan as a proper pip package that includes firmware, certificates, and all necessary components to fully use the panda project.

Changes

  • Add setup.py with custom build command to optionally build firmware during installation
  • Add MANIFEST.in to include firmware binaries, certificates, and header files in the package distribution
  • Update pyproject.toml with:
    • Proper package metadata (keywords, classifiers, URLs)
    • CLI entry points for panda-health, panda-flash, and panda-version commands
    • Package data configuration to include board files and certs
    • Move opendbc to optional dev dependencies
  • Make opendbc import optional in python/__init__.py to prevent installation failures when opendbc is not available
  • Convert script main functions to be callable from CLI entry points:
    • scripts/get_version.py
    • scripts/can_health.py
    • scripts/reflash_internal_panda.py

Key Features

  • Package can be installed with pip install pandacan
  • Firmware is optionally built during installation if ARM toolchain is available
  • Falls back gracefully if firmware build fails or toolchain is missing
  • CLI commands are available after installation:
    • panda-health - Monitor panda CAN health
    • panda-flash - Flash internal panda
    • panda-version - Get panda version
  • All necessary files (firmware, certs, headers) are included in the package
  • opendbc is now an optional dev dependency, preventing installation conflicts

Testing

The package should be sufficient to remove panda as a submodule from openpilot and add it as a normal Python dependency. This will be validated in a follow-up openpilot PR.

Notes

  • The setup.py includes intelligent firmware building that:
    • Checks for ARM GCC toolchain availability
    • Runs scons to build firmware if toolchain is present
    • Continues with package build even if firmware build fails
    • Provides clear messages about firmware build status

@AgentsLogic AgentsLogic marked this pull request as draft January 5, 2026 11:32
@AgentsLogic AgentsLogic force-pushed the setup-pip-package-2239 branch from d91b1d4 to a45cd5e Compare January 5, 2026 11:40
- Add setup.py with custom build command to optionally build firmware
- Add MANIFEST.in to include firmware, certs, and headers in package
- Update pyproject.toml with proper package metadata and CLI entry points
- Make opendbc import optional to prevent installation failures
- Add CLI entry points for panda-health, panda-flash, and panda-version
- Convert script main functions to be callable from CLI entry points

This allows pandacan to be installed as a standard pip package with all
necessary components including firmware, certificates, and build tools.
@AgentsLogic AgentsLogic force-pushed the setup-pip-package-2239 branch from a45cd5e to 3a8a6d1 Compare January 5, 2026 11:56
@AgentsLogic AgentsLogic marked this pull request as ready for review January 5, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setup proper pip package

1 participant