2023-06-29 07:44:10 -07:00
|
|
|
export DATASETTE_SECRET := "not_a_secret"
|
|
|
|
|
|
|
|
|
|
# Run tests and linters
|
|
|
|
|
@default: test lint
|
|
|
|
|
|
|
|
|
|
# Setup project
|
|
|
|
|
@init:
|
2025-12-11 17:32:58 -08:00
|
|
|
uv sync
|
2023-06-29 07:44:10 -07:00
|
|
|
|
|
|
|
|
# Run pytest with supplied options
|
2025-10-30 10:41:41 -07:00
|
|
|
@test *options: init
|
|
|
|
|
uv run pytest -n auto {{options}}
|
2023-06-29 07:44:10 -07:00
|
|
|
|
|
|
|
|
@codespell:
|
2025-10-30 10:41:41 -07:00
|
|
|
uv run codespell README.md --ignore-words docs/codespell-ignore-words.txt
|
|
|
|
|
uv run codespell docs/*.rst --ignore-words docs/codespell-ignore-words.txt
|
|
|
|
|
uv run codespell datasette -S datasette/static --ignore-words docs/codespell-ignore-words.txt
|
|
|
|
|
uv run codespell tests --ignore-words docs/codespell-ignore-words.txt
|
2023-06-29 07:44:10 -07:00
|
|
|
|
2026-01-23 20:43:16 -08:00
|
|
|
# Run linters: black, ruff, cog
|
2023-06-29 07:46:22 -07:00
|
|
|
@lint: codespell
|
2026-01-23 20:43:16 -08:00
|
|
|
uv run black datasette tests --check
|
|
|
|
|
uv run ruff check datasette tests
|
2025-12-11 17:32:58 -08:00
|
|
|
uv run cog --check README.md docs/*.rst
|
2023-06-29 07:44:10 -07:00
|
|
|
|
2026-01-23 20:43:16 -08:00
|
|
|
# Apply ruff fixes
|
|
|
|
|
@fix:
|
|
|
|
|
uv run ruff check --fix datasette tests
|
|
|
|
|
|
2023-06-29 07:44:10 -07:00
|
|
|
# Rebuild docs with cog
|
|
|
|
|
@cog:
|
2025-12-11 17:32:58 -08:00
|
|
|
uv run cog -r README.md docs/*.rst
|
2023-06-29 07:44:10 -07:00
|
|
|
|
|
|
|
|
# Serve live docs on localhost:8000
|
2025-10-25 15:02:49 -07:00
|
|
|
@docs: cog blacken-docs
|
2025-12-11 17:32:58 -08:00
|
|
|
uv run make -C docs livehtml
|
2023-06-29 07:44:10 -07:00
|
|
|
|
2025-10-31 19:13:41 -07:00
|
|
|
# Build docs as static HTML
|
|
|
|
|
@docs-build: cog blacken-docs
|
|
|
|
|
rm -rf docs/_build && cd docs && uv run make html
|
|
|
|
|
|
2023-06-29 07:44:10 -07:00
|
|
|
# Apply Black
|
|
|
|
|
@black:
|
2026-01-23 20:43:16 -08:00
|
|
|
uv run black datasette tests
|
2023-06-29 07:44:10 -07:00
|
|
|
|
2025-10-25 15:02:49 -07:00
|
|
|
# Apply blacken-docs
|
|
|
|
|
@blacken-docs:
|
2025-10-30 10:41:41 -07:00
|
|
|
uv run blacken-docs -l 60 docs/*.rst
|
2025-10-25 15:02:49 -07:00
|
|
|
|
2025-10-25 09:04:04 -07:00
|
|
|
# Apply prettier
|
|
|
|
|
@prettier:
|
|
|
|
|
npm run fix
|
|
|
|
|
|
|
|
|
|
# Format code with both black and prettier
|
2025-10-25 15:02:49 -07:00
|
|
|
@format: black prettier blacken-docs
|
2025-10-25 09:04:04 -07:00
|
|
|
|
2025-10-30 10:41:41 -07:00
|
|
|
@serve *options:
|
|
|
|
|
uv run sqlite-utils create-database data.db
|
|
|
|
|
uv run sqlite-utils create-table data.db docs id integer title text --pk id --ignore
|
|
|
|
|
uv run python -m datasette data.db --root --reload {{options}}
|