Skip to content
Open
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
16 changes: 8 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ jobs:
with:
python-version: "3.11"

- name: Install Pre-Commit
run: python -m pip install pre-commit && pre-commit install
- name: Install prek
run: python -m pip install prek

- name: Load cached Pre-Commit Dependencies
id: cached-pre-commit-dependencies
- name: Load cached prek dependencies
id: cached-prek-dependencies
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/pre-commit/
key: pre-commit-|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
path: ~/.cache/prek/
key: prek-|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
Comment on lines +28 to +33

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (performance): Double-check that the prek cache path and key match its actual cache layout and config file.

Since the path is now ~/.cache/prek/ but the key still hashes .pre-commit-config.yaml, please verify that prek actually uses ~/.cache/prek/ and that .pre-commit-config.yaml is still the canonical config for cache invalidation (and not, for example, prek.toml or pyproject.toml).


- name: Execute Pre-Commit
- name: Execute prek
env:
# slotscheck imports the package by name; expose the src layout on the path
PYTHONPATH: src
run: pre-commit run --show-diff-on-failure --color=always --all-files
run: prek run --show-diff-on-failure --color=always --all-files

test:
permissions:
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ upgrade: ## Upgrade all dependencies to the latest stable versio
@$(UV) lock --upgrade
@$(UV) sync --all-groups
@echo "=> Dependencies Updated"
@$(ENV_PREFIX)pre-commit autoupdate
@echo "=> Updated Pre-commit"
@$(UV) run prek update
@echo "=> Updated prek hooks"

# =============================================================================
# Developer Utils
Expand Down Expand Up @@ -59,10 +59,10 @@ destroy: ## Destroy the virtual environment
# Tests, Linting, Coverage
# =============================================================================
.PHONY: lint
lint: ## Runs pre-commit hooks; includes ruff linting, codespell, black
@echo "=> Running pre-commit process"
@$(UV) run pre-commit run --all-files
@echo "=> Pre-commit complete"
lint: ## Runs prek hooks; includes ruff linting, codespell, black
@echo "=> Running prek process"
@$(UV) run prek run --all-files
@echo "=> prek complete"

.PHONY: coverage
coverage: ## Run the tests and generate coverage report
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Usage:

- Pick this template in GitHub.
- Rename the `src/project_template` package to your project's name and update the `name` in `pyproject.toml` and any imports to match (hatchling auto-discovers `src/<project_name>`).
- Run `pre-commit install && pre-commit autoupdate`
- Run `prek install && prek update`
- Update `pyproject.toml` with your dependencies and run `uv lock` to refresh the lock file.
- Update the project description, keywords, author, maintainers etc. in `pyproject.toml`

Expand All @@ -44,7 +44,7 @@ This project uses [uv](https://docs.astral.sh/uv/) for package and environment m
```bash
uv sync --all-groups # install runtime + docs/lint/test groups
uv run pytest # run tests
uv run pre-commit run -a # lint
uv run prek run -a # lint
uv lock --upgrade # upgrade locked deps

# Equivalent Makefile shortcuts
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ lint = [
"ruff>=0.0.289",
"codespell>=2.2.5",
"mypy>=1.5.1",
"pre-commit>=3.4.0",
"prek>=0.4.10",
"blacken-docs>=1.16.0",
"shellcheck-py>=0.9.0.5",
"pyright>=1.1.327",
Expand Down
Loading
Loading