Netcore
English | 简体中文
Netcore is a lightweight communication framework specifically designed for concurrent message transmission within a single connection. Through innovative message chunking and scheduling mechanisms, it enables simultaneous processing of multiple message streams without establishing multiple connections, significantly improving communication efficiency in resource-constrained scenarios.
Core Features
🚀 Concurrent Transmission Engine
• Single-connection multiplexing: Implements logically concurrent message streams on a single physical connection • Intelligent chunk scheduling: Automatically splits large messages into chunks for interleaved transmission, maximizing bandwidth utilization • Non-blocking I/O: Decouples message transmission from business processing to ensure system responsiveness
📦 Protocol & Transport
• Adaptive protocol layer: • Supports binary/JSON/raw data formats • Configurable chunk size (default 4KB) • Hybrid memory-file storage mode • Transport abstraction interface: • Compatible with any I/O devices (serial/TCP/Bluetooth/etc.) • Provides dual-mode synchronous/asynchronous APIs • Thread-safe message queue management
🧩 Enterprise-grade Capabilities
• Blueprint system: • Modular routing groups (supports prefixes and nesting) • Blueprint-level middleware and error handling • Hot-swappable component registration • Event hub: • Publish-subscribe pattern • One-time event binding • System lifecycle event monitoring (startup/shutdown/error) • Task scheduler: • Millisecond-level timing tasks • Adaptive priority queues • Failed task retry mechanism • Smart caching: • LRU memory cache • TTL auto-expiration • Cache penetration protection • Thread-safe access
Installation
pip install netcore
System Requirements: • Python ≥ 3.8 • No external dependencies (pure standard library implementation)
Quick Start
Basic Example: Serial Communication
from netcore import Endpoint, Pipe
import serial
# Initialize serial device
ser = serial.Serial('/dev/ttyUSB0', 115200)
# Create communication pipe (only requires read/write functions)
pipe = Pipe(ser.read, ser.write)
endpoint = Endpoint(pipe)
# Register message handler
@endpoint.request('sensor_data')
def handle_sensor():
return Response('sensor_ack', {"status": "OK"})
# Start service (default 4 worker threads)
endpoint.start()
Architecture Overview
-
Application Layer (Endpoint)
• Routing system: Handles message routing and blueprint registration • Event system: Implements publish-subscribe event hub • Task system: Manages scheduled tasks and priority queues • Cache system: Provides thread-safe LRU caching -
Transport Layer (Pipe)
• Send queue: Implements priority task queue management • Receive pool: Maintains temporary and complete message storage • Thread locks: Ensures thread-safe access to shared resources • Protocol integration: Deep integration with LsoProtocol for chunked transmission -
Protocol Layer (LsoProtocol)
• Intelligent chunking: Auto-selects memory/file storage based on data type • Metadata management: Maintains extended headers and message integrity checks • Hybrid storage: Enables seamless switching between memory buffers and persistent files -
Concurrency Model
• Main thread: Handles I/O monitoring and request queuing • Worker thread pool: Processes requests independently from queue • Thread isolation: Achieves request context isolation through thread-local storage -
Data Flow
• Bidirectional channel: Demonstrates complete loop from application layer to physical devices • Protocol transparency: Completely hides serialization/deserialization from upper layers • Asynchronous processing: Decouples non-blocking transmission from business logic
Documentation & Support
📚 Full Documentation | 💬 Community Discussions | 🐛 Issue Tracker
Documentation includes: • API Reference Manual • Architecture White Paper • Best Practice Guide • Performance Optimization Tips
Contribution Guide
We welcome contributions through:
- Code improvements via Pull Requests
- Documentation enhancements or translations
- Test case submissions
- Security vulnerability reports
License
Metadata
Release files for netcore 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| netcore-0.1.3.tar.gz | 29.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| netcore-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 59.8 kB
Release files / netcore-0.1.3.tar.gz
| Download URL | netcore-0.1.3.tar.gz |
|---|---|
| Size | 29.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6a23f3ce6c468f2171a50c3f5db9d4c4f2377b88df13ee34a43bb3cc3bcb64d4
|
|
BLAKE2b-256 checksum How to use checksums |
043647f38897e4feba4c9fd33ae36e07c8fba69b512bdb67d0b0a46fb42726a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.11
|
Release files / netcore-0.1.3-py3-none-any.whl
| Download URL | netcore-0.1.3-py3-none-any.whl |
|---|---|
| Size | 29.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ac26db864f65f36a0aea33d0ac2cf6a058301fbef0d9d6f996bf33684ad88d19
|
|
BLAKE2b-256 checksum How to use checksums |
4201ba7fbf7b5e425ebca2527e4846da0c286925ce78637b3922ed3b902c4b57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.11
|
Security for netcore 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.