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
py -3 -m pip install -e .[dev]
py -3 -m build
py -3 -m twine check dist/*

# Build Rust acceleration wheel (maturin)
py -3 -m maturin build --manifest-path src/opensynaptic/core/rscore/rust/Cargo.toml --release

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.0rc4-cp313-cp313-win_amd64.whl (260.3 kB view details)

Uploaded CPython 3.13Windows x86-64

opensynaptic-1.0.0rc4-cp313-cp313-musllinux_1_2_x86_64.whl (415.5 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

opensynaptic-1.0.0rc4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (338.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

opensynaptic-1.0.0rc4-cp313-cp313-macosx_11_0_arm64.whl (295.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

opensynaptic-1.0.0rc4-cp312-cp312-win_amd64.whl (260.4 kB view details)

Uploaded CPython 3.12Windows x86-64

opensynaptic-1.0.0rc4-cp312-cp312-musllinux_1_2_x86_64.whl (415.4 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

opensynaptic-1.0.0rc4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (338.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

opensynaptic-1.0.0rc4-cp312-cp312-macosx_11_0_arm64.whl (295.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

opensynaptic-1.0.0rc4-cp311-cp311-win_amd64.whl (260.4 kB view details)

Uploaded CPython 3.11Windows x86-64

opensynaptic-1.0.0rc4-cp311-cp311-musllinux_1_2_x86_64.whl (415.8 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

opensynaptic-1.0.0rc4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (338.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

opensynaptic-1.0.0rc4-cp311-cp311-macosx_11_0_arm64.whl (296.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b7a77d01eeaa1fd782c3a3d4d03114f4de24d4fe2a4aeab6dd878768c2d9475b
MD5 04b0c2a3e6a876a79e60d1720f6e7924
BLAKE2b-256 772a9e8e1634eaaef935526b03cce2e6e02c24e9daeb5530ed6537c203368bf6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc4-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 2e1ba8847d3abe4009e6a08ad0565c199a4e55e6e7ca26705405d4cf0e4ddb85
MD5 93d4cba9e1e133a146c25a3fdecd909c
BLAKE2b-256 ff52eef7938f79e780303dc877d120c6e522599330e202d6ebd8a995d863f624

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 b86e80bb3abd0d11c9ea05dfe58ba29066a141b37afbf5958c621d8a717c9c2c
MD5 b514d2e9dc7152422da9bb42395ec370
BLAKE2b-256 147aaa1a8fea9bce25f82d8881152f79fed5cdb6f67a0bffda1a1cce117e077a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 539e805140d4578da4229e4c2f625b384dc1fb2f2c25e0d05bc2d05a011ab601
MD5 f7465fdbcab18ef6174577354eb3acde
BLAKE2b-256 a1073a0e2f0ff35fb9426ed710b1c6bc456b26f88eddefc162e7ae3ef460033a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c76fffae3f8339cae3f8fa036ab4762fdd16cb6fe1a2419dc00bbda1ecdef2af
MD5 33c47c50c5ad86b62d60532fd643f372
BLAKE2b-256 70e0062a3d25344e5b39b93364979f8f40dcde965cd6058d35ecf17e6cb3eb5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc4-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ea56c06aaa9467f871f4b5333eae6af440a97b704e2896361a8981ab488f5b92
MD5 42fa3eb182e257d10c4b9838469a108b
BLAKE2b-256 c0f85766a576d9407b23e2cc0955d51a1a93f4c17def64c605c0a8710ff743b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 bdd9812a294bb943cd74940fe672f1412bdca62919d1546522a9c72f5ce561b1
MD5 e378f084b41e6c0f3db3da3a47484d32
BLAKE2b-256 e3bf3eb0fb8ac15d501409779ca04a60802616fde2a61871ceefc028a7608d3d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8eda96288b5932beaf8634b8253720800733633206c83db0a316a24dfd67b61f
MD5 1068b0512b6e94c5d75e50c84d3491fe
BLAKE2b-256 de1a679e186cb789c33b573e73ed95442a7a59061337802849c07eb1adb0a524

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 708876e40ac2f9e03df26ae89a6a331e5f8f8aecee31c2d37bd41bb4119671c1
MD5 9a02a5cc53f830296031a6746107384e
BLAKE2b-256 7d7ff4ac4786c258d22216b380beb784511d41fa53de0bd89f68f218e94873b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc4-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c5626a5a6c33a45ec33b0cbee94e6af6bf8b9491681a4ef4ec49d63416376697
MD5 27c611876b475f9b15855c89dc0b1709
BLAKE2b-256 57113125bf6f04f6f3c14fde670ade28611ac303351490e8d66c8d01e6ba7cbe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 a8958223aecbe9d829c4813f5daa900b308b948b09d3006363ba9376fd3bb488
MD5 910e11f419335b5119da2f0531010aea
BLAKE2b-256 b82c4097730820f324af494731a8e988fc27cf5c35a7e355a4cb47bfb8f6a2b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 93e050a7f85c35de03e6b1ecb7a64e280af34dabf197169e16a048dd9b6b7c3f
MD5 ba7892f0c742e877bde4f7fd755e20a4
BLAKE2b-256 34067f5b162f751e24873e470692cf6ed71747aec15daebc16603945fd03d751

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