Introduction
This repository contains a selection of packages emulating the CircuitPython API for devices or hosts running CPython or MicroPython. Working code exists to emulate these CircuitPython packages:
analogio - analog input/output pins, using pin identities from board+microcontroller packages
bitbangio - software-driven interfaces for I2C, SPI
board - breakout-specific pin identities
busio - hardware-driven interfaces for I2C, SPI, UART
digitalio - digital input/output pins, using pin identities from board+microcontroller packages
keypad - support for scanning keys and key matrices
microcontroller - chip-specific pin identities
micropython - MicroPython-specific module
neopixel_write - low-level interface to NeoPixels
pulseio - contains classes that provide access to basic pulse IO (PWM)
pwmio - contains classes that provide access to basic pulse IO (PWM)
rainbowio - provides the colorwheel() function
usb_hid - act as a hid-device using usb_gadget kernel driver
For details, see the Blinka API reference.
Dependencies
The emulation described above is intended to provide a CircuitPython-like API for devices which are running CPython or Micropython. Since corresponding packages should be built-in to any standard CircuitPython image, they have no value on a device already running CircuitPython and would likely conflict in unhappy ways.
The test suites in the test/src folder under testing.universal are by design intended to run on either CircuitPython or CPython/Micropython+compatibility layer to prove conformance.
Blinka installs a platform-independent base package. On CPython, importing board checks the detected Raspberry Pi, Jetson, or AM33XX dependencies. An interactive terminal offers to install missing or incompatible packages with the running Python interpreter. Other boards retain their existing backend selection and manual dependency setup; unrelated packages are not installed.
Non-interactive programs never prompt or run pip. A missing backend reports its installation guidance when imported; a known incompatible installed version of a required GPIO backend reports an actionable error rather than silently continuing. PWM and NeoPixel backends are optional for board: declining their installation or encountering an installation failure does not block unrelated GPIO use. Installation failures produce a warning, and missing or known incompatible backends are reported when their feature is imported. If an upgraded backend was already imported, restart Python before using the replacement, even when that backend is optional. After installation, Blinka rechecks imports and required versions. If they are still unavailable (for example, after the first user-site installation), it reports restart guidance rather than continuing as though installation fixed the running process. Optional-only problems warn instead of aborting board.
Use a virtual environment where practical. The runtime installer does not use sudo, bypass externally managed environment protections, install OS packages, or change GPIO permissions. Native packages may still need a compiler and Python development headers provided by the operating system.
Installing from PyPI
On supported GNU/Linux systems like the Raspberry Pi, install from PyPI in a virtual environment:
mkdir project-name && cd project-name
python3 -m venv .env
source .env/bin/activate
pip3 install Adafruit-Blinka
For MCP2222 setup and backend details, see the implementation notes.
Environments created with uv
By default, uv venv does not install pip into the environment. Blinka’s automatic installer requires pip; it does not install pip or run uv for you. If pip has no runnable entry point, a confirmed installation reports manual recovery guidance without launching an installer. Missing optional PWM/NeoPixel packages still do not block unrelated GPIO use.
Use uv to install the required backends into the same environment. For Raspberry Pi GPIO, for example:
uv venv .env
uv pip install --python .env/bin/python Adafruit-Blinka 'gpiod>=2.2.2,<3'
Add the PWM or NeoPixel backend if needed, and run your program with .env/bin/python. Manual recovery commands use the running interpreter’s path so an unrelated active environment is not selected. After installing dependencies while Python is running, restart it before trying again. See uv’s Python environment documentation. For pip-backed interactive installation, create the environment with uv venv --seed .env instead.
Services and managed environments
Install the backends your program needs before starting a service, cron job, or other non-interactive program. For Raspberry Pi digital GPIO, for example:
.env/bin/python -m pip install Adafruit-Blinka 'gpiod>=2.2.2,<3'
If the program also uses PWM, install its backend during setup:
.env/bin/python -m pip install 'Adafruit-Blinka-Raspberry-Pi-PWM>=1.0.2'
Run the service with that same environment’s Python. A virtual environment using --system-site-packages can see OS packages, but those packages must still meet the required versions. Blinka does not bypass externally managed system Python protections.
For Raspberry Pi GPIO, Blinka also accepts Debian-style python3-libgpiod bindings labelled 2.2.0 when they come from maintained libgpiod source >=2.2.1,<3 and report a native API version in that range. Trixie’s package uses this older Python label despite containing later fixes. In a virtual environment created with --system-site-packages, Blinka checks that the selected binding and metadata paths belong to the installed system package. Security-update revisions are not pinned, and importing gpiod before board works normally. Package-manager queries are cached per process.
This trusts the system administrator and package database; it is not a file integrity monitor. Restart Python after package upgrades rather than reloading native modules. Ordinary PyPI installs retain the conservative gpiod>=2.2.2,<3 baseline: old PyPI 2.2.0 has a native use-after-free during line requests, which a check for available API functions cannot detect. See the upstream fix.
For an application that manages its own dependencies, set BLINKA_SKIP_DEPENDENCY_CHECK=1 before importing board to disable its automatic dependency checks and installation prompts:
BLINKA_SKIP_DEPENDENCY_CHECK=1 .env/bin/python program.py
This does not install packages or make unsupported backends supported. Missing backend imports and PWM/NeoPixel feature checks still report errors.
Installing on MicroPython
The root package.json installs Blinka’s existing MicroPython subset directly from GitHub with mip. From a computer with the board connected, run:
mpremote mip install github:adafruit/Adafruit_Blinka
On firmware that includes mip and has a working network connection, you can instead install from the MicroPython REPL:
import mip
mip.install("github:adafruit/Adafruit_Blinka")
Restart the board after installing. To select a release or branch, append @TAG_OR_BRANCH to the mpremote URL, or pass version="TAG_OR_BRANCH" to mip.install. Choose a ref containing package.json; older releases do not have this manifest. Installation needs network access to GitHub on the computer (mpremote) or board (mip). This is not a PyPI install or a short-name package in the default MicroPython package index.
The manifest includes board, microcontroller, digitalio, busio, bitbangio, and rainbowio, plus the existing Pico-family, Pyboard, and ESP8266 board routes. It installs only the required PlatformDetect source files, pinned to release 3.89.1, and their licenses. Linux drivers, native binaries, pip dependencies, and the CPython micropython shim are not installed. The installed file contents total about 190 KiB, plus filesystem overhead. When updating PlatformDetect, update all its manifest URLs together to the new release’s commit; absolute pinned URLs keep Blinka branch/tag installs from accidentally selecting the same ref in another repository.
This packages existing backends, not new hardware or API support. Not every CircuitPython module is implemented on MicroPython, and existing backend/firmware limitations still apply. In particular, the legacy ESP8266 backend’s TOUT pin initialization is incompatible with current MicroPython firmware. Source compilation also requires RAM in addition to filesystem space; small boards such as ESP8266 may not have enough. Install CircuitPython libraries needed by your application separately, and verify compatibility on your board. Do not install Blinka on CircuitPython itself.
Raspberry Pi GPIO and PWM
Raspberry Pi digital GPIO uses the official gpiod bindings. pwmio.PWMOut uses Adafruit Blinka Raspberry Pi PWM on Pi 5 and earlier models. Configured BCM/RP1 hardware PWM is preferred on verified pin routes; other pins use native software PWM. This does not use PIO or change boot overlays. Runtime checks select gpiod>=2.2.2,<3 and Adafruit-Blinka-Raspberry-Pi-PWM>=1.0.2 only for Raspberry Pi boards, rather than installing them on every Linux ARM host. These Pi backends require Linux 5.10 or newer. NeoPixel support retains its separate dependencies.
Software PWM accepts 1–10000 Hz, with Linux scheduling affecting timing and jitter. Configured hardware limits depend on its controller and driver, and updates are not guaranteed glitch-free. Hardware channels require separate kernel/overlay configuration and sysfs permissions. See the package’s usage guide for setup and cleanup limitations; verify the waveform before connecting an actuator. NeoPixel support continues to use its existing separate backends.
Usage Example
The pin names may vary by board, so you may need to change the pin names in the code. This example runs on the Raspberry Pi boards to blink an LED connected to GPIO 18 (Pin 12):
import time
import board
import digitalio
PIN = board.D18
print("hello blinky!")
led = digitalio.DigitalInOut(PIN)
led.direction = digitalio.Direction.OUTPUT
while True:
led.value = True
time.sleep(0.5)
led.value = False
time.sleep(0.5)
Contributing
Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.
Building locally
Sphinx documentation
Sphinx is used to build the documentation based on rST files and comments in the code. First, install dependencies (feel free to reuse the virtual environment from above):
python3 -m venv .env
source .env/bin/activate
pip install Sphinx sphinx-rtd-theme Adafruit-PlatformDetect
Now, once you have the virtual environment activated:
cd docs
sphinx-build -E -W -b html . _build/html
This will output the documentation to docs/_build/html. Open the index.html in your browser to view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to locally verify it will pass.
Metadata
Release files for Adafruit-Blinka 10.1.0
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 | |
|---|---|---|---|---|
| adafruit_blinka-10.1.0.tar.gz | 1.1 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| adafruit_blinka-10.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.1 MB
Release files / adafruit_blinka-10.1.0.tar.gz
| Download URL | adafruit_blinka-10.1.0.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c0c26b27366e58d8c0695bec82e74d1ab2698146d6431bb22677384fe9ea2b3e
|
|
BLAKE2b-256 checksum How to use checksums |
9ec51b6b7a6a99e03eded97990db04f1e2b35f583124e50354c759abf579d3ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.1
|
Release files / adafruit_blinka-10.1.0-py3-none-any.whl
| Download URL | adafruit_blinka-10.1.0-py3-none-any.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6ff171b8b769a96a729385e7badf3dae1e6026b7a86fc0d9af38867ceb204c30
|
|
BLAKE2b-256 checksum How to use checksums |
3f614ef7c4492131bcd0cc394cd9b45917b923d0763a2a64406dda412097e367
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.1
|
Security for Adafruit-Blinka 10.1.0
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.