Skip to content
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
fe37053
Update Blinka to pyproject.toml
makermelissa Jun 23, 2026
754d68b
Add lgpio direct URL wheels for Python 3.13-3.15 on aarch64
makermelissa-ai-assistant Jun 23, 2026
6e8a427
Add BeaglePlay board support and bump PlatformDetect minimum
makermelissa-ai-assistant Jun 24, 2026
cc31a62
Fix black formatting in am625x pin.py
makermelissa-ai-assistant Jun 24, 2026
27174ea
Remove BeaglePlay files from future-proof (moved to PR #1115)
makermelissa-ai-assistant Jun 24, 2026
de76723
Merge origin/main (BeaglePlay #1115) into future-proof
makermelissa-ai-assistant Jun 24, 2026
07e8909
Run pre-commit
makermelissa Jun 24, 2026
96f5503
Fix missing glob import in setup.py
makermelissa-ai-assistant Jun 24, 2026
2fc3517
Merge branch 'future-proof' of https://github.com/makermelissa-piclaw…
makermelissa Jun 24, 2026
2e095fd
Remove Python.h check from setup.py (Python 3.13 exec/locals compat)
makermelissa-ai-assistant Jun 24, 2026
0ecc2d4
Merge branch 'future-proof' of https://github.com/makermelissa-piclaw…
makermelissa Jun 24, 2026
6bbfa30
Potential fix for pull request finding
makermelissa Jun 24, 2026
d00c0e4
Bump actions Python version to 3.9
makermelissa Jun 24, 2026
89b26d3
Update reuse tool to v6.2.0
makermelissa Jun 24, 2026
01b4b3b
Bump GH actions to python 3.10 for REUSE
makermelissa Jun 24, 2026
0b698e7
Put Python 3.10 in quotes so it doesn't think it's 3.1
makermelissa Jun 24, 2026
da8a980
Fix lgpio install on Pi with Python 3.13+ aarch64
makermelissa-ai-assistant Jun 29, 2026
fd8a037
Merge branch 'future-proof' of https://github.com/makermelissa-piclaw…
makermelissa Jun 29, 2026
52dc40e
Replace lgpio URL wheels with adafruit-lgpio for Python 3.13+
makermelissa-ai-assistant Jun 29, 2026
907c4b3
Merge branch 'future-proof' of https://github.com/makermelissa-piclaw…
makermelissa Jun 29, 2026
2865444
Update setup.py lgpio logic to use adafruit-lgpio for Python 3.13+
makermelissa-ai-assistant Jun 29, 2026
a28fe56
Merge branch 'future-proof' of https://github.com/makermelissa-piclaw…
makermelissa Jun 29, 2026
e47101b
Fix marker syntax: use == with or instead of in tuple
makermelissa-ai-assistant Jun 29, 2026
9dd839a
Merge branch 'future-proof' of https://github.com/makermelissa-piclaw…
makermelissa Jun 29, 2026
448c12e
Implementing Copilot's suggestions
makermelissa Jul 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
- name: Translate Repo Name For Build Tools filename_prefix
id: repo-name
run: echo "repo-name=Adafruit-Blinka" >> $GITHUB_OUTPUT
- name: Set up Python 3.8
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: '3.10'
- name: Versions
run: |
python3 --version
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ repos:
hooks:
- id: black
- repo: https://github.com/fsfe/reuse-tool
rev: v1.1.2
rev: v6.2.0
hooks:
- id: reuse
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v6.0.0
hooks:
- id: check-yaml
- id: check-json
Expand Down
15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-FileCopyrightText: 2026 Melissa LeBlanc-Williams for Adafruit Industries
#
# SPDX-License-Identifier: MIT

[build-system]
requires = [
"setuptools",
"wheel",
"setuptools-scm",
]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
git_describe_command = "git describe --tags --long"
local_scheme = "no-local-version"
23 changes: 14 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# requirements.txt
#
# installs dependencies from ./setup.py, and the package itself,
# in editable mode
# -e .

# (the -e above is optional). you could also just install the package
# normally with just the line below (after uncommenting)
.
Adafruit-PlatformDetect>=3.89.0
Adafruit-PureIO>=1.1.7
binho-host-adapter>=0.1.6
pyftdi>=0.40.0
adafruit-circuitpython-typing
sysv_ipc>=1.1.0;sys_platform=='linux' and platform_machine!='mips'
toml>=0.10.2;python_version<'3.11'
Jetson.GPIO;sys_platform=='linux' and platform_machine=='aarch64'
rpi_ws281x>=4.0.0;sys_platform=='linux' and (platform_machine=='armv6l' or platform_machine=='armv7l' or platform_machine=='aarch64')
lgpio>=0.2.2.0; sys_platform=='linux' and python_version<'3.13' and (platform_machine=='aarch64' or platform_machine=='armv7l')
adafruit-lgpio>=0.2.2.0; sys_platform=='linux' and python_version>='3.13' and (platform_machine=='aarch64' or platform_machine=='armv7l')
RPi.GPIO;sys_platform=='linux' and (platform_machine=='armv6l' or platform_machine=='armv7l' or platform_machine=='aarch64')
Adafruit-Blinka-Raspberry-Pi5-Neopixel;sys_platform=='linux' and platform_machine=='aarch64' and python_version>='3.11'
Adafruit_BBIO>=1.2.4;sys_platform=='linux' and platform_machine=='armv7l'
25 changes: 12 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import io
import os
import glob
import sys

from setuptools import setup, find_packages

Expand All @@ -22,12 +22,6 @@
with io.open(os.path.join(here, "README.rst"), encoding="utf-8") as f:
long_description = "\n" + f.read()

if not glob.glob("//usr//include//python3.*//Python.h"):
raise RuntimeError(
"This package requires a Python development environment. "
"Please install the python3-dev package for your distribution."
)

board_reqs = []
if os.path.exists("/proc/device-tree/compatible"):
with open("/proc/device-tree/compatible", "rb") as f:
Expand All @@ -44,16 +38,21 @@
or b"brcm,bcm2711" in compat
or b"brcm,bcm2712" in compat
):
lgpio_req = "lgpio>=0.2.2.0"
_pyver = (sys.version_info.major, sys.version_info.minor)
# adafruit-lgpio provides pre-built wheels for Python 3.13+ (aarch64 + armv7l)
if _pyver >= (3, 13):
lgpio_req = "adafruit-lgpio>=0.2.2.0"
else:
lgpio_req = "lgpio>=0.2.2.0"
try:
import lgpio
except ImportError:
print(
"\n*** lgpio is not installed. On Raspberry Pi OS, install it with:\n"
" sudo apt-get install -y python3-lgpio\n"
" Then recreate your virtual environment with --system-site-packages\n"
" or install the wheel from:\n"
" https://github.com/adafruit/lgpio-python-wheels\n"
" or install adafruit-lgpio from PyPI:\n"
" pip install adafruit-lgpio\n"
)
board_reqs = [
"rpi_ws281x>=4.0.0",
Expand All @@ -72,13 +71,12 @@
"git_describe_command": "git describe --tags --long",
"local_scheme": "no-local-version",
},
setup_requires=["setuptools_scm"],
description="CircuitPython APIs for non-CircuitPython versions of Python such as CPython on Linux and MicroPython.",
long_description=long_description,
long_description_content_type="text/x-rst",
author="Adafruit Industries",
author_email="circuitpython@adafruit.com",
python_requires=">=3.7.0",
python_requires=">=3.9.0",
url="https://github.com/adafruit/Adafruit_Blinka",
Comment thread
makermelissa marked this conversation as resolved.
package_dir={"": "src"},
packages=find_packages("src") + ["micropython-stubs"],
Expand Down Expand Up @@ -131,7 +129,8 @@
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
Comment thread
makermelissa marked this conversation as resolved.
"Programming Language :: Python :: Implementation :: MicroPython",
],
)
64 changes: 50 additions & 14 deletions src/adafruit_blinka/importing.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,39 @@ def import_module(module_name: str, package: str = None):
from adafruit_blinka.agnostic import detector


