Skip to main content

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.

Metadata

Release files for Mock.GPIO 0.2.0

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

Source distribution (sdist)

Source distribution for Mock.GPIO 0.2.0
File Size Uploaded Provenance Actions
mock_gpio-0.2.0.tar.gz 15.8 kB Without provenance Details for mock_gpio-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for Mock.GPIO 0.2.0
File Interpreter ABI Platform Actions
mock_gpio-0.2.0-py3-none-any.whl Python 3 none any Details for mock_gpio-0.2.0-py3-none-any.whl

Total release size: 27.3 kB

Release files / mock_gpio-0.2.0.tar.gz

Download URL mock_gpio-0.2.0.tar.gz
Size 15.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1ebca40037dd27b6ecd2d78b1613b99e0ae4df2c89a22daa06b74bc6fb17f2a8
BLAKE2b-256 checksum
How to use checksums
5a3fca3b2b485bb1aea707dabbccff4e19bfe4b25855ba41162140680e106ec2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release files / mock_gpio-0.2.0-py3-none-any.whl

Download URL mock_gpio-0.2.0-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad1c5ab08e7ff95e8ed33e9677661473358c764c1b9be6b74babaa255ca0c2c2
BLAKE2b-256 checksum
How to use checksums
74e1566155e584cd2fef46f5610c33d85f9d111d4aec863859fec13e239ebb99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Security for Mock.GPIO 0.2.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.

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