pyMC_Core
pyMC_Core is a Python reimplementation of MeshCore — a lightweight, portable C++ library for multi-hop packet routing using LoRa radios. Designed for Raspberry Pi and similar hardware, pyMC_Core communicates with LoRa modules over SPI.
pyMC_Core is under active development. It's compatible with the original MeshCore protocol, but not yet as optimized or elegant as its C++ counterpart.
Documentation
**Complete documentation is available at https://rightup.github.io/pyMC_core/
Quick Links
- Node Usage Guide - Guide for using MeshNode
- Examples - Working code examples
- API Reference - Detailed API documentation
Quick Start
Installation
Important: On modern Python installations (Ubuntu 22.04+, Debian 12+), you may encounter
externally-managed-environmenterrors when installing packages system-wide. Create a virtual environment first:# Create virtual environment python3 -m venv pymc_env # Activate virtual environment # On Linux/Mac: source pymc_env/bin/activate # On Windows: pymc_env\Scripts\activate
# Install from PyPI
pip install pymc-core
# For hardware support (SX1262 radios)
pip install pymc-core[hardware]
# Install all dependencies
pip install pymc-core[all]
Basic Usage
import asyncio
from pymc_core import MeshNode, LocalIdentity
from pymc_core.hardware.sx1262_wrapper import SX1262Radio
async def main():
# Create radio (Waveshare HAT example)
radio = SX1262Radio(
bus_id=0, cs_pin=21, reset_pin=18,
busy_pin=20, irq_pin=16, txen_pin=6,
frequency=869525000, tx_power=22
)
radio.begin()
# Create mesh node
identity = LocalIdentity()
node = MeshNode(radio=radio, local_identity=identity)
await node.start()
print("Mesh node started!")
asyncio.run(main())
For examples, see the documentation.
Hardware Support
Supported Radios
- Waveshare SX1262 LoRaWAN/GNSS HAT - Popular Raspberry Pi LoRa module
- HackerGadgets uConsole - All-in-one extension board with LoRa support
- FrequencyLabs meshadv-mini - Raspberry Pi hat with E22-900M22S LoRa module
Requirements
- Raspberry Pi (or compatible SBC)
- SX1262 LoRa module
- SPI interface enabled
- Python 3.8+
What is MeshCore?
MeshCore enables long-range, decentralized communication using multi-hop packet routing. Devices (nodes) forward packets through neighboring nodes to reach distant ones — no central infrastructure required.
It occupies a middle ground between:
| Project | Focus |
|---|---|
| Meshtastic | Casual LoRa messaging |
| Reticulum | Full encrypted networking stack |
Use Cases
- Off-grid and emergency communication
- Tactical or field mesh deployments
- IoT mesh networks
- Remote monitoring systems
Architecture
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Application │ │ MeshNode │ │ Hardware │
│ │ │ │ │ │
│ • Text Messages │◄──►│ • Packet Routing│◄──►│ • SX1262 Radio │
│ • Advertisements│ │ • Identity Mgmt │ │ • SPI Interface │
│ • Telemetry │ │ • Event Service │ │ • GPIO Control │
│ • Group Channels│ │ • Repeater Mgmt │ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘
Security
- Ed25519/X25519 cryptographic identities
- End-to-end encryption for messages
- CRC validation for data integrity
- Secure key exchange protocols
Project Structure
pyMC_Core/
├── src/pymc_core/ # Main package
│ ├── hardware/ # Radio hardware interfaces
│ ├── node/ # MeshNode implementation
│ ├── protocol/ # Packet protocols
│ └── events/ # Event handling
├── examples/ # Working examples
│ ├── common.py # Shared utilities
│ ├── send_flood_advert.py
│ ├── send_direct_advert.py
│ └── ...
├── docs/ # MkDocs documentation
│ ├── docs/ # Documentation source files
│ ├── mkdocs.yml # MkDocs configuration
│ ├── requirements.txt # Documentation dependencies
│ └── serve-docs.sh # Local development script
├── .github/workflows/ # GitHub Actions
│ └── deploy-docs.yml # Documentation deployment pipeline
└── tests/ # Unit tests
Contributing
Contributions are welcome! Please see our contributing guide for details.
Development Setup
# Clone the repository
git clone https://github.com/rightup/pyMC_Core.git
cd pyMC_Core
# Install development dependencies
pip install -e .[dev]
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Original MeshCore C++ implementation
- Waveshare and HackerGadgets for hardware support
Support
Built with ❤️ for mesh networking enthusiasts
Metadata
Release files for pymc-core 1.0.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pymc_core-1.0.12.tar.gz | 289.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pymc_core-1.0.12-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 549.2 kB
Release files / pymc_core-1.0.12.tar.gz
| Download URL | pymc_core-1.0.12.tar.gz |
|---|---|
| Size | 289.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
28ed891c9e268dab20eb682e061fd8d86b7f8706a2af91ea05f976f4b04b4c1f
|
|
BLAKE2b-256 checksum How to use checksums |
10c1810e384ca0ebe77202c983ed1568d6ce79730eb0a908a99246315c48ca26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 22, 2026.
Transparency logRelease files / pymc_core-1.0.12-py3-none-any.whl
| Download URL | pymc_core-1.0.12-py3-none-any.whl |
|---|---|
| Size | 260.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0ab8f9f12d2423810558ef8561ff301d2021d50c6b8216f8dc1f1db6fb3a8668
|
|
BLAKE2b-256 checksum How to use checksums |
f9e803929b79cd53553103291a39f0121db6e04a755b0b7c6eedab8760e8675b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 22, 2026.
Transparency log