Migrate build tools to hatch (#93)

* Migrate build tools to hatch

* fmt

* fix workflows

* add tldr

* simplify hatch usage and environments

* add hatch to devcontainer
This commit is contained in:
Jack Gerrits
2024-06-19 13:49:13 -04:00
committed by GitHub
parent 1c69c3ad0b
commit 432b1c1213
10 changed files with 103 additions and 128 deletions

View File

@@ -9,68 +9,53 @@ on:
- main
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: pip install ".[dev]"
- run: ruff check
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: pip install ".[dev]"
- run: ruff format --check
- name: Install Hatch
uses: pypa/hatch@install
- run: hatch run ruff format --check
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Hatch
uses: pypa/hatch@install
- run: hatch run ruff check
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: pip install ".[dev]"
- run: mypy
- name: Install Hatch
uses: pypa/hatch@install
- run: hatch run mypy
pyright:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: pip install ".[dev]"
- uses: jakebailey/pyright-action@v2
- name: Install Hatch
uses: pypa/hatch@install
- run: hatch run pyright
test:
runs-on: ubuntu-latest
strategy:
matrix:
# "pypy3.10" disabled until better example than polars used in tests
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install ".[dev]"
- run: pytest -n auto
- name: Install Hatch
uses: pypa/hatch@install
- run: hatch run +python=${{ matrix.python-version }} test-matrix:pytest -n auto
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: pip install ".[docs]"
- run: sphinx-build --fail-on-warning docs/src docs/build
- name: Install Hatch
uses: pypa/hatch@install
- run: hatch run docs:check

View File

@@ -30,11 +30,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: pip install ".[docs]"
- run: sphinx-build docs/src docs/build
- name: Install Hatch
uses: pypa/hatch@install
- run: hatch run docs:build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with: