|
| 1 | +RUFF_VERSION := "0.14.14" |
| 2 | +TOX_VERSION := "4.34.1" |
| 3 | + |
| 4 | +# List available recipes |
| 5 | +default: |
| 6 | + @just --list |
| 7 | + |
| 8 | +# Auto-fix formatting and imports |
| 9 | +format: |
| 10 | + # TODO: https://github.com/astral-sh/uv/issues/5903 |
| 11 | + uvx ruff@{{RUFF_VERSION}} check --select I --fix . |
| 12 | + uvx ruff@{{RUFF_VERSION}} format . |
| 13 | + |
| 14 | +# Lint + format check + mypy |
| 15 | +lint: |
| 16 | + uvx ruff@{{RUFF_VERSION}} check . |
| 17 | + uvx ruff@{{RUFF_VERSION}} format --check . |
| 18 | + uv run mypy . |
| 19 | + |
| 20 | +# Run tests: just test (pyathena|sqla|sqla-async) |
| 21 | +test target="help": |
| 22 | + @just _test-{{ if target =~ "^-" { "help" } else { target } }} |
| 23 | + |
| 24 | +_test-help: |
| 25 | + @echo "Usage: just test <target>" |
| 26 | + @echo "" |
| 27 | + @echo "Targets:" |
| 28 | + @echo " pyathena Run unit tests (runs lint first)" |
| 29 | + @echo " sqla Run SQLAlchemy dialect tests" |
| 30 | + @echo " sqla-async Run SQLAlchemy async dialect tests" |
| 31 | + |
| 32 | +_test-pyathena: lint |
| 33 | + uv run pytest -n 8 --cov pyathena --cov-report html --cov-report term tests/pyathena/ |
| 34 | + |
| 35 | +_test-sqla: |
| 36 | + uv run pytest -n 8 --cov pyathena --cov-report html --cov-report term tests/sqlalchemy/ |
| 37 | + |
| 38 | +_test-sqla-async: |
| 39 | + uv run pytest -n 8 --cov pyathena --cov-report html --cov-report term tests/sqlalchemy/ --dburi async |
| 40 | + |
| 41 | +# Run tests across multiple Python versions with tox |
| 42 | +tox: |
| 43 | + uvx tox@{{TOX_VERSION}} -c pyproject.toml run |
| 44 | + |
| 45 | +# Docs: just docs (build|lint|format) |
| 46 | +docs target="help": |
| 47 | + @just _docs-{{ if target =~ "^-" { "help" } else { target } }} |
| 48 | + |
| 49 | +_docs-help: |
| 50 | + @echo "Usage: just docs <target>" |
| 51 | + @echo "" |
| 52 | + @echo "Targets:" |
| 53 | + @echo " build Build the Sphinx documentation site (docs/_build/html)" |
| 54 | + @echo " lint Lint Markdown with markdownlint-cli2" |
| 55 | + @echo " format Auto-fix Markdown with markdownlint-cli2" |
| 56 | + |
| 57 | +_docs-build: |
| 58 | + uv run sphinx-multiversion docs docs/_build/html |
| 59 | + echo '<meta http-equiv="refresh" content="0; url=./master/index.html">' > docs/_build/html/index.html |
| 60 | + echo 'pyathena.dev' > docs/_build/html/CNAME |
| 61 | + touch docs/_build/html/.nojekyll |
| 62 | + |
| 63 | +_docs-lint: |
| 64 | + mise exec -- markdownlint-cli2 |
| 65 | + |
| 66 | +_docs-format: |
| 67 | + mise exec -- markdownlint-cli2 --fix |
| 68 | + |
| 69 | +# Install development tools |
| 70 | +tool: |
| 71 | + uv tool install ruff@{{RUFF_VERSION}} |
| 72 | + uv tool install tox@{{TOX_VERSION}} --with tox-uv --with tox-gh-actions |
0 commit comments