No project description provided
Project description
chumicro-compat
Cross-runtime compatibility polyfills for CPython, MicroPython, and CircuitPython.
Provides lightweight reimplementations of CPython standard-library features that are missing or incomplete on microcontroller runtimes. On CPython, re-exports the real C implementations for zero overhead.
Installation
# CPython (pip)
pip install chumicro-compat
# CircuitPython (circup)
circup bundle-add ChuMicro/chumicro-bundle
circup install chumicro-compat
# MicroPython (mip)
mpremote mip install github:ChuMicro/chumicro-bundle/chumicro_compat
For experimental (pre-release) versions from the develop branch:
pip install chumicro-compat-experimental
circup install chumicro-compat-experimental
mpremote mip install github:ChuMicro/chumicro-bundle/chumicro_compat_experimental
Quick example
from chumicro_compat.functools import partial
def set_led(pin, brightness):
print(f"pin {pin} → {brightness}%")
# Freeze the pin, vary the brightness later.
set_status_led = partial(set_led, 13)
set_status_led(50) # pin 13 → 50%
set_status_led(100) # pin 13 → 100%
What's included
functools
| Symbol | Description |
|---|---|
partial(func, *args, **keywords) |
Freeze positional and keyword arguments to a callable |
partial.func |
The original wrapped callable |
partial.args |
Frozen positional arguments (tuple) |
partial.keywords |
Frozen keyword arguments (dict) |
Platform support
| Runtime | Implementation |
|---|---|
| CPython | Re-exports the C-implemented functools.partial directly |
| MicroPython | Pure-Python polyfill with __slots__ |
| CircuitPython | Pure-Python polyfill with __slots__ |
The public API (.func, .args, .keywords, __call__, __repr__) is identical across all runtimes.
Docs
- User guide — what's polyfilled and why, usage patterns
- API reference — full API documentation
Examples
| Example | What it shows |
|---|---|
partial_basic.py |
Freeze one argument to a function |
partial_keyword_override.py |
Freeze keyword args, override at call time |
partial_callback.py |
Wire a callback with frozen context (embedded pattern) |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chumicro_compat-0.1.0.tar.gz.
File metadata
- Download URL: chumicro_compat-0.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce5af40144340febfbee7c84bd80ea5eb8b2365b048c8917f4ede6781357aff9
|
|
| MD5 |
850ccf2b9ac43fdbef68a2d31f40ed28
|
|
| BLAKE2b-256 |
d02ce6da2e776f0a3b4399b464e6b91f686a5dd8f6eff4a0c6a3b143088ba966
|
Provenance
The following attestation bundles were made for chumicro_compat-0.1.0.tar.gz:
Publisher:
release.yml on ChuMicro/ChuMicro
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chumicro_compat-0.1.0.tar.gz -
Subject digest:
ce5af40144340febfbee7c84bd80ea5eb8b2365b048c8917f4ede6781357aff9 - Sigstore transparency entry: 1239411441
- Sigstore integration time:
-
Permalink:
ChuMicro/ChuMicro@780debcbb227a298fdb7940e424fc3e372e47107 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ChuMicro
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@780debcbb227a298fdb7940e424fc3e372e47107 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file chumicro_compat-0.1.0-py3-none-any.whl.
File metadata
- Download URL: chumicro_compat-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1406b440207556a30e0d24366b6e84ee2dade4b94fc86592cd8284786ec4fc09
|
|
| MD5 |
288e493637f4b2ab7b6bb6e75c67ddfc
|
|
| BLAKE2b-256 |
5007b70ca8be097c4dbb19e959a388fb9b60b8bb7c4510052698596e1ac0a379
|
Provenance
The following attestation bundles were made for chumicro_compat-0.1.0-py3-none-any.whl:
Publisher:
release.yml on ChuMicro/ChuMicro
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chumicro_compat-0.1.0-py3-none-any.whl -
Subject digest:
1406b440207556a30e0d24366b6e84ee2dade4b94fc86592cd8284786ec4fc09 - Sigstore transparency entry: 1239411450
- Sigstore integration time:
-
Permalink:
ChuMicro/ChuMicro@780debcbb227a298fdb7940e424fc3e372e47107 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ChuMicro
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@780debcbb227a298fdb7940e424fc3e372e47107 -
Trigger Event:
workflow_dispatch
-
Statement type: