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
6 changes: 3 additions & 3 deletions .github/workflows/docs-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- '**.md'
- '.markdownlint-cli2.jsonc'
- '.mise.toml'
- 'Makefile'
- 'justfile'
- '.github/workflows/docs-lint.yaml'

permissions:
Expand All @@ -19,7 +19,7 @@ jobs:
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
- run: make docs/lint
- run: just docs lint

build:
runs-on: ubuntu-latest
Expand All @@ -33,4 +33,4 @@ jobs:
enable-cache: true
- run: |
uv sync --group dev
make docs/build
just docs build
5 changes: 4 additions & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
- uses: taiki-e/install-action@7a79fe8c3a13344501c80d99cae481c1c9085912 # v2.81.10
with:
tool: just
- run: |
uv sync --group dev
make docs/build
just docs build
- name: Upload artifact
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
with:
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/test-suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
if: matrix.python-version == '3.13' || matrix.python-version == '3.14'
- uses: taiki-e/install-action@7a79fe8c3a13344501c80d99cae481c1c9085912 # v2.81.10
with:
tool: just
- run: |
make tool
just tool

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v6.0.0
Expand All @@ -51,4 +54,4 @@ jobs:

- name: Test
run: |
make tox
just tox
1 change: 1 addition & 0 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[tools]
python = "3.12"
just = "latest"
"npm:markdownlint-cli2" = "0.18.1"
20 changes: 10 additions & 10 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ PyAthena is a Python DB API 2.0 (PEP 249) compliant client for Amazon Athena. Se
### Code Quality — Always Run Before Committing

```bash
make format # Auto-fix formatting and imports
make lint # Lint + format check + mypy
just format # Auto-fix formatting and imports
just lint # Lint + format check + mypy
```

### Testing

```bash
# ALWAYS run `make lint` first — tests will fail if lint doesn't pass
make test/pyathena # Unit tests (runs lint first)
make test/sqla # SQLAlchemy dialect tests
make test/sqla-async # SQLAlchemy async dialect tests
# ALWAYS run `just lint` first — tests will fail if lint doesn't pass
just test pyathena # Unit tests (runs lint first)
just test sqla # SQLAlchemy dialect tests
just test sqla-async # SQLAlchemy async dialect tests
```

Tests require AWS environment variables. Use a `.env` file (gitignored):
Expand All @@ -48,7 +48,7 @@ export $(cat .env | xargs) && uv run pytest tests/pyathena/test_file.py -v

- Tests mirror source structure under `tests/pyathena/`
- Use pytest fixtures from `conftest.py`
- New features require tests; changes to SQLAlchemy dialects must pass `make test-sqla`
- New features require tests; changes to SQLAlchemy dialects must pass `just test sqla`

#### Test Conventions

Expand All @@ -74,9 +74,9 @@ export $(cat .env | xargs) && uv run pytest tests/pyathena/test_file.py -v

```bash
mise install # one-time: installs markdownlint-cli2
make docs/lint # check
make docs/format # auto-fix what's possible
make docs/build # build the Sphinx site under docs/_build/html
just docs lint # check
just docs format # auto-fix what's possible
just docs build # build the Sphinx site under docs/_build/html
```

## Architecture — Key Design Decisions
Expand Down
50 changes: 0 additions & 50 deletions Makefile

This file was deleted.

14 changes: 8 additions & 6 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,20 @@ $ export AWS_ATHENA_MANAGED_WORKGROUP=pyathena-managed

## Run test

The task runner uses [just](https://github.com/casey/just). Install it with `mise use -g just`, `brew install just`, or `cargo install just`.

```bash
$ pip install uv or pipx install uv or brew install uv or mise install uv
$ make test/pyathena
$ make test/sqla
$ make test/sqla-async
$ just test pyathena
$ just test sqla
$ just test sqla-async
```

## Run test multiple Python versions

```bash
$ pip install uv or pipx install uv or brew install uv or mise install uv
$ make tox
$ just tox
```

## Code formatting
Expand All @@ -52,13 +54,13 @@ The code formatting uses [ruff](https://github.com/astral-sh/ruff).
### Appy format

```bash
$ make format
$ just format
```

### Lint and check format

```bash
$ make lint
$ just lint
```

## GitHub Actions
Expand Down
72 changes: 72 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
RUFF_VERSION := "0.14.14"
TOX_VERSION := "4.34.1"

# List available recipes
default:
@just --list

# Auto-fix formatting and imports
format:
# TODO: https://github.com/astral-sh/uv/issues/5903
uvx ruff@{{RUFF_VERSION}} check --select I --fix .
uvx ruff@{{RUFF_VERSION}} format .

# Lint + format check + mypy
lint:
uvx ruff@{{RUFF_VERSION}} check .
uvx ruff@{{RUFF_VERSION}} format --check .
uv run mypy .

# Run tests: just test (pyathena|sqla|sqla-async)
test target="help":
@just _test-{{ if target =~ "^-" { "help" } else { target } }}

_test-help:
@echo "Usage: just test <target>"
@echo ""
@echo "Targets:"
@echo " pyathena Run unit tests (runs lint first)"
@echo " sqla Run SQLAlchemy dialect tests"
@echo " sqla-async Run SQLAlchemy async dialect tests"

_test-pyathena: lint
uv run pytest -n 8 --cov pyathena --cov-report html --cov-report term tests/pyathena/

_test-sqla:
uv run pytest -n 8 --cov pyathena --cov-report html --cov-report term tests/sqlalchemy/

_test-sqla-async:
uv run pytest -n 8 --cov pyathena --cov-report html --cov-report term tests/sqlalchemy/ --dburi async

# Run tests across multiple Python versions with tox
tox:
uvx tox@{{TOX_VERSION}} -c pyproject.toml run

# Docs: just docs (build|lint|format)
docs target="help":
@just _docs-{{ if target =~ "^-" { "help" } else { target } }}

_docs-help:
@echo "Usage: just docs <target>"
@echo ""
@echo "Targets:"
@echo " build Build the Sphinx documentation site (docs/_build/html)"
@echo " lint Lint Markdown with markdownlint-cli2"
@echo " format Auto-fix Markdown with markdownlint-cli2"

_docs-build:
uv run sphinx-multiversion docs docs/_build/html
echo '<meta http-equiv="refresh" content="0; url=./master/index.html">' > docs/_build/html/index.html
echo 'pyathena.dev' > docs/_build/html/CNAME
touch docs/_build/html/.nojekyll

_docs-lint:
mise exec -- markdownlint-cli2

_docs-format:
mise exec -- markdownlint-cli2 --fix

# Install development tools
tool:
uv tool install ruff@{{RUFF_VERSION}}
uv tool install tox@{{TOX_VERSION}} --with tox-uv --with tox-gh-actions
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,12 @@ TEST_TYPE =
allowlist_externals =
uv
uvx
make
just
commands =
uv sync --group dev
pyathena: make test/pyathena
sqla: make test/sqla
sqla_async: make test/sqla-async
pyathena: just test pyathena
sqla: just test sqla
sqla_async: just test sqla-async
passenv =
TOXENV
AWS_*
Expand Down
Loading