gpiod
Python bindings for libgpiod
What it is and what it does
gpiod is the official Python interface to libgpiod, the modern Linux kernel GPIO character device API. It replaces the deprecated sysfs interface with a more capable, resource-safe approach that guarantees cleanup on device close. The package vendors libgpiod for convenience, so you don't need a matching system library unless you explicitly opt in via LINK_SYSTEM_LIBGPIOD=1.
You use it to request GPIO lines from character devices like /dev/gpiochip0, configure them as inputs or outputs, read or write values, and poll for events. It supports advanced features like open-source and open-drain modes, bulk value operations, and event monitoring. The bindings are not thread-safe and require external synchronization if shared across threads, though both GIL-enabled and free-threaded CPython are supported.
Use it for:
- Control LEDs, buttons, and sensors on Raspberry Pi or other Linux single-board computers.
- Implement GPIO-based hardware monitoring or automation in embedded systems.
- Poll GPIO lines for state changes and react to hardware events in real time.
- Configure open-drain or open-source GPIO modes for multi-device bus protocols.
- Build device drivers or system utilities that interact with GPIO character devices.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Python bindings for libgpiod, the official Linux GPIO character device interface library, enabling control of GPIO lines with support for event polling, multi-value operations, and open-source/open-drain modes.
Yes, if you need to control GPIO on Linux. It is the official, actively maintained binding to the modern kernel interface, supports current Python versions (3.10–3.14), has no known vulnerabilities, and provides binary wheels for common platforms. The copyleft license is standard for GPIO libraries and acceptable in most open-source contexts. Install friction is moderate but manageable with python3-dev.
Install
gpiod on PyPI
pip
pip install gpioduv
uv add gpiodpoetry
poetry add gpiodInstalling gpiod
Before you install
Medium install friction due to binary wheel availability for common platforms (Python 3.10–3.14 on x86_64 and aarch64 Linux) but source builds require python3-dev. Active maintenance with recent release (58 days ago) and ongoing repository activity.
License in practice
LGPL-2.1-or-later copyleft license requires derivative works and linked applications to disclose source code under compatible terms; acceptable for open-source projects but may constrain proprietary deployments.
Quickstart
pip install gpiod
import gpiod
from gpiod.line import Direction, Value
with gpiod.request_lines(
"/dev/gpiochip0",
consumer="example",
config={0: gpiod.LineSettings(direction=Direction.OUTPUT)}
) as request:
request.set_value(0, Value.ACTIVE)
Requires python3-dev; source builds need libgpiod headers. Binary wheels available for Python 3.10–3.14 on Linux x86_64 and aarch64. Root access needed to interact with /dev/gpiochip* devices.
Verify before relying
- Whether free-threaded CPython support (mentioned in description) is production-ready or experimental.
- Performance characteristics and latency guarantees for GPIO event polling under load.
- Compatibility with non-Linux POSIX systems or Windows via WSL.
- Whether vendored libgpiod can be overridden with system package via LINK_SYSTEM_LIBGPIOD=1.
Package facts
| License | LGPL-2.1-or-later (copyleft) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 58 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 643,433/month — #5,607 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: gpiod-2.5.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; gpiod-2.5.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; gpiod-2.5.0-cp310-cp310-musllinux_1_2_aarch64.whl; gpiod-2.5.0-cp310-cp310-musllinux_1_2_x86_64.whl; gpiod-2.5.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; gpiod-2.5.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; gpiod-2.5.0-cp311-cp311-musllinux_1_2_aarch64.whl; gpiod-2.5.0-cp311-cp311-musllinux_1_2_x86_64.whl; gpiod-2.5.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; gpiod-2.5.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; gpiod-2.5.0-cp312-cp312-musllinux_1_2_aarch64.whl; gpiod-2.5.0-cp312-cp312-musllinux_1_2_x86_64.whl; gpiod-2.5.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; gpiod-2.5.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; gpiod-2.5.0-cp313-cp313-musllinux_1_2_aarch64.whl; gpiod-2.5.0-cp313-cp313-musllinux_1_2_x86_64.whl; gpiod-2.5.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; gpiod-2.5.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl; gpiod-2.5.0-cp314-cp314-musllinux_1_2_aarch64.whl; gpiod-2.5.0-cp314-cp314-musllinux_1_2_x86_64.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
RPi.GPIORPi.GPIO provides Python control over Raspberry…
permissive · top 15,000 on PyPI
gpiozerogpiozero provides a high-level Python interface…
permissive · top 15,000 on PyPI
ft4222Provides Python bindings to LibFT4222, enabling…
permissive · top 15,000 on PyPI
pigpioProvides Python access to the pigpio daemon for…
permissive · top 15,000 on PyPI
pylibfdtProvides Python bindings to libfdt, the device…
unclear · top 15,000 on PyPI
pyftdiPyFtdi provides a pure-Python user-space driver…
permissive · top 15,000 on PyPI
debug-mgrProvides a debug manager interface for C++…
permissive · top 15,000 on PyPI
libusbsioProvides a Python wrapper around NXP's…
permissive · top 15,000 on PyPI
numato-gpioProvides a Python API to control Numato USB…
permissive · top 15,000 on PyPI
zigpy-zigateProvides a Python 3 driver for ZiGate Zigbee…
copyleft · top 15,000 on PyPI