Cubsat Space Protocol (CSP) native Python implementation
Project description
CSP.py
Native Python, async-friendly implementation of Cubesat Space Protocol.
Features
- Python friendly async API
- Sockets and connections
- Interfaces
- CAN Fragmentation Protocol v2 (compatible with https://github.com/libcsp/libcsp)
- Serializing interface for easy intergration with other applications
- Interface pair for in-memory testing between two nodes
- Socket options
- CRC32 (compatible with https://github.com/libcsp/libcsp)
- CIDR Routing table
- Hooks for inspecting and/or modifying packets going through node
- System services
- Ping
Missing features compared to libcsp
- RDP
- Packet flags
- HMAC
- Remaining system sevices: uptime, reboot/shutdown, process list, memory free query, CSP Management Protocol
- Simple fragmentation protocol
When to use over libcsp?
- Easy use (pure Python library, no native dependencies)
- Testing
csp-pyallows to start and tear down entire node within single test without leaking anything between tests
- Async API
- Use
asyncioto run communication, with gracefully handled timeouts and cancellations
- Use
Usage
- Install package using
pipuser$ pip install cubesat-space-protocol-py - Create node:
import csp_py node = csp_py.CspNode()
- Add interface
from csp_py.interfaces.serializing_interface import CspSerializingInterface async def capture_frame(frame: bytes) -> None: # TODO: frame contains entire serialized packet including header # send it over some communication channel pass async def handle_incoming_frames(iface: CspSerializingInterface) -> None: while True: # TODO: fetch frame from communication channel frame: bytes = await recv_frame() await iface.on_incoming_frame(frame) iface = CspSerializingInterface(capture_frame) # TODO: make sure addresses are correct node.router.add_interface(iface, address=1, netmask_bits=10) asyncio.create_task(handle_incoming_frames(iface))
- Start router task
router_task = asyncio.create_task(node.router.arun())
- Use sockets
connection = await node.connect(dst=0, port=20) await connection.send(b'Hello, world!') response = await connection.recv() print(f'Got response: {response.data}')
- Stop router
router_task.cancel() await router_task
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 cubesat_space_protocol_py-1.1.3.tar.gz.
File metadata
- Download URL: cubesat_space_protocol_py-1.1.3.tar.gz
- Upload date:
- Size: 20.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
794a36f123d9617fee07c7764117cb205296ccc4029118548010ccd977cc90fd
|
|
| MD5 |
41783a8139958b3fe9155f8e7cf8be79
|
|
| BLAKE2b-256 |
51f5d40270623fb943dc6c677ca5cdf6af5ce5458620fb13550a899421a99835
|
Provenance
The following attestation bundles were made for cubesat_space_protocol_py-1.1.3.tar.gz:
Publisher:
publish.yml on kplabs-pl/csp-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cubesat_space_protocol_py-1.1.3.tar.gz -
Subject digest:
794a36f123d9617fee07c7764117cb205296ccc4029118548010ccd977cc90fd - Sigstore transparency entry: 894079093
- Sigstore integration time:
-
Permalink:
kplabs-pl/csp-py@c942d38c4e7c7ce7b57a1097f380998a8ac87ba7 -
Branch / Tag:
refs/tags/release-1.1.3 - Owner: https://github.com/kplabs-pl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c942d38c4e7c7ce7b57a1097f380998a8ac87ba7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cubesat_space_protocol_py-1.1.3-py3-none-any.whl.
File metadata
- Download URL: cubesat_space_protocol_py-1.1.3-py3-none-any.whl
- Upload date:
- Size: 17.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e27df4ed50ea27df3fc706d042454b790f2549fbab95b6f3914ceef646f2be5b
|
|
| MD5 |
fa83a8ecd6a751dc7a48bd8335d7b5d3
|
|
| BLAKE2b-256 |
59e29d3955ebbe5ff227d423b17b8f0ce3e4bc78e48241b3c2a56913c778049e
|
Provenance
The following attestation bundles were made for cubesat_space_protocol_py-1.1.3-py3-none-any.whl:
Publisher:
publish.yml on kplabs-pl/csp-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cubesat_space_protocol_py-1.1.3-py3-none-any.whl -
Subject digest:
e27df4ed50ea27df3fc706d042454b790f2549fbab95b6f3914ceef646f2be5b - Sigstore transparency entry: 894079103
- Sigstore integration time:
-
Permalink:
kplabs-pl/csp-py@c942d38c4e7c7ce7b57a1097f380998a8ac87ba7 -
Branch / Tag:
refs/tags/release-1.1.3 - Owner: https://github.com/kplabs-pl
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c942d38c4e7c7ce7b57a1097f380998a8ac87ba7 -
Trigger Event:
push
-
Statement type: