Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make GPIO/SPI/FTDI optional and switch to rpi-lgpio #284

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
18 changes: 14 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,37 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-minor-version: [8, 9, 10, 11, 12, 13-dev]
python-minor-version: [8, 9, 10, 11, 12, 13]
name: Python 3.${{ matrix.python-minor-version }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup pip cache
uses: actions/cache@v3
uses: actions/cache@v4
id: pipcache
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-v2-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-v2-
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
id: setuppy
with:
python-version: 3.${{ matrix.python-minor-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install Python packages
run: pip install --upgrade setuptools pip wheel tox coveralls
- name: Install system dependencies
run: sudo apt-get install swig python3-setuptools python3-dev
- name: Install lg library
run: |
cd $RUNNER_TEMP
wget http://abyz.me.uk/lg/lg.zip
unzip lg.zip
cd lg
make
sudo make install
- name: Run tests
env:
TOX_ENV: py3${{ matrix.python-minor-version }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
name: Build and publish Python package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.10
- name: Install pypa/build
run: |
python -m pip install --upgrade setuptools pip wheel twine
Expand Down
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ ChangeLog
| Version | Description | Date |
+============+=====================================================================+============+
| **2.5.0** | * Drop support for Python 3.7 | TBD |
| | * GPIO/SPI/FTDI dependencies are optional now and no longer | |
| | installed by default (use pip install luma.core[gpio] instead) | |
| | * Switch from RPI.GPIO to rpi-lgpio for RPI5 support | |
+------------+---------------------------------------------------------------------+------------+
| **2.4.2** | * Add support for spi-mode in cmdline | 2024/01/30 |
+------------+---------------------------------------------------------------------+------------+
Expand Down
9 changes: 6 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ python_requires = >=3.8, <4
install_requires =
pillow>=9.2.0
smbus2
pyftdi
cbor2
RPI.GPIO; platform_system=="Linux"
spidev; platform_system=="Linux"
tests_require =
pytest
pytest-cov
Expand All @@ -45,6 +42,12 @@ tests_require =
include = luma*

[options.extras_require]
gpio =
rpi-lgpio; platform_system=="Linux"
spi =
spidev; platform_system=="Linux"
ftdi =
pyftdi
docs =
sphinx>=1.5.1
sphinx-rtd-theme
Expand Down
8 changes: 4 additions & 4 deletions tests/test_cmdline.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2017-2021 Richard Hull and contributors
# Copyright (c) 2017-2024 Richard Hull and contributors
# See LICENSE.rst for details.

"""
Expand Down Expand Up @@ -191,7 +191,7 @@ def test_make_interface_spi():
except ImportError:
# non-rpi platform, e.g. macos
pytest.skip(rpi_gpio_missing)
except error.UnsupportedPlatform as e:
except (error.UnsupportedPlatform, error.DeviceNotFoundError) as e:
# non-rpi platform, e.g. ubuntu 64-bit
skip_unsupported_platform(e)

Expand All @@ -211,7 +211,7 @@ class opts(test_spi_opts):
except ImportError:
# non-rpi platform, e.g. macos
pytest.skip(rpi_gpio_missing)
except error.UnsupportedPlatform as e:
except (error.UnsupportedPlatform, error.DeviceNotFoundError) as e:
# non-rpi platform, e.g. ubuntu 64-bit
skip_unsupported_platform(e)

Expand Down Expand Up @@ -341,7 +341,7 @@ class args(test_spi_opts):
assert device == display_name
except ImportError:
pytest.skip(rpi_gpio_missing)
except error.UnsupportedPlatform as e:
except (error.UnsupportedPlatform, error.DeviceNotFoundError) as e:
# non-rpi platform
skip_unsupported_platform(e)

Expand Down
8 changes: 6 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See LICENSE.rst for details.

[tox]
envlist = py{38,39,310,311,312,313},qa,doc
envlist = py{38,39,310,311,312,313,314},qa,doc
skip_missing_interpreters = True

[testenv]
Expand All @@ -16,7 +16,11 @@ commands =
coverage erase
py.test --cov=luma {posargs}
coverage html
deps = .[test]
deps =
.[gpio]
.[spi]
.[ftdi]
.[test]

[testenv:watch] # use ptw (=pytestwatch) to run tests when files change
commands =
Expand Down