Update Blinka to pyproject.toml - #1114
Conversation
- Add src/adafruit_blinka/microcontroller/ti/am625x/pin.py with libgpiod Pin definitions for all three I2C buses (MIKROBUS i2c-3, Grove i2c-1, QWIIC i2c-5), USR LEDs, user button, and MIKROBUS GPIOs - Add src/adafruit_blinka/board/beagleboard/beagle_play.py exposing SCL/SDA (MIKROBUS), QWIIC_SCL/SDA, GROVE_SCL/SDA, LED_USRn, USR_BUTTON, and MIKROBUS_GPIO1_N pins - Register BEAGLE_PLAY in board_imports.json and AM625X in microcontroller_imports.json - Bump Adafruit-PlatformDetect minimum from >=3.70.1 to >=3.89.0 (3.89.1 fixes BeaglePlay nvmem path; 3.88.0 broke XU4 detection) Tested on BeaglePlay (aarch64, Debian Trixie, Python 3.13.5): - board.id = BEAGLE_PLAY confirmed - busio.I2C works on all three buses (MIKROBUS, QWIIC, Grove)
Install Test MatrixTested
NotesRaspberry Pi 5 / Pi 4 and earlier Ubuntu x86_64 Odroid XU4 (armv7l, Armbian) Note: BeagleBone AI (armv7l, Bookworm)
BeaglePlay (aarch64, Trixie) JetsonNo supported Jetson hardware available for testing. |
Test Matrix ResultsTested install of this branch across 6 boards. All pass.
Install notes by boardAll boards: XU4 / Armbian: Needs BBB AI / Bookworm: BeaglePlay / Trixie: Needs Raspberry Pi (4B / 5): Needs Bug fixed in this branchRemoved the |
There was a problem hiding this comment.
Pull request overview
This PR begins the migration of Adafruit_Blinka’s packaging toward a pyproject.toml-based build, adds clearer runtime errors for missing optional/platform-specific dependencies, and refreshes installation requirements.
Changes:
- Added
pyproject.tomlbuild-system configuration (setuptools + setuptools-scm). - Centralized “missing platform dependency” error handling via
raise_for_missing_platform_dependency()and applied it to several platform-import entrypoints. - Reworked
requirements.txtto list runtime dependencies explicitly and adjusted packaging metadata (includingpython_requires).
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/pwmio.py |
Wraps board-specific PWMOut imports to provide a clearer error when optional deps are missing. |
src/neopixel_write.py |
Same as above for NeoPixel backend selection/imports. |
src/board.py |
Switches platformdetect version reporting to importlib.metadata.version(). |
src/adafruit_blinka/microcontroller/am335x/pin.py |
Uses shared missing-dependency helper for Adafruit_BBIO. |
src/adafruit_blinka/importing.py |
Introduces the shared missing-dependency helper and integrates it into import_mod(). |
setup.py |
Adjusts packaging metadata (notably python_requires) for the packaging transition. |
requirements.txt |
Replaces the placeholder with explicit dependencies + platform markers. |
pyproject.toml |
Adds PEP 517/518 build configuration and setuptools-scm settings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
I tried installing from this branch on a Raspberry Pi 5, fresh flash of Ras Pi OS with python 3.13.5 I am getting this error: |
|
Thanks @FoamyGuy. It looks like it might be collecting lgpio from the wrong place. |
On Python 3.13+, lgpio has no pre-built wheel on PyPI or piwheels for aarch64. When setup.py resolved lgpio as a plain >=0.2.2.0 dependency, pip fell back to building from source and failed with: error: command 'swig' failed: No such file or directory Fix: detect Python version at install time and use the pre-built URL wheel for 3.13/3.14/3.15 on aarch64 (same wheels already referenced in requirements.txt). Non-aarch64 and Python <3.13 keep the plain lgpio>=0.2.2.0 spec since piwheels has those covered. Reported by @FoamyGuy in PR review.
|
@FoamyGuy if you want to take another look, the newer lgpio support is now done in a cleaner way. |
| "lgpio": ( | ||
| "pip install lgpio --find-links " | ||
| "https://github.com/adafruit/lgpio-python-wheels/raw/main/wheels/" | ||
| ), |
| "Programming Language :: Python :: 3.8", | ||
| "Programming Language :: Python :: 3.9", |
This updates Blinka to use pyproject.toml. However, because Blinka required checking things through setup.py using mechanisms that were no longer through pyproject.toml, this conversion had not happened. The new approach is to check for dependencies at runtime and guide the user on installing those dependencies as normal. This way blinka can still be added as a dependency in the CircuitPython libraries on the many platforms it runs on and still work.
This goes a long way towards helping with #1113.