diff --git a/.github/workflows/template.yml b/.github/workflows/template.yml index 0771ac1..7bb55e1 100644 --- a/.github/workflows/template.yml +++ b/.github/workflows/template.yml @@ -43,9 +43,12 @@ jobs: with: enable-cache: false version: ">=0.13,<0.14" - - name: Install just + # Tools the rendered project's ci-lint needs + - name: Install just, actionlint, and yamllint run: | - uv tool install rust-just + uv tool install rust-just==1.59.0 + uv tool install actionlint-py==1.7.12.25 + uv tool install yamllint==1.38.0 - name: Render a project and run its checks run: | just check diff --git a/README.md b/README.md index 9acb66b..f33044f 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Template Checks](https://github.com/ahcodedev/python-project-template/actions/workflows/template.yml/badge.svg?branch=main)](https://github.com/ahcodedev/python-project-template/actions/workflows/template.yml) [![Security](https://github.com/ahcodedev/python-project-template/actions/workflows/security.yml/badge.svg?branch=main)](https://github.com/ahcodedev/python-project-template/actions/workflows/security.yml) +[![zizmor](https://img.shields.io/badge/%F0%9F%8C%88-zizmor-white?labelColor=white)](https://zizmor.sh/) A [Copier](https://copier.readthedocs.io/) template for Python projects. Projects created from it can pull in later template changes with `copier update`. diff --git a/justfile b/justfile index 6209821..f44696b 100644 --- a/justfile +++ b/justfile @@ -25,11 +25,12 @@ render: # Install Homebrew tools from the Brewfile setup: brew bundle install -# Render a demo project and run its lint, tests, docs build, dependency audit, and workflow audit +# Render a demo project and run its lint, spell check, tests, docs build, dependency audit, and workflow audit check: render cd {{ rendered }} && just sync cd {{ rendered }} && just ci-lint - cd {{ rendered }} && just test + cd {{ rendered }} && uvx typos + cd {{ rendered }} && just coverage cd {{ rendered }} && just docs-build cd {{ rendered }} && just audit cd {{ rendered }} && uvx zizmor --offline . diff --git a/template/.devcontainer/devcontainer-lock.json b/template/.devcontainer/devcontainer-lock.json new file mode 100644 index 0000000..de51286 --- /dev/null +++ b/template/.devcontainer/devcontainer-lock.json @@ -0,0 +1,9 @@ +{ + "features": { + "ghcr.io/devcontainers/features/github-cli:1": { + "version": "1.1.3", + "resolved": "ghcr.io/devcontainers/features/github-cli@sha256:bd7ab48a832228f633239277552c30b353867fef2e5b037e064b4e64f0b843f2", + "integrity": "sha256:bd7ab48a832228f633239277552c30b353867fef2e5b037e064b4e64f0b843f2" + } + } +} diff --git a/template/.github/dependabot.yml b/template/.github/dependabot.yml index 4298b16..d77051b 100644 --- a/template/.github/dependabot.yml +++ b/template/.github/dependabot.yml @@ -7,19 +7,19 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "monthly" + interval: "weekly" cooldown: default-days: 7 labels: ["dependencies"] groups: github-actions: - patterns: ["*"] + update-types: ["minor", "patch"] # Python dependencies in pyproject.toml / uv.lock - package-ecosystem: "uv" directory: "/" schedule: - interval: "monthly" + interval: "weekly" cooldown: default-days: 7 labels: ["dependencies"] @@ -31,7 +31,7 @@ updates: - package-ecosystem: "docker" directory: "/.devcontainer" schedule: - interval: "monthly" + interval: "weekly" cooldown: default-days: 7 labels: ["dependencies"] @@ -40,7 +40,7 @@ updates: - package-ecosystem: "devcontainers" directory: "/" schedule: - interval: "monthly" + interval: "weekly" cooldown: default-days: 7 labels: ["dependencies"] diff --git a/template/.github/pull_request_template.md.jinja b/template/.github/pull_request_template.md.jinja index fb1d268..622a44e 100644 --- a/template/.github/pull_request_template.md.jinja +++ b/template/.github/pull_request_template.md.jinja @@ -23,7 +23,7 @@ Add a release label to this PR from the Labels section of the PR sidebar ## Checklist - [ ] `just lint` passes -- [ ] `just test` passes +- [ ] `just coverage` passes - [ ] Tests added or updated for the change - [ ] `README.md` updated if needed {%- if use_releases %} diff --git a/template/.github/workflows/dependabot-auto-merge.yml b/template/.github/workflows/dependabot-auto-merge.yml index c831589..bee4322 100644 --- a/template/.github/workflows/dependabot-auto-merge.yml +++ b/template/.github/workflows/dependabot-auto-merge.yml @@ -9,10 +9,15 @@ on: permissions: {} +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: auto-merge: if: github.event.pull_request.user.login == 'dependabot[bot]' - runs-on: ubuntu-slim + runs-on: ubuntu-latest + timeout-minutes: 15 permissions: contents: write pull-requests: write diff --git a/template/.github/workflows/python.yml.jinja b/template/.github/workflows/python.yml.jinja index c215245..c675335 100644 --- a/template/.github/workflows/python.yml.jinja +++ b/template/.github/workflows/python.yml.jinja @@ -9,9 +9,14 @@ on: permissions: {} +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: code-check-and-unit-test: - runs-on: ubuntu-slim + runs-on: ubuntu-latest + timeout-minutes: 15 permissions: contents: read steps: @@ -25,21 +30,26 @@ jobs: version: ">=0.13,<0.14" - name: Setup environment run: | - uv tool install rust-just + uv tool install rust-just==1.59.0 + uv tool install actionlint-py==1.7.12.25 + uv tool install yamllint==1.38.0 just sync - name: Lint run: | just ci-lint + - name: Spell check + uses: crate-ci/typos@276087d9a4f06398b3e04825487805e2d7375888 # v1.52.2 - name: Unit tests run: | - just test + just coverage {%- endraw %}{% if use_docs %}{% raw %} - name: Docs build run: | just docs-build {%- endraw %}{% endif %}{% raw %} markdownlint: - runs-on: ubuntu-slim + runs-on: ubuntu-latest + timeout-minutes: 15 permissions: contents: read steps: diff --git a/template/.github/workflows/release-drafter.yml b/template/.github/workflows/release-drafter.yml index efe79db..d90b9a8 100644 --- a/template/.github/workflows/release-drafter.yml +++ b/template/.github/workflows/release-drafter.yml @@ -9,10 +9,15 @@ on: permissions: contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: update-draft: if: github.event_name == 'push' - runs-on: ubuntu-slim + runs-on: ubuntu-latest + timeout-minutes: 15 permissions: contents: write steps: @@ -22,7 +27,8 @@ jobs: autolabel: if: github.event_name == 'pull_request' && github.event.action != 'labeled' && github.event.action != 'unlabeled' - runs-on: ubuntu-slim + runs-on: ubuntu-latest + timeout-minutes: 15 permissions: pull-requests: write steps: @@ -37,6 +43,7 @@ jobs: # Run even when autolabel is skipped (labeled/unlabeled events) if: ${{ always() && github.event_name == 'pull_request' }} runs-on: ubuntu-latest + timeout-minutes: 15 permissions: pull-requests: read steps: @@ -44,5 +51,6 @@ jobs: with: mode: minimum count: 1 + # yamllint disable-line rule:line-length labels: "breaking, feature, enhancement, bug, fix, chore, ci, dependencies, documentation, refactor, skip-changelog" use_api: true diff --git a/template/.github/workflows/release.yml b/template/.github/workflows/release.yml index 4d8b3db..d74ee47 100644 --- a/template/.github/workflows/release.yml +++ b/template/.github/workflows/release.yml @@ -13,6 +13,7 @@ permissions: jobs: release: runs-on: ubuntu-latest + timeout-minutes: 15 permissions: contents: write steps: diff --git a/template/.github/workflows/security.yml b/template/.github/workflows/security.yml index befa809..1272788 100644 --- a/template/.github/workflows/security.yml +++ b/template/.github/workflows/security.yml @@ -8,9 +8,14 @@ on: permissions: {} +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: zizmor: - runs-on: ubuntu-slim + runs-on: ubuntu-latest + timeout-minutes: 15 permissions: contents: read # only needed for private or internal repos actions: read # only needed for private or internal repos @@ -25,7 +30,8 @@ jobs: with: advanced-security: false pip-audit: - runs-on: ubuntu-slim + runs-on: ubuntu-latest + timeout-minutes: 15 permissions: contents: read steps: @@ -40,20 +46,30 @@ jobs: version: ">=0.13,<0.14" - name: Setup environment run: | - uv tool install rust-just + uv tool install rust-just==1.59.0 just sync - name: Audit dependencies run: | just audit - gitleaks: - runs-on: ubuntu-slim + betterleaks: + runs-on: ubuntu-latest + timeout-minutes: 15 + permissions: + contents: read # needed to check out a private repo steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: - persist-credentials: false - fetch-depth: 0 - - name: Check gitleaks - uses: gitleaks/gitleaks-action@e0c47f4f8be36e29cdc102c57e68cb5cbf0e8d1e # v3.0.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITLEAKS_ENABLE_COMMENTS: false + persist-credentials: false + fetch-depth: 0 + # betterleaks has no official action or PyPI package, so it is built from source + - name: Install Go + uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0 + with: + go-version: stable + cache: false + - name: Install betterleaks + run: | + go install github.com/betterleaks/betterleaks@v1.10.1 + - name: Scan git history for secrets + run: | + "$(go env GOPATH)/bin/betterleaks" git --redact . diff --git a/template/.gitignore b/template/.gitignore deleted file mode 100644 index 678402e..0000000 --- a/template/.gitignore +++ /dev/null @@ -1,133 +0,0 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# OS Stuff -.DS_Store - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -pip-wheel-metadata/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -# Ruff -.ruff_cache - -# Claude -.claude/*.local.* -Claude.md.example -CLAUDE.md - -# Dev Container -.devcontainer/devcontainer-lock.json diff --git a/template/.gitignore.jinja b/template/.gitignore.jinja new file mode 100644 index 0000000..c0a3a04 --- /dev/null +++ b/template/.gitignore.jinja @@ -0,0 +1,38 @@ +# Python +__pycache__/ +*.py[cod] + +# Build and packaging +build/ +dist/ +*.egg-info/ + +# Virtual environments and environment files +.venv/ +.env* + +# Test and tool caches +.coverage +.coverage.* +.pytest_cache/ +.ruff_cache/ +htmlcov/ +coverage.xml +{%- if use_docs %} + +# Docs build output and cache +/site +.cache/ +{%- endif %} + +# OS +.DS_Store + +# Claude (committing Claude files is opt-in) +.claude/ +.claude/settings.local.json +CLAUDE.md +CLAUDE.md.example + +# Dev Container +.devcontainer/devcontainer-lock.json diff --git a/template/.yamllint.yml b/template/.yamllint.yml new file mode 100644 index 0000000..d8f3d6a --- /dev/null +++ b/template/.yamllint.yml @@ -0,0 +1,22 @@ +# Configuration file for yamllint. +# See https://yamllint.readthedocs.io/en/stable/configuration.html +extends: default + +ignore: | + .venv/ + site/ + +rules: + document-start: disable + # Allow both list styles under a key, as long as each file is consistent + indentation: + indent-sequences: consistent + line-length: + max: 120 + # `on:` in GitHub workflows is a key, not a boolean + truthy: + check-keys: false + brackets: + max-spaces-inside: 1 + comments: + min-spaces-from-content: 1 diff --git a/template/Brewfile b/template/Brewfile index 7504265..8e421f5 100644 --- a/template/Brewfile +++ b/template/Brewfile @@ -1,5 +1,10 @@ -brew "gitleaks" +brew "actionlint" +brew "betterleaks" +brew "copier" +brew "jq" brew "just" brew "markdownlint-cli2" +brew "typos-cli" brew "uv" +brew "yamllint" brew "zizmor" diff --git a/template/CLAUDE.md.example.jinja b/template/CLAUDE.md.example.jinja index 58c4ca6..588fd2c 100644 --- a/template/CLAUDE.md.example.jinja +++ b/template/CLAUDE.md.example.jinja @@ -8,10 +8,12 @@ Uses `uv` for environment/dependency management and `just` as the command runner - `just setup` - install Homebrew tools (`Brewfile`) and sync the project - `just sync` - install all dependency groups into `.venv` -- `just lint` - type check (ty), lint + autofix (ruff), format (ruff), spell check (codespell), - workflow lint (actionlint) -- `just ci-lint` - same checks without modifying files (used to verify, not fix) -- `just test` - run pytest with coverage (fails under 98%) +- `just lint` - type check (ty), lint + autofix (ruff), format (ruff), spell check (typos), + workflow lint (actionlint), YAML lint (yamllint), JSON validation (jq) +- `just ci-lint` - same checks without modifying files, except spell check (used to verify, not fix) +- `just spellcheck` - check spelling (typos) +- `just test` - run pytest +- `just coverage` - run pytest with coverage (fails under 98%) - `just audit` - check dependencies for known vulnerabilities (pip-audit) - `just markdownlint` - lint Markdown files (markdownlint-cli2, config in `.markdownlint-cli2.jsonc`) {%- if use_docs %} @@ -19,15 +21,16 @@ Uses `uv` for environment/dependency management and `just` as the command runner - `just docs-serve` - serve the docs locally with live reload {%- endif %} - `just zizmor` - audit GitHub Actions workflows for security issues -- `just git-leaks` - scan staged changes for secrets +- `just betterleaks` - scan staged changes for secrets {%- if use_releases %} - `just set-github-labels` - remove non-release default labels, then create/update the release labels on GitHub (`scripts/sync-labels.sh`, needs `gh`, for fresh repos) {%- endif %} +- `just update-template` - pull in the latest Copier template changes - `uv add ` / `uv add --dev ` - add a runtime / dev dependency (never edit `uv.lock` by hand) - `uv run {{ project_name }}` - run the app entry point -Run `just lint` and `just test` before considering a change done. +Run `just lint` and `just coverage` before considering a change done. ## Layout @@ -36,7 +39,7 @@ Run `just lint` and `just test` before considering a change done. - `tests/` - pytest tests; import the package as `from {{ package_name }}. import ...` - `prek.toml` - git hook config (`prek install` to enable) - `.github/workflows/` - `python.yml` (lint, tests,{% if use_docs %} docs build,{% endif %} markdownlint), - `security.yml` (zizmor, gitleaks, pip-audit){% if use_releases %}, + `security.yml` (zizmor, betterleaks, pip-audit){% if use_releases %}, `release-drafter.yml` (draft release, PR labels), `release.yml` (manual release) - `.github/release-drafter.yml` - release label → version bump / release notes section mapping{% endif %} - `.github/dependabot.yml` - weekly updates for actions, uv, dev container image and features @@ -45,7 +48,7 @@ Run `just lint` and `just test` before considering a change done. ## Conventions -- Python >= 3.14; ruff line length 100, double quotes +- Python >= 3.15; ruff line length 100, double quotes - Docstrings required in `src/` (ruff `D` rules), not in `tests/` - Type hints on public functions; code must pass `ty check` - Renaming the project means updating `[project] name`, the `src//` folder, and `[project.scripts]` together diff --git a/template/README.md.jinja b/template/README.md.jinja index 8eab4ab..38adb1a 100644 --- a/template/README.md.jinja +++ b/template/README.md.jinja @@ -2,7 +2,8 @@ [![CI](https://github.com/{{ github_repo }}/actions/workflows/python.yml/badge.svg?branch=main)](https://github.com/{{ github_repo }}/actions/workflows/python.yml) [![Security](https://github.com/{{ github_repo }}/actions/workflows/security.yml/badge.svg?branch=main)](https://github.com/{{ github_repo }}/actions/workflows/security.yml) -[![gitleaks](https://img.shields.io/badge/protected%20by-gitleaks-blue)](https://github.com/gitleaks/gitleaks) +[![betterleaks](https://img.shields.io/badge/protected%20by-betterleaks-blue)](https://github.com/betterleaks/betterleaks) +[![zizmor](https://img.shields.io/badge/%F0%9F%8C%88-zizmor-white?labelColor=white)](https://zizmor.sh/) {{ description }} @@ -29,9 +30,12 @@ manage project configuration and commands * `just setup` - install Homebrew tools from the `Brewfile` and sync the project * `just sync` - sync project dependencies (all groups) -* `just lint` - type check, lint, format, spellcheck, and lint workflows (actionlint) (applies fixes) -* `just ci-lint` - run the same checks without modifying files (used in CI) +* `just lint` - type check, lint, format, spell check (typos), and lint workflows (actionlint), YAML (yamllint), + and JSON (jq) (applies fixes) +* `just ci-lint` - run the same checks without modifying files, except spell check (used in CI) +* `just spellcheck` - check spelling with typos * `just test` - run unit tests +* `just coverage` - run unit tests with coverage (fails under 98%) * `just audit` - check dependencies for known vulnerabilities with pip-audit * `just markdownlint` - lint Markdown files with markdownlint-cli2 {%- if use_docs %} @@ -39,31 +43,32 @@ manage project configuration and commands * `just docs-serve` - serve the docs locally with live reload {%- endif %} * `just prek` - run pre-commit hooks via prek -* `just git-leaks` - scan staged changes for secrets with gitleaks +* `just betterleaks` - scan staged changes for secrets with betterleaks * `just zizmor` - audit GitHub Actions workflows for security issues {%- if use_releases %} * `just set-github-labels` - remove GitHub's non-release default labels, then create or update the release labels (for fresh repos, requires `gh auth login`) {%- endif %} +* `just update-template` - pull in the latest changes from the Copier template * `uv add {package}` - install a dependency ## CI and Security -| Workflow | Runs on | Purpose | -| --------------------- | ----------------------- | -------------------------------------------- | +| Workflow | Runs on | Purpose | +| --------------------- | ----------------------- | ------------------------------------------------------- | {%- if use_docs %} -| `python.yml` | push / PR to `main` | lint, unit tests, docs build, markdownlint | +| `python.yml` | push / PR to `main` | lint, spell check, unit tests, docs build, markdownlint | {%- else %} -| `python.yml` | push / PR to `main` | lint, unit tests, markdownlint | +| `python.yml` | push / PR to `main` | lint, spell check, unit tests, markdownlint | {%- endif %} -| `security.yml` | push to `main`, all PRs | zizmor, gitleaks, pip-audit dependency audit | +| `security.yml` | push to `main`, all PRs | zizmor, betterleaks, pip-audit dependency audit | {%- if use_releases %} -| `release-drafter.yml` | push to `main`, PRs | update the draft release, label PRs | -| `release.yml` | manual | publish a release | +| `release-drafter.yml` | push to `main`, PRs | update the draft release, label PRs | +| `release.yml` | manual | publish a release | {%- endif %} * GitHub Actions are pinned to full commit SHAs, with the version in a trailing comment -* Dependabot (`.github/dependabot.yml`) checks monthly for updates to GitHub Actions, Python +* Dependabot (`.github/dependabot.yml`) checks weekly for updates to GitHub Actions, Python dependencies, the dev container image, and dev container features. New releases wait 7 days before an update is proposed. Dependabot PRs get the `dependencies` label {%- if use_releases %} diff --git a/template/justfile.jinja b/template/justfile.jinja index 7085d30..7dc8cac 100644 --- a/template/justfile.jinja +++ b/template/justfile.jinja @@ -5,13 +5,20 @@ default: # Check dependencies for known vulnerabilities (pip-audit) audit: uv run pip-audit --skip-editable -# Type check, lint, format check, spell check, and lint workflows without changing files +# Scan staged changes for secrets +betterleaks: + betterleaks git --pre-commit --staged --redact +# Type check, lint, format check, and lint workflows, YAML, and JSON without changing files ci-lint: uv run ty check uv run ruff check . uv run ruff format --check . - uv run codespell - uv run actionlint .github/workflows/*.yml + actionlint .github/workflows/*.yml + yamllint --strict . + just json-lint +# Run unit tests with coverage (fails under 98%) +coverage: + uv run pytest --cov {%- if use_docs %} # Build the docs in strict mode (output in site/) docs-build: @@ -20,16 +27,18 @@ docs-build: docs-serve: uv run zensical serve {%- endif %} -# Scan staged changes for secrets -git-leaks: - gitleaks git --pre-commit --staged --redact -# Type check, lint, format, spell check, and lint workflows, applying fixes +# Validate JSON files (devcontainer.json is skipped because it allows comments) +json-lint: + find . -name '*.json' -not -path './.venv/*' -not -name devcontainer.json -exec jq empty {} + +# Type check, lint, format, spell check, and lint workflows, YAML, and JSON, applying fixes lint: uv run ty check uv run ruff check . --fix uv run ruff format . - uv run codespell - uv run actionlint .github/workflows/*.yml + typos --write-changes + actionlint .github/workflows/*.yml + yamllint --strict . + just json-lint # Lint Markdown files markdownlint: markdownlint-cli2 "**/*.md" @@ -45,12 +54,18 @@ set-github-labels: setup: brew bundle install just sync +# Check spelling +spellcheck: + typos # Install all dependency groups into .venv sync: uv sync --all-groups -# Run unit tests with coverage +# Run unit tests test: uv run pytest +# Pull in the latest changes from the Copier template +update-template: + copier update --trust # Audit GitHub Actions workflows for security issues zizmor: zizmor . --collect all diff --git a/template/prek.toml.jinja b/template/prek.toml.jinja index 7c79836..5f243c3 100644 --- a/template/prek.toml.jinja +++ b/template/prek.toml.jinja @@ -7,12 +7,7 @@ repo = "builtin" hooks = [ { id = "trailing-whitespace" }, { id = "end-of-file-fixer" }, - { id = "check-added-large-files" }, - { id = "check-yaml" }, - { - id = "check-json", - exclude = "devcontainer.json" - } + { id = "check-added-large-files" } ] [[repos]] @@ -29,7 +24,7 @@ hooks = [ id = "unit-tests", name = "unit tests", language = "system", - entry = "just test", + entry = "just coverage", pass_filenames = false }, {%- if use_docs %} @@ -42,6 +37,13 @@ hooks = [ pass_filenames = false }, {%- endif %} + { + id = "spellcheck", + name = "spell check", + language = "system", + entry = "just spellcheck", + pass_filenames = false + }, { id = "markdownlint", name = "markdownlint", @@ -59,10 +61,10 @@ hooks = [ pass_filenames = false }, { - id = "git-leaks", - name = "git leaks", + id = "betterleaks", + name = "betterleaks", language = "system", - entry = "gitleaks git --pre-commit --staged --redact", + entry = "just betterleaks", pass_filenames = false } ] diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index 2a652a7..2dc5706 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -12,8 +12,6 @@ build-backend = "uv_build" [dependency-groups] dev = [ - "actionlint-py>=1.7.12.25", - "codespell>=2.4.3", "pip-audit>=2.10.1", "prek>=0.5.10", "pytest", @@ -26,22 +24,29 @@ docs = [ "mkdocstrings[python]>=1.0.8", "zensical>=0.1.0", ] - -[tool.codespell] -skip = "./site" # Built docs output {%- endif %} +[tool.coverage.run] +source = ["src"] + +[tool.coverage.report] +fail_under = 98 +show_missing = true + [tool.pytest.ini_options] -addopts = "--cov=src --cov-report=term-missing --cov-fail-under 98" +testpaths = ["tests"] [tool.ruff] line-length = 100 [tool.ruff.lint] select = ["B", "E", "F", "W", "I", "N", "PT", "D", "UP", "RUF", "SIM", "S", "C4", "PTH", "PL", "PERF"] # Choose your rule categories -ignore = ["D100", "D104", "D211", "D203", "D213", "D400", "D401", "D415"] +ignore = ["D100", "D104", "D415"] extend-ignore = ["E501"] # Line too long (handled by formatter) +[tool.ruff.lint.pydocstyle] +convention = "google" + [tool.ruff.lint.per-file-ignores] "tests/*" = ["D", "S101"] # Ignore docstring (D) and assert (S101) errors in tests