PLATFORM_DEPENDENCY_INSTALLS = {
"Adafruit_BBIO": "pip install Adafruit_BBIO",
"Jetson": "pip install Jetson.GPIO",
"RPi": "pip install RPi.GPIO",
"_rpi_ws281x": "pip install rpi_ws281x",
"adafruit_raspberry_pi5_neopixel_write": (
"pip install Adafruit-Blinka-Raspberry-Pi5-Neopixel"
),
"lgpio": (
"pip install lgpio --find-links "
"https://github.com/adafruit/lgpio-python-wheels/raw/main/wheels/"
),
}


def raise_for_missing_platform_dependency(error: ModuleNotFoundError):
"""Raise a helpful message for known optional platform dependencies."""
install_command = PLATFORM_DEPENDENCY_INSTALLS.get(error.name)
if install_command is None:
raise error

message = (
f"The platform library '{error.name}' was not found. "
f"To install, try typing: {install_command}"
)
if error.name == "lgpio":
message += (
"\nOn Raspberry Pi OS, you can also try: "
"sudo apt-get install -y python3-lgpio"
)
raise RuntimeError(message) from error


def get_import_file(json_file_name, script_file_location):
"""Get the full path to the microcontroller imports file."""
try:
Expand All @@ -43,20 +76,23 @@ def get_import_file(json_file_name, script_file_location):

