python-can backend for can-hub: remote CAN interfaces over unix/tcp/tls/quic
Project description
python-can-hub
Native python-can backend for can-hub: consume remote CAN interfaces exported by can-hub agents, directly over the binary protocol — unix socket, plain TCP, TLS or QUIC, with mTLS identity and TOFU pinning on the encrypted transports. No bridge process in between.
import can
bus = can.Bus(
interface="canhub",
channel="truck42/can0",
url="quic://hub.example.com:7227",
)
bus.send(can.Message(arbitration_id=0x123, data=b"\xDE\xAD\xBE\xEF"))
for message in bus:
print(message)
channel: namespaced interfaceagent/iface(or the numeric id fromcan-hub-client list).url: omit to connect to the local hub unix socket.state_dir: client TLS identity + pin store location (tls/quic).receive_own_messages: standard python-can echo semantics.
Write access follows the hub client ACLs: if the ACL grants read-only, the
bus opens read-only and send() raises.
Listing interfaces
CanHubBus.list_interfaces() asks a hub for the interfaces it exports. Each
entry is a python-can config dict you can splat straight into can.Bus:
from canhub import CanHubBus
import can
for config in CanHubBus.list_interfaces(url="quic://hub.example.com:7227"):
print(config["channel"]) # e.g. "can-agent/can0"
bus = can.Bus(**CanHubBus.list_interfaces()[0]) # first interface, local hub
It accepts the same connection arguments as the bus (url, identity_cert,
identity_key, hub_fingerprint, state_dir); omit url to query the local
hub unix socket.
This also wires python-can's discovery: can.detect_available_configs("canhub")
returns the same dicts. With no explicit target it reads the connection from the
environment — CANHUB_URL, CANHUB_STATE_DIR, CANHUB_IDENTITY_CERT,
CANHUB_IDENTITY_KEY, CANHUB_HUB_FINGERPRINT — falling back to the local hub
unix socket. So CANHUB_URL=quic://hub.example.com:7227 points discovery at a
remote host without any code.
The wheel bundles libcanhub.so with the TLS/QUIC stack linked in
statically; the only runtime dependency is glibc.
Testing
The unit tests stub the native library, so they run without a build:
pip install -e python/.[test]
pytest python/tests
The backend is also exercised end-to-end against real binaries (recv, send,
list_interfaces, and can.detect_available_configs discovery) by
test/e2e/tests/python_can.robot; run the whole bench with make e2e.
Building from source
./scripts/build-python-wheel.sh # host arch, glibc-tagged (local dev)
pip install python/dist/*.whl
Distributable manylinux wheels are built per architecture in a manylinux container and repaired by auditwheel (needs docker, plus QEMU binfmt for the cross arches):
./scripts/build-python-wheel.sh x86_64 # python/dist/x86_64/*.whl
./scripts/build-python-wheel.sh aarch64
./scripts/build-python-wheel.sh armv7l
The release workflow builds these three on native runners (aarch64/armv7l on
the arm64 hosted runner, no QEMU) plus a cross-compiled win_amd64 wheel, and
publishes all four to PyPI on a v* tag.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_can_hub-0.2.3-py3-none-win_amd64.whl.
File metadata
- Download URL: python_can_hub-0.2.3-py3-none-win_amd64.whl
- Upload date:
- Size: 2.4 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d75319fde2cd09be8a71af43ce30304f257d6920c7c9067bc6c4641ca322dd1
|
|
| MD5 |
6a89fe5fb2d8cb6db5bbd20587450942
|
|
| BLAKE2b-256 |
04ce4849920031da9b542ba7ca6a99a89bfcbc1127b6d05efb37a4f94d9bcfab
|
Provenance
The following attestation bundles were made for python_can_hub-0.2.3-py3-none-win_amd64.whl:
Publisher:
release.yml on can-hub-io/can-hub
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_can_hub-0.2.3-py3-none-win_amd64.whl -
Subject digest:
4d75319fde2cd09be8a71af43ce30304f257d6920c7c9067bc6c4641ca322dd1 - Sigstore transparency entry: 1828756759
- Sigstore integration time:
-
Permalink:
can-hub-io/can-hub@15c4717ed22432c52389804999c446d3bd26637b -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/can-hub-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@15c4717ed22432c52389804999c446d3bd26637b -
Trigger Event:
push
-
Statement type:
File details
Details for the file python_can_hub-0.2.3-py3-none-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl.
File metadata
- Download URL: python_can_hub-0.2.3-py3-none-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl
- Upload date:
- Size: 2.6 MB
- Tags: Python 3, manylinux: glibc 2.28+ ARMv7l, manylinux: glibc 2.31+ ARMv7l
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99c42bd7438bf013a6f97e420760db2c194ac882ea969dc4bf34329219cafde2
|
|
| MD5 |
e9d15219415090f72fb0185dae6c450e
|
|
| BLAKE2b-256 |
d67d7e01f441d3c6e12c982ed919e21fe8b79e66a0d0fefa24e76b7a4fa27159
|
Provenance
The following attestation bundles were made for python_can_hub-0.2.3-py3-none-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl:
Publisher:
release.yml on can-hub-io/can-hub
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_can_hub-0.2.3-py3-none-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl -
Subject digest:
99c42bd7438bf013a6f97e420760db2c194ac882ea969dc4bf34329219cafde2 - Sigstore transparency entry: 1828757264
- Sigstore integration time:
-
Permalink:
can-hub-io/can-hub@15c4717ed22432c52389804999c446d3bd26637b -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/can-hub-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@15c4717ed22432c52389804999c446d3bd26637b -
Trigger Event:
push
-
Statement type:
File details
Details for the file python_can_hub-0.2.3-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: python_can_hub-0.2.3-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.1 MB
- Tags: Python 3, manylinux: glibc 2.26+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
548df7655e0d271b565da9c93d0f6c8976717e6699e429d22859ac9978516d45
|
|
| MD5 |
535c9f49d83c6dbbad17e805333c4d35
|
|
| BLAKE2b-256 |
4c6e153945439cd29b53748452e451d2a420cc56bfe6b5ca061fb244d5cf7afe
|
Provenance
The following attestation bundles were made for python_can_hub-0.2.3-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
release.yml on can-hub-io/can-hub
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_can_hub-0.2.3-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
548df7655e0d271b565da9c93d0f6c8976717e6699e429d22859ac9978516d45 - Sigstore transparency entry: 1828757106
- Sigstore integration time:
-
Permalink:
can-hub-io/can-hub@15c4717ed22432c52389804999c446d3bd26637b -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/can-hub-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@15c4717ed22432c52389804999c446d3bd26637b -
Trigger Event:
push
-
Statement type:
File details
Details for the file python_can_hub-0.2.3-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: python_can_hub-0.2.3-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 3.4 MB
- Tags: Python 3, manylinux: glibc 2.26+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
747940a90f2201de4e9f416aaa02ef7cce919f65c3c4de9d1b750cd249c45e35
|
|
| MD5 |
aeb81f3e318ec00b70990aff1e4d2428
|
|
| BLAKE2b-256 |
2c998e07346e8bc430b2bb85f0003c27109adc80adb557179cd71d3c7d185a62
|
Provenance
The following attestation bundles were made for python_can_hub-0.2.3-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl:
Publisher:
release.yml on can-hub-io/can-hub
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_can_hub-0.2.3-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl -
Subject digest:
747940a90f2201de4e9f416aaa02ef7cce919f65c3c4de9d1b750cd249c45e35 - Sigstore transparency entry: 1828756935
- Sigstore integration time:
-
Permalink:
can-hub-io/can-hub@15c4717ed22432c52389804999c446d3bd26637b -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/can-hub-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@15c4717ed22432c52389804999c446d3bd26637b -
Trigger Event:
push
-
Statement type: