Back the shipped py.typed promise with an enforced type check and a linter: - Add ruff + mypy (+ types-requests) to the dev extras and dev requirements, with [tool.ruff]/[tool.mypy] config in pyproject.toml (mypy checks the package, not the tests). - Add a lint job to the Forgejo workflow running ruff check + mypy. - Fix the issues this surfaced: type FileLock.fd as TextIO | None, add a targeted type: ignore for the intentional socket.getaddrinfo monkeypatch, and drop an unused import. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
45 lines
923 B
YAML
45 lines
923 B
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Install package with dev extras
|
|
run: pip install -e ".[dev]"
|
|
|
|
- name: Ruff (lint)
|
|
run: ruff check src/ tests/
|
|
|
|
- name: Mypy (type check)
|
|
run: mypy
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
# requires-python = ">=3.10"; test the floor and a recent version.
|
|
python-version: ["3.10", "3.12"]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install package with dev extras
|
|
run: pip install -e ".[dev]"
|
|
|
|
- name: Run test suite
|
|
run: pytest -q
|