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-10-30 10:41:41 -07:00
|
|
|
uv sync --extra test --extra docs
|
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
|
|
|
|
|
|
|
|
# Run linters: black, flake8, mypy, cog
|
2023-06-29 07:46:22 -07:00
|
|
|
@lint: codespell
|
2025-10-30 10:41:41 -07:00
|
|
|
uv run black . --check
|
|
|
|
|
uv run flake8
|
2025-11-04 18:11:20 -08:00
|
|
|
uv run --extra test cog --check README.md docs/*.rst
|
2023-06-29 07:44:10 -07:00
|
|
|
|
|
|
|
|
# Rebuild docs with cog
|
|
|
|
|
@cog:
|
2025-11-04 18:11:20 -08:00
|
|
|
uv run --extra test 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-10-31 16:34:11 -07:00
|
|
|
uv sync --extra docs && cd docs && uv run make 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:
|
2025-10-30 10:41:41 -07:00
|
|
|
uv run black .
|
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}}
|