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
51 changes: 35 additions & 16 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ jobs:
python-version: "3.14"
- name: "Setup uv"
uses: astral-sh/setup-uv@v8.2.0
- name: "Setup just"
uses: extractions/setup-just@v4
- name: "Check uv.lock"
run: uv lock --check
run: just lock-check
- name: "Lint TOMLs"
uses: docker://docker.io/tamasfe/taplo:0.10.0
with:
args: fmt --check --diff
run: just lint-toml
- name: "Lint YAMLs"
run: uv run tox -e lint-yaml
run: just lint-yaml

lint:
name: "Linting"
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v7
Expand All @@ -46,14 +46,31 @@ jobs:
python-version: "3.14"
- name: "Setup uv"
uses: astral-sh/setup-uv@v8.2.0
- name: "Setup just"
uses: extractions/setup-just@v4
- name: "Lint formatting"
run: uv run tox -e lint-py
# - name: "Type checking" TODO(trin94): revisit linter config and re-enable
# run: uv run tox -e lint-mypy
run: just lint

types:
typing:
name: "Type checking (library code)"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v7
- name: "Setup Python"
uses: actions/setup-python@v6
with:
python-version: "3.14"
- name: "Setup uv"
uses: astral-sh/setup-uv@v8.2.0
- name: "Setup just"
uses: extractions/setup-just@v4
- name: "Type checking (library code)"
run: just typing

public-typing:
name: "Type checking (public API)"
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v7
Expand All @@ -63,12 +80,14 @@ jobs:
python-version: "3.14"
- name: "Setup uv"
uses: astral-sh/setup-uv@v8.2.0
- name: "Setup just"
uses: extractions/setup-just@v4
- name: "Type checking (public API)"
run: uv run tox -e lint-types
run: just public-typing-all

tests:
name: "Run unit tests"
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
Expand All @@ -82,7 +101,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: "Setup uv"
uses: astral-sh/setup-uv@v8.2.0
- name: "Setup just"
uses: extractions/setup-just@v4
- name: "Run tests"
run: >-
uv run tox -e ${{ matrix.python-version }}
--skip-missing-interpreters false
run: just test ${{ matrix.python-version }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
.tox/
.coverage
.cache
coverage.xml
Expand Down
87 changes: 87 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
set shell := ["bash", "-euc"]

python_oldest := "3.10" # Oldest supported version
python_latest := "3.14" # Newest supported version
python := "3.14" # Default version for dev loop
python_versions := "3.10 3.11 3.12 3.13 3.14"

taplo := "uvx taplo@0.9.3"

@_default:
just --list --unsorted

fmt:
uv run --only-group ruff ruff format .
uv run --only-group ruff ruff check --fix --show-fixes .
{{ taplo }} format
just --fmt

# Dev loop
dev: fmt lint test

# Full check
check: lock-check lint lint-toml lint-yaml public-typing typing test-all

# Install locked dependencies
[group('project')]
init:
uv sync

[group('project')]
dist:
uv build

[group('project')]
publish:
uv publish

[group('project')]
clean:
rm -rf dist .mypy_cache .pytest_cache .ruff_cache .uv-cache

[group('test')]
test version=python *args:
uv run --python {{ version }} --no-default-groups --group tests pytest {{ args }}

# Test all supported Python versions
[group('test')]
test-all:
for v in {{ python_versions }}; do just test "$v"; done

[group('test')]
coverage version=python:
uv run --python {{ version }} --no-default-groups --group tests \
pytest --cov=. --cov-branch --cov-report=term-missing:skip-covered

# Type check our code
[group('typing')]
typing version=python_oldest:
# --python-version is a mypy target flag, not a host interpreter
uv run --no-default-groups --group mypy mypy --python-version {{ version }} .

# Type check as if we're a consumer of the library
[group('typing')]
public-typing version=python_oldest:
uv run --no-default-groups --group mypy mypy --python-version {{ version }} typing_checks

[group('typing')]
public-typing-all:
for v in {{ python_oldest }} {{ python_latest }}; do just public-typing "$v"; done

[group('lint')]
lint:
uv run --only-group ruff ruff format --diff .
uv run --only-group ruff ruff check .

[group('lint')]
lint-toml:
{{ taplo }} lint
{{ taplo }} format --check --diff

[group('lint')]
lint-yaml:
uv run --only-group yamllint yamllint --strict .

[group('lint')]
lock-check:
uv lock --check
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,16 @@ def foo(user):
Apache License 2.0

## Development
We use [uv](https://docs.astral.sh/uv/getting-started/installation/) and `make` for development. Install both, then run `make init` to get started.
We use [uv](https://docs.astral.sh/uv/getting-started/installation/) and
[just](https://github.com/casey/just#installation) for development. Install both,
then run `just init` to set up the environment.

Useful recipes:

* `just` lists all recipes
* `just dev` formats, lints, and tests on the default interpreter (the fast loop)
* `just test 3.12` runs the tests against a specific Python version
* `just check` runs the full gate before pushing

## Contributors
* Ivan Korobkov [@ivankorobkov](https://github.com/ivankorobkov)
Expand Down
27 changes: 0 additions & 27 deletions makefile

This file was deleted.

Loading
Loading