gpiozero
A simple interface to GPIO devices with Raspberry Pi
What it is and what it does
gpiozero is a Python library that simplifies GPIO programming on Raspberry Pi and compatible single-board computers. It provides object-oriented interfaces to common components—LEDs, buttons, sensors, motors—so you can control hardware with just a few lines of code rather than managing raw GPIO pins. The library supports both imperative (direct method calls) and declarative (event-driven) programming styles, and includes a mock pin interface for testing without hardware.
The package abstracts away the complexity of underlying pin libraries, letting you switch between different GPIO backends (RPi.GPIO, pigpio, etc.) without changing your application code. It's designed for physical computing education and hobbyist projects, but scales to more complex setups through its source/values system for composing sensor inputs and device behaviors.
Use it for:
- Control an LED or relay directly: turn it on/off or blink it with minimal code.
- Build event-driven circuits: trigger actions when a button is pressed or a sensor detects motion.
- Combine multiple sensors to control an output: e.g., turn on a garden light only when motion is detected AND it's dark.
- Prototype robotics or automation projects without writing low-level GPIO boilerplate.
- Test GPIO logic on a PC using mock pins before deploying to a Raspberry Pi.
- Teach physical computing concepts with readable, beginner-friendly Python syntax.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
gpiozero provides a high-level Python interface for controlling GPIO devices on Raspberry Pi and compatible boards, abstracting away low-level pin manipulation with simple, declarative component classes.
Yes. gpiozero is the standard choice for Raspberry Pi GPIO programming in Python—actively maintained, permissively licensed, low friction to install, and well-documented. It's suitable for beginners learning physical computing and for production hobby/educational projects. Install it if you're working with Raspberry Pi GPIO devices and want to avoid raw pin manipulation.
Install
gpiozero on PyPI
pip
pip install gpiozerouv
uv add gpiozeropoetry
poetry add gpiozeroInstalling gpiozero
Before you install
Low install friction with only three lightweight runtime dependencies (colorzero, importlib-metadata, importlib-resources). Actively maintained with a recent release 18 days ago and consistent commit activity; supports current Python versions (3.9–3.12 and PyPy).
License in practice
BSD-3-Clause (permissive) allows free use, modification, and distribution with minimal restrictions, making it suitable for both personal and commercial projects.
Quickstart
pip install gpiozero
from gpiozero import LED
from time import sleep
led = LED(17)
led.on()
sleep(1)
led.off()
Requires a Raspberry Pi or compatible board with GPIO pins, or mock pins for testing on other systems.
Verify before relying
- Whether the package works reliably on all advertised Python implementations (PyPy support level).
- Performance characteristics when controlling many devices simultaneously.
- Compatibility with non-Raspberry Pi GPIO boards beyond what the documentation states.
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — colorzero, importlib-metadata, importlib-resources |
| Maintenance | actively maintained — 18 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 435,360/month — #6,682 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: gpiozero-2.0.1.post3-py3-none-any.whl
Keywords: raspberrypi, gpio
Tags
More Education packages
Sphinx generates professional documentation…
permissive · top 1,000 on PyPI
netaddrRepresents and manipulates IPv4, IPv6, MAC…
permissive · top 5,000 on PyPI
cuda-pythoncuda-python is a metapackage providing Pythonic…
unclear · top 5,000 on PyPI
cuda-coreProvides Pythonic APIs to access CUDA core…
permissive · top 5,000 on PyPI
googletransGoogletrans translates text and detects…
permissive · top 5,000 on PyPI
open3dOpen3D provides data structures and algorithms…
permissive · top 5,000 on PyPI
pigpioProvides Python access to the pigpio daemon for…
permissive · top 15,000 on PyPI
RPi.GPIORPi.GPIO provides Python control over Raspberry…
permissive · top 15,000 on PyPI
gpiodPython bindings for libgpiod, the official…
copyleft · top 15,000 on PyPI
Adafruit-BlinkaAdafruit-Blinka emulates CircuitPython APIs on…
permissive · top 15,000 on PyPI
zigpy-zigateProvides a Python 3 driver for ZiGate Zigbee…
copyleft · top 15,000 on PyPI
adafruit-circuitpython-requestsA requests-like HTTP library for CircuitPython…
permissive · top 15,000 on PyPI
numato-gpioProvides a Python API to control Numato USB…
permissive · top 15,000 on PyPI
Adafruit-PureIOProvides pure Python access to Linux I2C and…
permissive · top 15,000 on PyPI
pyftdiPyFtdi provides a pure-Python user-space driver…
permissive · top 15,000 on PyPI
adafruit-circuitpython-typingProvides type annotation definitions for…
permissive · top 15,000 on PyPI