Skip to content
Open
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
52 changes: 31 additions & 21 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,51 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ubuntu-24.04 # ubuntu-latest tag has been deprecated. See https://github.com/actions/runner-images/issues/10636
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]

python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install build dependencies for requests in Python 3.9
# it's not clear why this is needed only for this version of python
if: matrix.python-version == 3.9
run: sudo apt-get install libxml2-dev libxslt-dev

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install build dependencies for requests in python 3.9
# it's not clear why this is needed only for this version of python
run: sudo apt-get install libxml2-dev libxslt-dev
- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install uv and set Python version
uses: astral-sh/setup-uv@v6
with:
# Version of Poetry to use
version: 1.4.2
version: "0.8.8"
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
poetry install
- name: Check formatting with black
uv sync --dev --all-extras

- name: Check type annotations
run: |
poetry run black --check .
- name: Check typing annotations with mypy
uv run pyright

- name: Check codebase
run: |
poetry run mypy .
- name: Verify unused imports
uv run ruff check

- name: Check formatting
run: |
poetry run flake8 --select F401
uv run ruff format --check

- name: Test with pytest
# Wrapped by coverage to generate coverage data
run: |
poetry run coverage run --omit="tests*" -m pytest
uv run coverage run --omit="tests*" -m pytest

- name: Generate coverage report
run: |
poetry run coverage report
uv run coverage report
10 changes: 10 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pre-commit:
commands:
ruff-check:
glob: "*.py"
stage_fixed: true
run: ruff check {staged_files} --fix --exit-non-zero-on-fix
ruff-fmt:
glob: "*.py"
stage_fixed: true
run: ruff format --exit-non-zero-on-format {staged_files}
Loading