Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .cspell.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ words:
- Pluss
- pypa
- pypi
- pyproject
- pytest
- ranksep
- raspberrypi
Expand Down
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,14 @@ updates:
actions:
patterns:
- "*"
- package-ecosystem: "uv"
# directory of `uv.lock` file
directory: "/"
schedule:
interval: "weekly"
cooldown:
default-days: 5
groups:
uv-pip:
patterns:
- "*"
45 changes: 29 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,27 @@ jobs:
linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false

- uses: actions/setup-python@v6
id: python-setup
with:
python-version: "3.x"

- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
with:
persist-credentials: false
python-version: ${{ steps.python-setup.outputs.python-version }}

- name: Cache pre-commit environments
uses: actions/cache@v4
with:
path: '~/.cache/pre-commit'
key: pre-commit-${{ steps.python-setup.outputs.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Install pre-commit and deps
run: pip install pre-commit -r requirements.txt

- name: Pre-commit hooks
run: pre-commit run --all-files --show-diff-on-failure
- name: Run pre-commit hooks
run: uv run pre-commit run --all-files --show-diff-on-failure

test-coverage:
runs-on: ubuntu-latest
Expand All @@ -41,17 +42,24 @@ jobs:
persist-credentials: false

- uses: actions/setup-python@v6
id: python-setup
with:
python-version: "3.x"

- uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
with:
python-version: ${{ steps.python-setup.outputs.python-version }}

- name: Install testing tools
run: pip install -r requirements.txt -r tests/requirements.txt
run: uv sync --group tests

- name: Collect coverage
env:
UV_NO_SYNC: 1
run: |
coverage run -m pytest
coverage report
coverage xml
uv run coverage run -m pytest
uv run coverage report
uv run coverage xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
Expand All @@ -70,21 +78,26 @@ jobs:
with:
persist-credentials: false

- name: Set up Python 3.x
uses: actions/setup-python@v6
- uses: actions/setup-python@v6
id: python-setup
with:
python-version: "3.x"

- uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
with:
python-version: ${{ steps.python-setup.outputs.python-version }}

- name: Install deps
run: |-
pip install -r docs/requirements.txt
pip install -e .
uv sync --group docs
sudo apt-get update
sudo apt-get install libgl1-mesa-dev libxkbcommon-x11-0 graphviz

- name: Build docs
working-directory: docs
run: sphinx-build -E -W -b html . _build/html
env:
UV_NO_SYNC: 1
run: uv run sphinx-build -E -W -b html . _build/html

- name: Archive docs
uses: actions/upload-artifact@v5
Expand Down
33 changes: 22 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,23 @@ jobs:
fetch-depth: 0

- uses: actions/setup-python@v6
id: python-setup
with:
python-version: "3.x"

- uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
with:
python-version: ${{ steps.python-setup.outputs.python-version }}
enable-cache: false # prevent cache poisoning

- name: Build PyPI distributions
run: pipx run build
run: uvx --from build pyproject-build

- name: Check distributions
# this is done automatically when deploying to PyPI.
# We only do this here for non-release builds.
if: ${{ !startsWith(github.ref, 'refs/tags/v') && github.event_name != 'workflow_dispatch' }}
run: pipx run twine check dist/*
run: uvx twine check dist/*

- name: Archive distributions
uses: actions/upload-artifact@v5
Expand Down Expand Up @@ -58,17 +64,22 @@ jobs:
echo pkg-name=$(echo "${REPO_NAME}" |
awk '{ print tolower($1) }') >> "${GITHUB_OUTPUT}"

- name: Set up Python 3.x
uses: actions/setup-python@v6
with:
python-version: "3.x"

- name: Checkout Current Repo
uses: actions/checkout@v6
with:
persist-credentials: false
fetch-depth: 0

- uses: actions/setup-python@v6
id: python-setup
with:
python-version: "3.x"

- uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
with:
python-version: ${{ steps.python-setup.outputs.python-version }}
enable-cache: false # prevent cache poisoning

- name: Install CircuitPython Linux deps
run: |-
sudo apt-get update
Expand All @@ -80,7 +91,7 @@ jobs:
FILENAME_PREFIX: ${{ steps.repo-name.outputs.repo-name }}
PACKAGE_FOLDER_PREFIX: ${{ steps.pkg-name.outputs.pkg-name }}
run: >-
pipx run --spec circuitpython-build-tools
uvx --from circuitpython-build-tools
circuitpython-build-bundles
--filename_prefix "${FILENAME_PREFIX}"
--package_folder_prefix "${PACKAGE_FOLDER_NAME}"
Expand Down Expand Up @@ -113,7 +124,7 @@ jobs:
gh release upload "${TAG}" ${assets}

upload-pypi:
if: (github.ref == 'refs/heads/master' && github.event_name == 'workflow_dispatch') || startsWith(github.ref, 'refs/tags/v')
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs: [build-pypi-distributions]
permissions:
Expand All @@ -124,8 +135,8 @@ jobs:
with:
name: dist

- name: Publish package (to ${{github.event_name == 'workflow_dispatch' && 'Test' || '' }}PyPI)
- name: Publish package (to ${{ !startsWith(github.ref, 'refs/tags/v') && 'Test' || '' }}PyPI)
if: github.repository == 'nRF24/CircuitPython_nRF24L01'
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
with:
repository-url: https://${{github.event_name == 'workflow_dispatch' && 'test' || 'upload' }}.pypi.org/legacy/
repository-url: https://${{ startsWith(github.ref, 'refs/tags/v') && 'upload' || 'test' }}.pypi.org/legacy/
28 changes: 18 additions & 10 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,29 @@
# Required
version: 2

sphinx:
# Path to your Sphinx configuration file.
configuration: docs/conf.py

build:
os: ubuntu-22.04
tools:
python: "3.11"
python: latest
apt_packages:
- libgl1-mesa-dev
- libxkbcommon-x11-0
- graphviz
jobs:
pre_create_environment:
- >-
UV_INSTALL_DIR="${HOME}/.local/bin" &&
curl -LsSf https://astral.sh/uv/install.sh | sh
- ${HOME}/.local/bin/uv sync --group docs
build:
html:
- >-
${HOME}/.local/bin/uv run
sphinx-build docs docs/_build/html
post_build:
- mkdir -p ${READTHEDOCS_OUTPUT}/html/
- mv docs/_build/html/* ${READTHEDOCS_OUTPUT}/html

python:
install:
- method: pip
path: .
- requirements: docs/requirements.txt
sphinx:
# Path to your Sphinx configuration file.
configuration: docs/conf.py
2 changes: 0 additions & 2 deletions docs/requirements.txt

This file was deleted.

26 changes: 22 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ classifiers = [
"Topic :: System :: Hardware",
"Programming Language :: Python :: 3",
]
dynamic = ["version", "dependencies"]
dynamic = ["version"]
dependencies = [
"adafruit-blinka>=8.68.0",
"adafruit-circuitpython-busdevice>=5.2.14",
"spidev>=3.8 ; (platform_machine == 'aarch64' and sys_platform == 'linux') or (platform_machine == 'armv6l' and sys_platform == 'linux') or (platform_machine == 'armv7l' and sys_platform == 'linux')",
"typing-extensions>=4.15.0",
]

[project.urls]
Documentation = "https://circuitpython-nrf24l01.readthedocs.io"
Expand All @@ -45,9 +51,6 @@ Tracker = "https://github.com/2bndy5/CircuitPython_nRF24L01/issues"
[tool.setuptools]
packages = ["circuitpython_nrf24l01"]

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}

[tool.setuptools_scm]
# It would be nice to include the commit hash in the version, but that
# can't be done in a PEP 440-compatible way.
Expand Down Expand Up @@ -87,3 +90,18 @@ exclude_lines = [
"radio hardware not responding",
"elif not after_toggle",
]

[dependency-groups]
dev = [
"mypy>=1.18.2",
"pre-commit>=4.3.0",
"ruff>=0.14.6",
]
docs = [
"sphinx-immaterial[keys]>=0.12.5",
"sphinx-social-cards>=0.5.0",
]
tests = [
"coverage[toml]>=7.10.7",
"pytest>=8.4.2",
]
4 changes: 0 additions & 4 deletions requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions tests/requirements.txt

This file was deleted.

Loading