Cross-runtime compatibility polyfills for CircuitPython, MicroPython, and CPython — functools.partial and more.
Project description
chumicro-compat
Cross-runtime compatibility polyfills for CircuitPython, MicroPython, and CPython.
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
CircuitPython (circup)
Register the ChuMicro bundle (remove the other channel first if switching):
circup bundle-remove ChuMicro/ChuMicro-Bundle-Experimental # skip if never added
circup bundle-add ChuMicro/ChuMicro-Bundle
circup install chumicro-compat
MicroPython (mip)
mpremote mip install github:ChuMicro/ChuMicro-Bundle/chumicro_compat
CPython (pip)
pip install chumicro-compat
Experimental (pre-release) versions
Pre-release builds are published automatically when a library version is bumped. Do not register both bundles simultaneously — circup may pick either version for a given package.
# CircuitPython
circup bundle-remove ChuMicro/ChuMicro-Bundle # skip if never added
circup bundle-add ChuMicro/ChuMicro-Bundle-Experimental
circup install chumicro-compat
# MicroPython
mpremote mip install github:ChuMicro/ChuMicro-Bundle-Experimental/chumicro_compat
# CPython
pip install 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
📖 Stable docs · Experimental docs
Browse on GitHub:
- 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) |
Find this library
PyPI: chumicro-compat Bundle: ChuMicro-Bundle (CircuitPython & MicroPython) Source: ChuMicro/ChuMicro — cross-runtime Python libraries for ESP32, RP2040, and other microcontrollers.
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.13.tar.gz.
File metadata
- Download URL: chumicro_compat-0.1.13.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f1e6ed304748957225f6483f9f6764bafcc84635fd9a48e156e0540e2947c52
|
|
| MD5 |
7afebe4c4f5d3f73a3893a128a6620db
|
|
| BLAKE2b-256 |
1b861a5ee44c3845208788cf79a7d77f61848bc875ce829a9bfd99e15855942a
|
Provenance
The following attestation bundles were made for chumicro_compat-0.1.13.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.13.tar.gz -
Subject digest:
2f1e6ed304748957225f6483f9f6764bafcc84635fd9a48e156e0540e2947c52 - Sigstore transparency entry: 1245336578
- Sigstore integration time:
-
Permalink:
ChuMicro/ChuMicro@6c12b8d306740c9ef2358e5aa1c977de45aeef13 -
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@6c12b8d306740c9ef2358e5aa1c977de45aeef13 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file chumicro_compat-0.1.13-py3-none-any.whl.
File metadata
- Download URL: chumicro_compat-0.1.13-py3-none-any.whl
- Upload date:
- Size: 3.9 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 |
63d2f14b6d3f0381e199806675f62b6fae860f29904bdfc1e9efe37b964c8bf1
|
|
| MD5 |
681e318dbfd34e186887e99a05e0cc19
|
|
| BLAKE2b-256 |
66d910aaad432fb8e558de2779f06f0af4c8fbe0b7cd6851d003336e15bafbe0
|
Provenance
The following attestation bundles were made for chumicro_compat-0.1.13-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.13-py3-none-any.whl -
Subject digest:
63d2f14b6d3f0381e199806675f62b6fae860f29904bdfc1e9efe37b964c8bf1 - Sigstore transparency entry: 1245336582
- Sigstore integration time:
-
Permalink:
ChuMicro/ChuMicro@6c12b8d306740c9ef2358e5aa1c977de45aeef13 -
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@6c12b8d306740c9ef2358e5aa1c977de45aeef13 -
Trigger Event:
workflow_dispatch
-
Statement type: