2-N-2 high-performance protocol stack
Project description
OpenSynaptic
2-N-2 high-performance IoT protocol stack — standardises sensor readings into UCUM units, compresses them via Base62 encoding, wraps them in a binary packet, and dispatches over pluggable transporters (TCP / UDP / UART / LoRa / MQTT / CAN).
Try In 30 Seconds
pip install -e .
os-node demo --open-browser
- Default user config path:
~/.config/opensynaptic/Config.json - First run launches onboarding wizard (
--yes/--no-wizardsupported)
CLI Completion (Tab)
py -3 -m pip install argcomplete
powershell -ExecutionPolicy Bypass -File .\scripts\enable_argcomplete.ps1
Manual (without script):
Invoke-Expression (register-python-argcomplete os-node --shell powershell)
Restart PowerShell after activation.
Table of Contents
- Architecture
- Prerequisites
- Install
- Minimal Usage
- CLI Quick Reference
- Config.json
- Testing
- v0.2.0 Performance Focus
- RS Core (rscore) Quick Start
- Adding a Transporter
- API Reference
- Documentation Hub
- Release Notes
- Plugin Config Auto-Sync
Architecture
sensors list
→ OpenSynapticStandardizer.standardize() # UCUM normalisation
→ OpenSynapticEngine.compress() # Base62 solidity compression
→ OSVisualFusionEngine.run_engine() # binary packet (FULL / DIFF strategy)
→ OpenSynaptic.dispatch(medium="UDP") # physical send via transporter
src/opensynaptic/
├── core/
│ ├── __init__.py # Public core facade + active backend loader
│ ├── pycore/
│ │ ├── core.py # Orchestrator – OpenSynaptic class
│ │ ├── standardization.py # UCUM normalisation
│ │ ├── solidity.py # Base62 compress / decompress
│ │ ├── unified_parser.py # Binary packet encode/decode, template learning
│ │ ├── handshake.py # CMD byte dispatch, device ID negotiation
│ │ └── transporter_manager.py # Auto-discovers pluggable transporters
│ ├── rscore/ # Rust core backend + build/check helpers
│ ├── transport_layer/ # L4 protocol managers and protocols/
│ ├── physical_layer/ # PHY protocol managers and protocols/
│ ├── layered_protocol_manager.py # 3-layer protocol orchestration
│ ├── coremanager.py # Core selection/runtime manager
│ └── loader.py # Core/plugin loader
├── services/
│ ├── service_manager.py # Plugin mount / load / dispatch hub
│ ├── plugin_registry.py # Built-in plugin mapping + config default sync
│ ├── tui/ # Terminal UI service (section-aware, interactive)
│ ├── web_user/ # Lightweight web UI + user management API
│ ├── dependency_manager/ # Dependency check/repair/install plugin
│ ├── env_guard/ # Environment guard service
│ ├── transporters/ # Application-layer transporter service
│ ├── db_engine/ # Database integration service
│ └── test_plugin/ # Built-in component & stress test suite
├── utils/
│ ├── constants.py # LogMsg enum, MESSAGES, CLI_HELP_TABLE
│ ├── logger.py # os_log singleton
│ ├── paths.py # OSContext, read_json, write_json, get_registry_path
│ ├── base62/ # Base62 codec bindings/utilities
│ ├── security/ # crc/xor/session-key helpers
│ └── c/ # Native loader/build helpers
├── CLI/
│ └── app.py # Argparse CLI (os-node entrypoint)
plugins/
└── id_allocator.py # uint32 ID pool, persisted to data/id_allocation.json
libraries/
└── Units/ # UCUM unit definition JSON files
scripts/
└── concurrency_smoke.py # Concurrent pipeline smoke test
Config.json # Single source of truth for all runtime settings
Prerequisites
- Python 3.11+
- Optional:
mysql-connector-python,psycopg[binary],aioquic(seepyproject.toml)
Install
pip install -e .
Minimal Usage
from opensynaptic.core import OpenSynaptic
node = OpenSynaptic() # reads Config.json automatically
node.ensure_id("192.168.1.100", 8080) # request device ID from server
packet, aid, strategy = node.transmit(sensors=[["V1", "OK", 3.14, "Pa"]])
node.dispatch(packet, medium="UDP")
from opensynaptic.core import get_core_manager
manager = get_core_manager()
print(manager.available_cores()) # e.g. ['pycore', 'rscore']
manager.set_active_core('pycore')
OpenSynaptic = manager.get_symbol('OpenSynaptic')
CLI Quick Reference
All commands are available via os-node (installed entrypoint) or python -u src/main.py:
| Command | Description |
|---|---|
run |
Persistent run loop with heartbeat |
snapshot |
Print node/service/transporter JSON snapshot |
ensure-id |
Request device ID from server |
transmit |
Encode one sensor reading and dispatch |
inject |
Push data through pipeline stages and inspect output |
decode |
Decode a binary packet (hex) or Base62 string back to JSON |
watch |
Real-time poll a module's state (config / registry / transport / pipeline) |
tui |
Render TUI snapshot (add --interactive for live mode) |
config-show |
Display Config.json or a specific section |
config-get |
Read a dot-notation key path from Config |
config-set |
Write a typed value to a Config key path |
core |
Show/switch core backend (pycore / rscore) |
transporter-toggle |
Enable or disable a transporter in Config |
plugin-list |
List mounted service plugins |
plugin-load |
Load a mounted plugin by name |
plugin-cmd |
Route a sub-command to a plugin's CLI handler |
plugin-test |
Run component or stress tests |
native-check |
Check native compiler/toolchain availability |
native-build |
Build native C bindings (optionally include RS core) |
rscore-build |
Build and install Rust RS core shared library |
rscore-check |
Check RS core DLL/runtime readiness and active core |
web-user |
Run web_user plugin directly from CLI |
deps |
Run dependency_manager plugin directly from CLI |
transport-status |
Show all transporter layer states |
db-status |
Show DB engine status |
help |
Print full help |
Full usage examples → src/opensynaptic/CLI/README.md
Config.json
Config.json at the project root is the single source of truth.
Key fields:
| Key | Type | Default | Effect |
|---|---|---|---|
assigned_id |
uint32 | 4294967295 |
Device ID; 4294967295 = unassigned |
engine_settings.precision |
int | 4 |
Base62 decimal places |
engine_settings.active_standardization |
bool | true |
Toggle UCUM normalisation stage |
engine_settings.active_compression |
bool | true |
Toggle Base62 compression stage |
RESOURCES.transporters_status |
map | {} |
Legacy merged compatibility map (mirrors layer-specific status maps) |
security_settings.drop_on_crc16_failure |
bool | true |
Drop packets with bad CRC |
Full schema → docs/CONFIG_SCHEMA.md
Testing
# Component tests (unit tests for each pipeline stage)
python -u src/main.py plugin-test --suite component
# Stress test (200 concurrent pipeline encode cycles)
python -u src/main.py plugin-test --suite stress --workers 8 --total 200
# Web UI (foreground mode)
python -u src/main.py web-user --cmd start -- --host 127.0.0.1 --port 8765 --block
# Dependency checks and repair
python -u src/main.py deps --cmd check
python -u src/main.py deps --cmd repair
# Both suites
python -u src/main.py plugin-test --suite all
# Standalone smoke test
python scripts/concurrency_smoke.py 200 8 6
Packaging And Release
# Build and validate Python distributions (maturin-only)
py -3 -m pip install -e .[dev]
py -3 -m maturin sdist --manifest-path src/opensynaptic/core/rscore/rust/Cargo.toml --out dist
py -3 -m maturin build --manifest-path src/opensynaptic/core/rscore/rust/Cargo.toml --release --out dist
py -3 -m twine check dist/*
GitHub Actions workflows are defined in .github/workflows/ci.yml and .github/workflows/release.yml.
Configure repository secrets TEST_PYPI_API_TOKEN and PYPI_API_TOKEN before tag-based publishing.
v0.2.0 Performance Focus
This release line emphasizes practical performance tuning and backend acceleration:
- Multi-process stress controls:
--processes,--threads-per-process,--batch-size - Auto-tuning profile scan:
--auto-profilewith--profile-processes,--profile-threads,--profile-batches - RS core workflow:
rscore-build,rscore-check,core --set rscore --persist - Backend comparison flow:
plugin-test --suite compare
Detailed release note -> docs/releases/v0.2.0.md
Optimized Usage Examples
# High-throughput multi-process stress
python -u src/main.py plugin-test --suite stress --total 20000 --workers 16 --processes 4 --threads-per-process 4 --batch-size 64
# Auto-profile best concurrency matrix
python -u src/main.py plugin-test --suite stress --auto-profile --profile-total 50000 --profile-runs 1 --final-runs 1 --profile-processes 1,2,4,8 --profile-threads 4,8,16 --profile-batches 32,64,128
# Build/check/switch to RS core
python -u src/main.py rscore-build
python -u src/main.py rscore-check
python -u src/main.py core --set rscore --persist
# Compare pycore vs rscore performance
python -u src/main.py plugin-test --suite compare --total 10000 --workers 8 --processes 2 --threads-per-process 4 --runs 2 --warmup 1
RS Core (rscore) Quick Start
Use this flow to build, verify, and switch to the Rust core backend.
# 1) Build RS core shared library
python -u src/main.py rscore-build
# 2) Verify runtime status (DLL path/load state, active core)
python -u src/main.py rscore-check
# 3) Switch backend for current process + persist in Config.json
python -u src/main.py core --set rscore --persist
# 4) Optional: enforce RS path in stress tests
python -u src/main.py plugin-test --suite stress --total 5000 --workers 8 --processes 2 --require-rust
If you need to keep Python backend, switch back with:
python -u src/main.py core --set pycore --persist
More details: docs/RSCORE_API.md, docs/PYCORE_RUST_API.md, docs/releases/v0.2.0.md
Adding a Transporter
See docs/TRANSPORTER_PLUGIN.md.
API Reference
See docs/API.md.
Core facade and loader reference -> docs/CORE_API.md
Documentation Hub
- Repository docs map:
docs/INDEX.md - Start here:
docs/README.md - Architecture walkthrough:
docs/ARCHITECTURE.md - Config schema:
docs/CONFIG_SCHEMA.md - Transporter/plugin extension:
docs/TRANSPORTER_PLUGIN.md - Core internals:
docs/internal/PYCORE_INTERNALS.md - Rust core references:
docs/RSCORE_API.md,docs/PYCORE_RUST_API.md - Upgrade guide:
docs/guides/upgrade/v0.3.0.md - Driver quick reference:
docs/guides/drivers/quick-reference.md - Version comparison report:
docs/reports/releases/v0.2.0-v0.3.0-comparison.md - Release summary:
docs/releases/announcement-summary-v0.3.0.md
Release Notes
- Project changelog:
CHANGELOG.md - v0.2.0 draft archive:
docs/releases/v0.2.0.md - v0.3.0 announcement:
docs/releases/v0.3.0_announcement.md
Plugin Config Auto-Sync
Built-in plugin settings are stored in Config.json at:
RESOURCES.service_plugins.<plugin_name>
These entries are auto-created with defaults if missing; plugins remain manual-start and do not auto-run at process startup.
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 opensynaptic-1.0.0rc6-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: opensynaptic-1.0.0rc6-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a16f2e833e3911c441642cba37e20d537303ae5cbac3fe45c9313a2822870e4a
|
|
| MD5 |
95179f4e5b6ec8720f1a1febd11e6c7f
|
|
| BLAKE2b-256 |
4232f098c4112d5465ab56343073b2a406b166bb5c52d57cd6ab6a5b575a8d3a
|
File details
Details for the file opensynaptic-1.0.0rc6-cp313-cp313-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: opensynaptic-1.0.0rc6-cp313-cp313-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.13, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac41eb5481db556bfd5383cb34c685b349f9733bdc508d4980cef2d294fb7816
|
|
| MD5 |
d988f0d5014b73a6e675c6174cc156d6
|
|
| BLAKE2b-256 |
cf4386d68b7c963a3f65b18f2c1b2d4a8dd6d043526954e24fba7605e75db68b
|
File details
Details for the file opensynaptic-1.0.0rc6-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.
File metadata
- Download URL: opensynaptic-1.0.0rc6-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a8ec1124a5813e123d6fff6f74fabd3beb29c54a725e3f1eb7728c5d57b351e
|
|
| MD5 |
91441052dace3c89f443e4d22a08bf62
|
|
| BLAKE2b-256 |
241773d497bbe59994899c0ec344c6e5dd820e38ebb613e07da56548ed6b7ca0
|
File details
Details for the file opensynaptic-1.0.0rc6-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: opensynaptic-1.0.0rc6-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93e931d4f037e72f343df7ed8f40988bb8808c2944a7dad29f6f821fd7c011a6
|
|
| MD5 |
e6f85791def20666fd76eb3dae9aa0f8
|
|
| BLAKE2b-256 |
3f4f0a8c0a6ae423df3822b6891f34dad626ca0d8d58ee5181aae59e1737dc4c
|
File details
Details for the file opensynaptic-1.0.0rc6-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: opensynaptic-1.0.0rc6-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5853a5a56558cf2bbd3327a1acb9bf7ffc866fbd433a5c8bb9ad0f6812c4555
|
|
| MD5 |
aecb83eb3b67dd0da7632e8b0d382fc4
|
|
| BLAKE2b-256 |
b17669c096b832a7629472d88b7c923f1d509855aec71f21a6e9750250e7ed51
|
File details
Details for the file opensynaptic-1.0.0rc6-cp312-cp312-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: opensynaptic-1.0.0rc6-cp312-cp312-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.12, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
191b9bcea66758ce0b83e5ef1a31c118eb8159c29c1a07f6f51fadb80a7e61c6
|
|
| MD5 |
566919f696a3c12fa24b01c6748efa20
|
|
| BLAKE2b-256 |
fb56f8fb903cdffbaa0b0952d78e16f7f41bade836ab01fb35c1607229e8a2a9
|
File details
Details for the file opensynaptic-1.0.0rc6-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.
File metadata
- Download URL: opensynaptic-1.0.0rc6-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
530535ef24337efb13ebf99b005cefd77ad922923fc92537f55e7e1d2021a2df
|
|
| MD5 |
36e1a9242a8c9aebc7f1f8b31a4a1b51
|
|
| BLAKE2b-256 |
88706ee7b2db266558c6543c904096c91e1429b58fb480337e3a416a62696a7a
|
File details
Details for the file opensynaptic-1.0.0rc6-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: opensynaptic-1.0.0rc6-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
754372cd7d226ba2a2d754b3a70d46281faf9127cad6658db0e099fd1a111efd
|
|
| MD5 |
1fca996498e45aa48c0025dba5097586
|
|
| BLAKE2b-256 |
397ebc09162a9cde2a425e0e78b4e5a3a3bffeb743bd03a1477493805f0b4d49
|
File details
Details for the file opensynaptic-1.0.0rc6-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: opensynaptic-1.0.0rc6-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f108f8ae9b9fda5c79e2e4eae02b56e7e3254de636d57d27558c7854c20b665a
|
|
| MD5 |
9324c56f0ec3c7774db505861e6e4b83
|
|
| BLAKE2b-256 |
08e07ed8a0efcea7cfc9ecef2f029a2eb9d3d9456102a9091efa8a1845ab806b
|
File details
Details for the file opensynaptic-1.0.0rc6-cp311-cp311-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: opensynaptic-1.0.0rc6-cp311-cp311-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.11, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f12b2ecdcb0c9cc93811160e3a246777fa1cdb4edf07f7cbf949853a385aa6b5
|
|
| MD5 |
cbf55eedcf1c5d6c13e1f7b2f422ae4b
|
|
| BLAKE2b-256 |
13fa563496f6587e5ce0a1c8ecc26753d3f529dc429ba3aafce988f7dc63848c
|
File details
Details for the file opensynaptic-1.0.0rc6-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.
File metadata
- Download URL: opensynaptic-1.0.0rc6-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7026b08abd01bc3232407af8f65bf5d642c932986b6709e5ee66321cd201df3
|
|
| MD5 |
e6d5039a9f73bc75886189af829e6e80
|
|
| BLAKE2b-256 |
2930d5e45b2029ecf4bcb601d891f4e46187e9671e2b5c62cb5ac6b2b349b80e
|
File details
Details for the file opensynaptic-1.0.0rc6-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: opensynaptic-1.0.0rc6-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a6027e9d5ed08a5f25760221e3663d590b93c3b89b9583ac475cf69912d6eb2
|
|
| MD5 |
950996d34bef2ffb75164ecb6828365d
|
|
| BLAKE2b-256 |
05b79d34da562f304e41de55ed14cb0775c10b9ce4dcd544e5daf0303a5a68f6
|