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

Uploaded CPython 3.13Windows x86-64

opensynaptic-1.0.0rc5-cp313-cp313-musllinux_1_2_x86_64.whl (415.4 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

opensynaptic-1.0.0rc5-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.0rc5-cp313-cp313-macosx_11_0_arm64.whl (295.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

opensynaptic-1.0.0rc5-cp312-cp312-win_amd64.whl (260.5 kB view details)

Uploaded CPython 3.12Windows x86-64

opensynaptic-1.0.0rc5-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.0rc5-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.0rc5-cp312-cp312-macosx_11_0_arm64.whl (295.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

opensynaptic-1.0.0rc5-cp311-cp311-win_amd64.whl (260.5 kB view details)

Uploaded CPython 3.11Windows x86-64

opensynaptic-1.0.0rc5-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.0rc5-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.0rc5-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.0rc5-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 db7017988a1d0b819865cb875ee97546a9ee008e8f112a58ca89df4aee237602
MD5 f85814006a070b85aebd623cceedb4bc
BLAKE2b-256 ab990bece12421a94106cb39b94119392b15fc89a4c23d1e8f0837b69a47c5eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc5-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 229ad3bfc940ccd6a98596891f6baa7858d32b36ea6a6d8aeef1a1089ed52f00
MD5 0dfaa0260a2fe2437b73a3ab9ae38cbb
BLAKE2b-256 f7c30f4d0d89228bad40f1f85428aa220c73e65a86baf8ee9a2a0c22814eb624

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc5-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 2bc0e8be6857170003ee21f747f2a7df31ec15ca18053c15ad32d83c5279c469
MD5 f7c7050680e6ebe10c995943deb3a668
BLAKE2b-256 76a0b8247513d3aca715cf89281946ab95c8f2b64901a2fc71bbdb4af2aaafd3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc5-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 43996ecce90956f6bd3df2882d89da924b4707e5899a554a84f90028ce4bf994
MD5 4fd9bbf143158edb6771ff8e1ecde9e3
BLAKE2b-256 3f0c57f8c48e9513f78946ae10d330d48602d7983a78132453023806db946f09

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ac49a7607321354fa35e818a77b389c1c55ced2abaaf5a56d0b9852f4c84715a
MD5 c4c5915c3308b3fd87f09ee57029b0ad
BLAKE2b-256 16f2c374c91f91d7a7cab09b798ccd8f8017e7f18682a5dfa9fbb6f44139d7cf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc5-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 5806278ce1b974645e6ec553efa25c216513dd5e5bbaa6eed1a36e6a91852240
MD5 a421dd1f2d5cb2e0126775819bd3051a
BLAKE2b-256 514f4422d1f1067cc32b8b1b05923dfd689a1dfe5ca6520aef39542df1bdd992

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc5-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 6eddd52987675f975f0641a7eef4223c6c9ed0a24aa08e1602412898db822c58
MD5 8b802a2ed388321df9497ae65cc87051
BLAKE2b-256 a5359023cc56405b0c919cf4d8e76abfc1369b58184211cbda1cd3cbc5e8f3ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc5-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6ccdbe0725c553ca1d8facd06867ab3f82d5087edd46a68171c7a4fd47f32ba7
MD5 66610583353405edf969789496f5ac4e
BLAKE2b-256 13325591164e795e8ba58604d42aa6b3509fe127dccac70c5bec5e44e50fef32

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f72fe86a1f4286b8656c0b87a02f24a8dd791f5576ca4df24ccafd7ffffdd946
MD5 80c982a00b259219be5d1a20490f32fc
BLAKE2b-256 a7fc101d180482965b02641f8e57ba7c940121222f6fb4023ba8bbfd6366f362

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc5-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 5ae7107bc6534b4eb2f09de2a19443faabcbd8e454fc23b4d3dded2632b1cb68
MD5 63f4e235a7aacb11dc563884b3078ef3
BLAKE2b-256 abcb29430de100dc1090f9ed1be4c3414495e9f5801dfde3e8af5756ad470445

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc5-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 80a8ba5dc3c1e9d3892ec57925477befabb659c040744f654957af39e75a834b
MD5 f2862910193768a9c384b089243d3246
BLAKE2b-256 fa5cd8eccce47073dbb0d451081ade5e60c9ab7688debaa0320843f644c16f3e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opensynaptic-1.0.0rc5-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f3c3c2e13f071eae8fbac6f0254b7235da2e61230a93686b37a737155578be70
MD5 41d0cdee5c57bb087239694719ce0542
BLAKE2b-256 742392eff3dc47286a483d4bbc2e03a2acc4a6572260a99ad26e00341883c8cd

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