diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b187c34..1171176 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,12 +23,12 @@ jobs: steps: - name: Checkout Code - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: fetch-depth: 0 - name: Set up uv - uses: astral-sh/setup-uv@v6 + uses: astral-sh/setup-uv@v7 with: enable-cache: true python-version: ${{ matrix.python }} @@ -38,7 +38,7 @@ jobs: uv run make build - name: Upload Packages - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: ${{ env.RELEASE_FILE }} path: dist/ diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 026c94b..b311016 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -21,12 +21,12 @@ jobs: steps: - name: Checkout Code - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: fetch-depth: 0 - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v5 + uses: actions/setup-python@v7 with: python-version: ${{ matrix.python }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fb4bd8a..26bb5ea 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -18,12 +18,12 @@ jobs: steps: - name: Checkout Code - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: fetch-depth: 0 - name: Set up uv - uses: astral-sh/setup-uv@v6 + uses: astral-sh/setup-uv@v7 - name: Build Packages run: uv build diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml index e2c04bf..7624d86 100644 --- a/.github/workflows/qa.yml +++ b/.github/workflows/qa.yml @@ -18,12 +18,12 @@ jobs: steps: - name: Checkout Code - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: fetch-depth: 0 - name: Set up uv - uses: astral-sh/setup-uv@v6 + uses: astral-sh/setup-uv@v7 with: enable-cache: true python-version: '3.11' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8e4fb06..a649822 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,10 +21,10 @@ jobs: steps: - name: Checkout Code - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Set up uv - uses: astral-sh/setup-uv@v6 + uses: astral-sh/setup-uv@v7 with: enable-cache: true python-version: ${{ matrix.python }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 53210a8..bc7461a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,22 +1,22 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: mixed-line-ending args: ['--fix=lf'] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.15.20 + rev: v0.16.4 hooks: - id: ruff-check args: ['--fix'] - repo: https://github.com/codespell-project/codespell - rev: v2.3.0 + rev: v2.4.3 hooks: - id: codespell additional_dependencies: ['tomli'] - repo: https://github.com/shellcheck-py/shellcheck-py - rev: v0.10.0.1 + rev: v0.11.0.1 hooks: - id: shellcheck diff --git a/gpiodevice/__init__.py b/gpiodevice/__init__.py index da9e06c..f2a50ff 100644 --- a/gpiodevice/__init__.py +++ b/gpiodevice/__init__.py @@ -1,9 +1,10 @@ +from __future__ import annotations + import glob import re import sys from importlib.metadata import PackageNotFoundError, version from pathlib import Path -from typing import Optional, Union import gpiod @@ -55,7 +56,7 @@ def check_pins_available(chip: gpiod.Chip, pins, fatal: bool = True) -> bool: @errors.collect -def find_chip_by_label(labels: Union[list[str], tuple[str, ...], str], pins: Optional[dict[str, Union[int, str]]] = None, fatal: bool = True): +def find_chip_by_label(labels: list[str] | tuple[str, ...] | str, pins: dict[str, int | str] | None = None, fatal: bool = True): """Try to find a gpiochip device matching one of a set of labels. Raise a RuntimeError with a friendly error digest if one is not found. @@ -88,7 +89,7 @@ def find_chip_by_label(labels: Union[list[str], tuple[str, ...], str], pins: Opt @errors.collect -def find_chip_by_pins(pins: Union[list[str], tuple[str, ...], str, int], ignore_claimed: bool = False, fatal: bool = True): +def find_chip_by_pins(pins: list[str] | tuple[str, ...] | str | int, ignore_claimed: bool = False, fatal: bool = True): """Try to find a gpiochip device that includes all of the named pins. Does not care whether pins are in use or not. @@ -185,4 +186,4 @@ def get_pins_for_platform(platforms): # Edge / interrupt helpers (imported last to avoid a cycle with watch_pin's use of get_pin) -from .watch import Watch, wait_for_edge, watch_pin # noqa: E402,F401 +from .watch import Watch, wait_for_edge, watch_pin # noqa: F401 diff --git a/pyproject.toml b/pyproject.toml index 06c270d..74a1526 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,7 +48,7 @@ Homepage = "https://www.pimoroni.com" [dependency-groups] dev = [ "check-manifest", - "ruff==0.15.20", + "ruff==0.16.4", "codespell", "pre-commit", "twine",