这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@MAVRICK-1
Copy link

Setup proper pip package

Fixes #2239

Description

This PR implements a comprehensive pip package for panda that includes firmware, certificates, build tools, and CLI entry points. This enables panda to be installed as a standard Python dependency, allowing openpilot to replace the git submodule with a pip installation.

Changes

  • Made opendbc an optional dependency to prevent installation conflicts
  • Added CLI entry points for panda-flash and panda-recover commands
  • Created CLI module (python/cli.py) to wrap existing flash/recover functionality
  • Fixed imports to work with or without opendbc installed
  • Added MANIFEST.in to include all necessary files in distribution
  • Configured package-data to include firmware, certs, and build tools
  • Exposed __version__ at package level

Installation Options

# Basic installation (without opendbc)
pip install pandacan

# Installation with opendbc
pip install pandacan[opendbc]

# Development installation
pip install -e ".[dev]"

CLI Tools

After installation, the following commands are available:

  • panda-flash - Flash panda device(s) with latest firmware
  • panda-recover - Recover panda device(s) via DFU mode

Testing

  • Package builds successfully with python -m build
  • Basic import works without opendbc
  • Import works with opendbc installed
  • CLI tools are properly installed and accessible
  • Package includes all necessary files (firmware, certs, build tools)
  • Backward compatibility maintained

Demo Video

Screencast.from.2025-07-26.13-49-24.mp4
Screenshot from 2025-07-26 13-50-15

Notes

  • The package maintains full backward compatibility
  • opendbc is optional to avoid dependency conflicts
  • All existing functionality is preserved

- Made opendbc an optional dependency to prevent installation conflicts
- Added CLI entry points for panda-flash and panda-recover commands
- Created CLI module to wrap existing flash/recover functionality
- Fixed imports to work with or without opendbc installed
- Added MANIFEST.in to include all necessary files in distribution
- Configured package-data to include firmware, certs, and build tools

This allows pandacan to be installed as a standard pip package and
enables replacing the panda git submodule in openpilot with a regular
Python dependency.

Fixes commaai#2239
- Remove unused noqa directive
- Remove whitespace from blank line
@MAVRICK-1
Copy link
Author

cc @adeebshihadeh

try:
from opendbc.car.structs import CarParams
except ImportError:
# opendbc is optional
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it optional? it shouldn't be

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the firmware should be built and packaged at the pandacan package build time

@adeebshihadeh
Copy link
Contributor

also where's the openpilot PR for validation?

@MAVRICK-1
Copy link
Author

@adeebshihadeh raising the pr for validation

@MAVRICK-1
Copy link
Author

commaai/openpilot#35857 pr in openpilot

@MAVRICK-1 MAVRICK-1 requested a review from adeebshihadeh July 31, 2025 17:47
@MAVRICK-1
Copy link
Author

also where's the openpilot PR for validation?

done

@adeebshihadeh
Copy link
Contributor

The comments weren't addressed. Please do not open another PR unless it's a serious attempt.

@MAVRICK-1 MAVRICK-1 deleted the pip-package-setup branch August 1, 2025 01:51
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

2 participants