help:
    @just --list


# Run linters and other checks
check:
    pre-commit run --all-files --hook-stage manual

# Run tests with all supported Python versions
test-all:
    #!/usr/bin/env bash
    for version in 3.8 3.9 3.10 3.11 3.12 3.13; do
        run-python-version $version python$version -m pytest
    done

# Run tests with pytest
test version="3.11" *pytest-params="":
    #!/usr/bin/env bash
    run-python-version $version python$version -m pytest {{ pytest-params }}

# Run tests continuously and re-run them with watchexec if files changed
watchtests *pytest-params:
    watchexec --restart --exts py --stop-timeout 0 -- pytest {{ pytest-params }}

testpypi-release: check test-all
    #!/usr/bin/env bash
    export POETRY_PYPI_TOKEN_TESTPYPI=$(op.exe read op://Secrets/test-pypi-token/credential)
    export POETRY_REPOSITORIES_TESTPYPI_URL=https://test.pypi.org/legacy/
    poetry publish --build --repository testpypi

release: check test-all
    #!/usr/bin/env bash
    export POETRY_PYPI_TOKEN_PYPI=$(op.exe read op://Secrets/pypi-token/credential)
    poetry publish --build
