Contribute to source code, documentation, examples and report issues: https://github.com/hardbyte/python-can
Note that the latest released version on PyPi may be significantly behind the
develop branch. Please open any feature requests against the
There is also a python-can mailing list for development discussion.
Some more information about the internals of this library can be found
in the chapter Internal API.
There is also additional information on extending the
The latest pre-release can be installed with:
pip install --upgrade --pre python-can
Building & Installing¶
The following assumes that the commands are executed from the root of the repository:
The project can be built with:
pip install wheel python setup.py sdist bdist_wheel
The project can be installed in editable mode with:
pip install -e .
The unit tests can be run with:
pip install tox tox -e py
The documentation can be built with:
pip install -r doc/doc-requirements.txt python -m sphinx -an doc build
The linters can be run with:
pip install -r requirements-lint.txt pylint --rcfile=.pylintrc-wip can/**.py black --check --verbose can
Creating a new interface/backend¶
These steps are a guideline on how to add a new backend to python-can.
Create a module (either a
*.pyor an entire subdirectory depending on the complexity) inside
Register your backend bus class in
BACKENDSin the file
Add docs where appropriate. At a minimum add to
doc/interfaces.rstand add a new interface specific document in
doc/interface/*. It should document the supported platforms and also the hardware/software it requires. A small snippet of how to install the dependencies would also be useful to get people started without much friction.
Also, don’t forget to document your classes, methods and function with docstrings.
Add tests in
test/*where appropriate. To get started, have a look at
back2back_test.py: Simply add a test case like
BasicTestSocketCanand some basic tests will be executed for the new interface.
The modules in
Contains interface dependent code.
Contains the interface independent Bus object.
Contains the interface independent Message object.
Contains a range of file readers and writers.
Contains interface independent broadcast manager code.
Creating a new Release¶
Release from the
masterbranch (except for pre-releases).
Update the library version in
__init__.pyusing semantic versioning.
Check if any deprecations are pending.
Run all tests and examples against available hardware.
CONTRIBUTORS.txtwith any new contributors.
For larger changes update
Sanity check that documentation has stayed inline with code.
Create a temporary virtual environment. Run
python setup.py installand
Create and upload the distribution:
python setup.py sdist bdist_wheel.
Sign the packages with gpg
gpg --detach-sign -a dist/python_can-X.Y.Z-py3-none-any.whl.
Upload with twine
twine upload dist/python-can-X.Y.Z*.
In a new virtual env check that the package can be installed with pip:
pip install python-can==X.Y.Z.
Create a new tag in the repository.