def import_mod(caller_globals, module_name: str, package_name: str = "*"):
"""Function to allow importing with * or specific package name."""
if package_name == "*":
module = import_module(module_name)
caller_globals.update(
{name: getattr(module, name) for name in module.__all__}
if hasattr(module, "__all__")
else {
key: value
for (key, value) in module.__dict__.items()
if not key.startswith("_")
}
)
else:
module = import_module(module_name, package=package_name)
caller_globals[package_name] = getattr(module, package_name)
try:
if package_name == "*":
module = import_module(module_name)
caller_globals.update(
{name: getattr(module, name) for name in module.__all__}
if hasattr(module, "__all__")
else {
key: value
for (key, value) in module.__dict__.items()
if not key.startswith("_")
}
)
else:
module = import_module(module_name, package=package_name)
caller_globals[package_name] = getattr(module, package_name)
except ModuleNotFoundError as error:
raise_for_missing_platform_dependency(error)


def import_microcontroller(
Expand Down
9 changes: 4 additions & 5 deletions src/adafruit_blinka/microcontroller/am335x/pin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
#
# SPDX-License-Identifier: MIT
"""AM335x pin names"""
from adafruit_blinka.importing import raise_for_missing_platform_dependency

try:
from Adafruit_BBIO import GPIO
except ImportError as error:
raise RuntimeError(
"The library 'Adafruit_BBIO' was not found. To install, try typing: "
"pip install Adafruit_BBIO"
) from error
except ModuleNotFoundError as error:
raise_for_missing_platform_dependency(error)


class Pin:
Expand Down
12 changes: 5 additions & 7 deletions src/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,14 @@

elif board_id is None:
import platform
import pkg_resources
from importlib.metadata import version

package = str(
pkg_resources.get_distribution("adafruit_platformdetect")
).split()
package_version = version("adafruit_platformdetect")
raise NotImplementedError(
f"""
{package[0]} version {package[1]} was unable to identify the board and/or
microcontroller running the {platform.system()} platform. Please be sure you
have the latest packages by running:
adafruit-platformdetect version {package_version} was unable to identify the board
and/or microcontroller running the {platform.system()} platform.
Please be sure you have the latest packages by running:
'pip3 install --upgrade adafruit-blinka adafruit-platformdetect'

If you are running the latest package, your board may not yet be supported. Please
Expand Down
56 changes: 30 additions & 26 deletions src/neopixel_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,38 @@
import sys

from adafruit_blinka.agnostic import detector
from adafruit_blinka.importing import raise_for_missing_platform_dependency

if detector.board.any_raspberry_pi:
if detector.board.any_raspberry_pi_5_board:
import adafruit_raspberry_pi5_neopixel_write as _neopixel
try:
if detector.board.any_raspberry_pi:
if detector.board.any_raspberry_pi_5_board:
import adafruit_raspberry_pi5_neopixel_write as _neopixel
else:
from adafruit_blinka.microcontroller.bcm283x import neopixel as _neopixel
elif detector.board.pico_u2if:
from adafruit_blinka.microcontroller.rp2040_u2if import neopixel as _neopixel
elif detector.board.OS_AGNOSTIC_BOARD:
from adafruit_blinka.microcontroller.generic_agnostic_board import (
neopixel as _neopixel,
)
elif (
detector.board.feather_u2if
or detector.board.feather_can_u2if
or detector.board.feather_epd_u2if
or detector.board.feather_rfm_u2if
or detector.board.qtpy_u2if
or detector.board.itsybitsy_u2if
or detector.board.macropad_u2if
or detector.board.qt2040_trinkey_u2if
or detector.board.kb2040_u2if
):
from adafruit_blinka.microcontroller.rp2040_u2if import neopixel as _neopixel
elif "sphinx" in sys.modules:
pass
else:
from adafruit_blinka.microcontroller.bcm283x import neopixel as _neopixel
elif detector.board.pico_u2if:
from adafruit_blinka.microcontroller.rp2040_u2if import neopixel as _neopixel
elif detector.board.OS_AGNOSTIC_BOARD:
from adafruit_blinka.microcontroller.generic_agnostic_board import (
neopixel as _neopixel,
)
elif (
detector.board.feather_u2if
or detector.board.feather_can_u2if
or detector.board.feather_epd_u2if
or detector.board.feather_rfm_u2if
or detector.board.qtpy_u2if
or detector.board.itsybitsy_u2if
or detector.board.macropad_u2if
or detector.board.qt2040_trinkey_u2if
or detector.board.kb2040_u2if
):
from adafruit_blinka.microcontroller.rp2040_u2if import neopixel as _neopixel
elif "sphinx" in sys.modules:
pass
else:
raise NotImplementedError("Board not supported")
raise NotImplementedError("Board not supported")
except ModuleNotFoundError as error:
raise_for_missing_platform_dependency(error)


def neopixel_write(gpio, buf):
Expand Down
Loading
Loading