Mock Library for RPi.GPIO
Project description
Mock.GPIO
Mock Library for RPi.GPIO.
Mock.GPIO helps you develop and debug GPIO-dependent code outside a Raspberry Pi (e.g. on macOS/Linux) while keeping the same API as RPi.GPIO. It prints intended actions when running off-device and works as a drop-in replacement on-device without code changes.
Installation
pip3 install Mock.GPIO
Quick start
try:
import RPi.GPIO as GPIO
except Exception:
import Mock.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(15, GPIO.OUT)
GPIO.output(15, GPIO.HIGH)
Supported API surface
- GPIO.setmode(), GPIO.getmode(), GPIO.setwarnings(), GPIO.setup(), GPIO.output(), GPIO.input()
- GPIO.wait_for_edge(), GPIO.add_event_detect(), GPIO.event_detected(), GPIO.add_event_callback(), GPIO.remove_event_detect()
- GPIO.gpio_function(), GPIO.start(), GPIO.ChangeFrequency(), GPIO.ChangeDutyCycle(), GPIO.stop(), GPIO.cleanup()
Supported versions
- Python: 3.8–3.12
Documentation
Development
This repo includes a standard Makefile.
# one-time setup
make requirements
# run tests
make test
# install locally (editable)
make dev-install
# build & publish
make build
make publish-test
make publish
Alternatively, you can use the scripts under scripts/ directly.
Contributing
Contributions are welcome! Please open an issue or submit a PR.
License
Licensed under GPL-3.0. See LICENSE.
Project details
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 mock_gpio-0.2.0.tar.gz.
File metadata
- Download URL: mock_gpio-0.2.0.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ebca40037dd27b6ecd2d78b1613b99e0ae4df2c89a22daa06b74bc6fb17f2a8
|
|
| MD5 |
e511a404d1dbd0768bbaa3297cb3c0a5
|
|
| BLAKE2b-256 |
5a3fca3b2b485bb1aea707dabbccff4e19bfe4b25855ba41162140680e106ec2
|
File details
Details for the file mock_gpio-0.2.0-py3-none-any.whl.
File metadata
- Download URL: mock_gpio-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad1c5ab08e7ff95e8ed33e9677661473358c764c1b9be6b74babaa255ca0c2c2
|
|
| MD5 |
cf9cd7f24d4c235cec9c34e1ef782daa
|
|
| BLAKE2b-256 |
74e1566155e584cd2fef46f5610c33d85f9d111d4aec863859fec13e239ebb99
|