Repository navigation
Releases: vihaanvp/MegaWrapper
Releases · vihaanvp/MegaWrapper
Release list
v0.2.2
Ponytail audit — deleted 4 files, ~103 lines removed. Module-level global replaced with constructor kwarg.
Removed
set_mode()/get_mode()— global module-level mode switch deleted. Replaced byBoard(backend="pyfirmata2"|"pyserial")constructor kwarg. Default remainspyfirmata2.megawrapper/version.py— version now sourced fromimportlib.metadata.version("megawrapper").megawrapper/utils.py—delay()andmillis()moved inline into__init__.py.examples/tank_drive.py— removed (9 → 8 examples).tests/test_exceptions.py— duplicated coverage.
Changed
Board.__init__(port, stby, backend="pyfirmata2")— backend kwarg replacesset_mode().Board.__repr__simplified withgetattrinstead of mode branching.motor.py—forward()/backward()callself.set_speed(speed).servo.py—_validate_and_clamp_angleremoved; angle clamping inlined.sensor.py— I2C init deduplicated into_default_i2c()helper.__init__.py—delay()/millis()inline via stdlibtime; version viaimportlib.metadata.- All docs (README, CHANGELOG, wiki, AGENTS) updated for new API.
Notes
- 91 tests total (90 passing, 1 pre-existing env-related skip).
- Net: ~103 source lines removed, 4 files deleted.
v0.2.1
Bug fix release — auto_address pin conversion, multi-sensor example.
Fixed
- auto_address() now converts integer GPIO pins to board pin objects
before passing to DigitalInOut (Blinka compatibility) - Test updated to verify pin-object conversion
Added
- examples/vl53l0x_multi_sensor.py — multiple VL53L0X sensors via auto_address
- VL53L0X API section in README
v0.2.0
v0.2.0 (2026-07-04)
Major refactor and stabilization release — type hints, dual Firmata backend, optional deps, sensor support.
Added
- Full type hints on all public APIs:
Board,Motor,Servo,VL53L0X,delay,millis, exceptions. Board.__repr__— shows serial port + motor count (pyserial mode only; graceful fallback for pyfirmata2).Board.has_active_board()— static check without raising.Servo.__repr__— three states:"Servo(not attached)","Servo(pin=X, angle=unknown)","Servo(pin=X, angle=Y)".- Dual Firmata backend —
set_mode("pyserial")/set_mode("pyfirmata2")global switch (must be called beforeBoard()). Built-in pyserial client removes hard dependency onpyfirmata2. - VL53L0X time-of-flight sensor —
VL53L0Xclass inmegawrapper.sensor, I2C-based, independent of Firmata/Board. - Optional dependency groups in
pyproject.toml:pip install -e '.[pyserial]'— built-in Firmata backendpip install -e '.[sensor]'— VL53L0X sensor
- New examples:
examples/pyserial_control.py— demonstrates pyserial backendexamples/vl53l0x_sensor.py— ToF distance readout
- PyPI publish workflow —
.github/workflows/publish.ymltriggers on GitHub release. - Tests expanded to 92 — new
test_sensor.py, pyserial-mode tests intest_board.py.
Changed
pyproject.toml:pyserialandadafruit-circuitpython-vl53l0xmoved from hard deps → optional extras. Onlypyfirmata2remains required.README.mdrewritten — wiki-centric, examples table with descriptions, concise API overview.AGENTS.mdrewritten — accurate test count, dependency structure, architecture traps, testing quirks..gitignore: 94 lines → 13 (only patterns matching this project).- Internal cleanup: inlined single-use imports, removed dead analog-write branch (pins >= 16 unused).
Removed
examples/servo_test.py(90% overlap withendless_sweep.py)examples/endless_servo_sweep.py(redundant withServo.sweep())requirements.txt(duplicatespyproject.toml)tests/__init__.py(empty file)
Notes
- Requires Python 3.8+, Arduino running StandardFirmata.
- Hard dependency:
pyfirmata2only. Optional:pyserial(backend),adafruit-circuitpython-vl53l0x(sensor). - Not yet on PyPI — install from source:
pip install -e .(add.[pyserial]/.[sensor]for extras).
v0.1.0
Changelog
v0.1.0 (2026-06-25)
Initial release of MegaWrapper — a unified Python library for Arduino-style DC motor and servo control over Firmata.
Added
-
Board— manages a serial connection to an Arduino running StandardFirmata.- Constructor accepts
portand optionalstby(standby pin for TB6612FNG). get_active_board()static method for servo singleton access.attach_motor()to create and register motor instances.stop_all()to halt all motors on the board.wake()/sleep()for standby pin control.close()for clean teardown.- Context manager support (
with Board(...) as board). board.motorslist updated automatically.
- Constructor accepts
-
Motor— DC motor control via H-bridge (2 direction pins + 1 PWM pin).forward(speed)/backward(speed)with percentage-based speed (0–100).stop()(coast) andbrake()(abrupt halt).set_speed()to change speed without affecting direction.speed,direction,nameproperties.- Informative
__repr__().
-
Servo— standard servo control on PWM-capable pins.attach(pin)/detach()for lifecycle management.write(angle)with automatic clamping to 0–180.read()returning the last commanded angle.move_smooth(target, delay_ms)for stepped rotation.sweep(start, end, step, delay_ms)for continuous sweeping.pinandcurrent_angleproperties.
-
Utilities —
delay(ms)andmillis()Arduino-style helpers. -
Exceptions — clean error hierarchy:
MegaWrapperError(base)InvalidSpeedError(speed outside 0–100)BoardConnectionError(Arduino unreachable)StandbyNotConfiguredError(STBY pin not set)
-
Package infrastructure:
pyproject.tomlwith setuptools build configuration.- All dependencies (
pyfirmata2,pyserial) declared and auto-installed. - MIT license.
- Editable install via
pip install -e .
-
Documentation:
README.mdwith quick-start examples and links to the wiki.- GitHub Wiki with 8 dedicated pages: Home, Board API, Motor API, Servo API, Utilities, Exceptions, Examples, Edge Cases & Notes.
AGENTS.mdfor LLM session guidance.CHANGELOG.md(this file).
-
Testing:
- 72 unit tests across 6 files.
- All tests mock
pyfirmata2.Arduino— no hardware required. conftest.pyresets_active_boardand provides fresh pin mocks per test.
Notes
- Not published on PyPI — install from source.
- Requires Python 3.8+, Arduino running StandardFirmata.
- This release merges and supersedes
motor-like-arduino(v0.1.0) andservo-like-arduino(v0.2.0).