Skip to main content

chumicro-compat

Stdlib polyfills for the bits CircuitPython and MicroPython skipped.

Import the polyfill submodule (from chumicro_compat.functools import partial) instead of the stdlib module and your code works everywhere. CPython gets the real C implementation (zero overhead); CircuitPython and MicroPython get a lightweight pure-Python version of the same public API.


Part of the ChuMicro family: small, focused Python libraries for microcontrollers and laptops. Browse all libraries.

Install

# CircuitPython (after `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

For bundle setup, pre-compiled .mpy bundles, the experimental channel, and details on PyPI naming, see the chumicro INSTALL guide.

Quick example

from chumicro_compat.functools import partial

def set_led(pin: int, brightness: int) -> None:
    """Set an LED pin to a brightness level."""
    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)

Where this fits

Leaf: no upstream ChuMicro deps. It is a standalone polyfill that no chumicro library currently requires; reach for it in your own code when you want stdlib features (functools.partial, …) missing from CircuitPython / MicroPython.

Platform support

Runtime What happens
CPython Uses the built-in functools.partial directly, zero overhead
MicroPython Lightweight pure-Python replacement
CircuitPython Lightweight pure-Python replacement

The public API (.func, .args, .keywords, __call__, __repr__) is identical across all runtimes.

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)

Contributing

Issues, bug reports, and pull requests are welcome, and so is "I ran it on this board and here's what happened", some of the most useful feedback a hardware project can get. Development happens in the ChuMicro repository, whose contributing guide covers setup and the test workflow.

Docs

📖 Stable docs · Experimental docs

Find this library

License

MIT

Metadata

Release files for chumicro-compat-experimental 0.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chumicro-compat-experimental 0.3.4
File Size Uploaded
chumicro_compat_experimental-0.3.4.tar.gz 9.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chumicro-compat-experimental 0.3.4
File Interpreter ABI Platform
chumicro_compat_experimental-0.3.4-py3-none-any.whl Python 3 none any Details

Total release size: 14.1 kB

Release files / chumicro_compat_experimental-0.3.4.tar.gz

Download URL chumicro_compat_experimental-0.3.4.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6c3bb0c0a5ab7dcda21f17ba9cb058ace1df69dc65cc5f122c6e78cbb3ef7393
BLAKE2b-256 checksum
How to use checksums
94d337b13561d17b1b3ab78706d247439f2e647ef5acfc8b6e296a360fffefa0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 18, 2026.

Transparency log

Release files / chumicro_compat_experimental-0.3.4-py3-none-any.whl

Download URL chumicro_compat_experimental-0.3.4-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c0f292773ddfd90ec2b245fc67c0f7b5c6ef8805728842fab0e0da1e67aeee0e
BLAKE2b-256 checksum
How to use checksums
7f8a8a226f471c6d1176192b94d43807a8c854bf3a7c65b7cb9309d1631ab2e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 18, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.5

2 release files

This release

0.3.4 This release

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.1.23

2 release files

0.1.22

2 release files

0.1.21

2 release files

0.1.20

2 release files

0.1.19

2 release files

0.1.18

2 release files

0.1.16

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page