Skip to main content

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-wizard supported)

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.

OpenSynaptic Demo Quickstart


Table of Contents


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 (see pyproject.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-profile with --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


Release Notes

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

opensynaptic-1.0.0rc7-cp313-cp313-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.13Windows x86-64

opensynaptic-1.0.0rc7-cp313-cp313-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

opensynaptic-1.0.0rc7-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

opensynaptic-1.0.0rc7-cp313-cp313-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

opensynaptic-1.0.0rc7-cp312-cp312-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.12Windows x86-64

opensynaptic-1.0.0rc7-cp312-cp312-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

opensynaptic-1.0.0rc7-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

opensynaptic-1.0.0rc7-cp312-cp312-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

opensynaptic-1.0.0rc7-cp311-cp311-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.11Windows x86-64

opensynaptic-1.0.0rc7-cp311-cp311-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

opensynaptic-1.0.0rc7-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

opensynaptic-1.0.0rc7-cp311-cp311-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file opensynaptic-1.0.0rc7-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc7-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d40a4f9b1aed7f17454c585e1ee00ddf85d359cf5a3d9b148f8c672d1cf6f6fa
MD5 a4af5e1ed6bcb15a2b613de50c13b2a6
BLAKE2b-256 6cee8bb845beeeecf4edfebaa6efcf9990af6041a9cb7825446fdb738e79d31d

See more details on using hashes here.

File details

Details for the file opensynaptic-1.0.0rc7-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc7-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d53645458635fa4eb2c7c4e15de3df37fe87df15d0c2a449a68bed367cb057fb
MD5 85a0efd5d1fa83977ebcb4f4012deb68
BLAKE2b-256 749d95fde78e708dad64669975f3a9b95075134c49df943b461db36319bcd0d5

See more details on using hashes here.

File details

Details for the file opensynaptic-1.0.0rc7-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc7-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 26fdc1df0c15948c9669454ebf292646d4d79a11fa51e3ea4a28814c5b61f161
MD5 85bacf4f706191d83a4a04f04a1275b5
BLAKE2b-256 a4a7f8d3a2cf562a9dd26c6fe51fbaf24b89751424024e79702b8d2b461f62bd

See more details on using hashes here.

File details

Details for the file opensynaptic-1.0.0rc7-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc7-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4b4a65bba784d2cfda73b5730d2ed7958b661f3c7625a410fa53a4e8298d92f3
MD5 bceecac3c45ac4e64b84df1c1a4b7df9
BLAKE2b-256 c07cb54b945109886de35ad5f77d17c38b68efbe12ff51fdcba91b96ad3e4267

See more details on using hashes here.

File details

Details for the file opensynaptic-1.0.0rc7-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d2fb3f26985b81bd1fbb857b1ef6b6bf718a84a6789272b513eebc694c84eab8
MD5 52191c685b878c3933178c20b9004731
BLAKE2b-256 cb8d1d4a85735a8606499b6fd6b10f68c2b1fcb020bb19d9e97031722a62fac4

See more details on using hashes here.

File details

Details for the file opensynaptic-1.0.0rc7-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc7-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 100853027aeef737a3a766aabf3d0fa46f4198b64ddd47979b6bc4d3ffc7b61c
MD5 f011fe4165f30f3863b4c6e3f365d894
BLAKE2b-256 f2d22ea7ca08108b283c9abf1063b1a23ff34aa23e461f4c5cb67cfe58a8f64e

See more details on using hashes here.

File details

Details for the file opensynaptic-1.0.0rc7-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc7-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 ed26bc75f680a108497c47e3a66b049e184b4a12805770393c849dfea1351c8f
MD5 9567bfa4905a0703d6d5e6040777b09c
BLAKE2b-256 9d8be35fd6a81afbabe03339fd8b28416de6bb6ad29b2691a11c7d7685d9cf4c

See more details on using hashes here.

File details

Details for the file opensynaptic-1.0.0rc7-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc7-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2e408e6d11c2d33e2b75dd3ee7eb5e8a0645e8ca0444e7576d48ce48815d8f3f
MD5 1075613a67108f15847d1686b674d4cc
BLAKE2b-256 db641cdfbc21764e28f5916f468c30eb8092ccb792a3dfa5a7d6a23700bef910

See more details on using hashes here.

File details

Details for the file opensynaptic-1.0.0rc7-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc7-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 94803fd50d87919eb7c4a770e64f692ca5cd5fedb9c2fd14837e9fbef7381ef0
MD5 1f0a9c9c1630fe11dcf2c2c142d8b62e
BLAKE2b-256 0742994b46e4b8a47e90edf3db2dccca605bd08846150a606421f385706c0d6d

See more details on using hashes here.

File details

Details for the file opensynaptic-1.0.0rc7-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc7-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c24f81458307c7bf1ae000951f20a412d981334cbfe3c52737cab29e693fc2af
MD5 40393e162f0fbe5b17efba31ad89234d
BLAKE2b-256 9b10fefa56a2a0be71d27ef89c9c153bf900cc1c060089c8e9dabdc311e2d9dd

See more details on using hashes here.

File details

Details for the file opensynaptic-1.0.0rc7-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc7-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 bd96ae5ffbeeb013b80cad1a23d202b59032e6047a913be6376734ff3e1f0385
MD5 d60c016b1ce58055c2729884dd1cb90c
BLAKE2b-256 dfdd2cefd9a4af3cebab233c797549db648112bd58a91fb468fa58b3697436e1

See more details on using hashes here.

File details

Details for the file opensynaptic-1.0.0rc7-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc7-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 87fc27a916d4f8e4c4e6aded9261105d1b0a5cc70ddeb29d78b6560c3e9e05be
MD5 1b25f45c61c3f27710076878510561db
BLAKE2b-256 b20df82d3bcbceac08512cb6533847ac962e25b794bf6c52d9a37e447200700a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page