Skip to content
Projets

codenio/Mock.GPIO has 35 GitHub stars and 16 forks. GitHot measured 0 stars in 24 hours and 0 in 7 days. Last checked 2026-11-20 19:56 UTC. Last push 2026-01-08.

Comment ces chiffres sont mesurés

Progression mesurée des étoiles

in 24h
0
in 7 days
0
in 15 days
Historique en cours
in 1 month
Historique en cours

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

À propos

Mock Library for RPI.GPIO python Library

Apprentissage

README.md

Original

Mock.GPIO

CI

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.PWM.start(), GPIO.PWM.ChangeFrequency()
  • GPIO.PWM.ChangeDutyCycle(), GPIO.PWM.stop(), GPIO.PWM.cleanup()

Supported versions

  • Python: 3.10–3.14 and PyPy 3.11

Documentation

Development

Minimal Makefile targets:

make help          # list targets
make install       # local install via scripts/install.sh
make test          # run pytest
make clean         # remove build artifacts
make build         # build sdist and wheel
make publish-test  # upload to Test PyPI
make publish       # upload to PyPI

Test across Python versions (tox + pyenv)

# install interpreters
pyenv install 3.10.14 3.11.9 3.12.6 3.13.0 pypy3.11-7.3.17
eval "$(pyenv init -)"
pyenv local 3.10.14 3.11.9 3.12.6 3.13.0 pypy3.11-7.3.17

# run tox matrix
make tox

Note: Runtime dependencies are intentionally empty to avoid issues on PyPy (e.g., nh3/PyO3). Dev and packaging tools are installed separately.

Contributing

Contributions are welcome! Please open an issue or submit a PR.

Thanks to contributors

Thanks to all the amazing contributors who make this project better. See the full list on the Contributors page.

License

Licensed under GPL-3.0. See LICENSE.