diff --git a/{{cookiecutter.project_name}}/.github/workflows/ci.yaml b/{{cookiecutter.project_name}}/.github/workflows/ci.yaml index 1d52ebd..1f638f0 100644 --- a/{{cookiecutter.project_name}}/.github/workflows/ci.yaml +++ b/{{cookiecutter.project_name}}/.github/workflows/ci.yaml @@ -11,12 +11,13 @@ on: - main jobs: - lint: + code-check: if: github.event.pull_request.draft == false runs-on: {{'ubuntu-latest' if cookiecutter.open_source == 'y' else '[self-hosted, self-hosted-ubuntu-latest]'}} steps: - uses: actions/checkout@v4 - - uses: jpetrucciani/ruff-check@main + - uses: actions/setup-python@v5 + - uses: pre-commit/action@v3.0.1 pytest: if: github.event.pull_request.draft == false diff --git a/{{cookiecutter.project_name}}/.pre-commit-config.yaml b/{{cookiecutter.project_name}}/.pre-commit-config.yaml index 13ef8b6..9c83284 100644 --- a/{{cookiecutter.project_name}}/.pre-commit-config.yaml +++ b/{{cookiecutter.project_name}}/.pre-commit-config.yaml @@ -4,25 +4,38 @@ repos: hooks: - id: python-use-type-annotations - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: end-of-file-fixer - id: trailing-whitespace - id: debug-statements - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.2 + rev: v0.5.2 hooks: - id: ruff - args: [--fix, --exit-non-zero-on-fix] - types_or: [python, pyi, jupyter] + args: + - --fix + - --exit-non-zero-on-fix + types_or: + - python + - pyi + - jupyter - id: ruff-format - types_or: [python, pyi, jupyter] + types_or: + - python + - pyi + - jupyter - repo: https://github.com/kynan/nbstripout rev: 0.7.1 hooks: - id: nbstripout - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.9.0 + rev: v1.10.1 hooks: - id: mypy - args: [--install-types, --non-interactive, --ignore-missing-imports, --show-error-codes] + args: + - --install-types + - --non-interactive + - --ignore-missing-imports + - --show-error-codes + - --check-untyped-defs diff --git a/{{cookiecutter.project_name}}/makefile b/{{cookiecutter.project_name}}/makefile index c19a5ce..fe5d9a4 100644 --- a/{{cookiecutter.project_name}}/makefile +++ b/{{cookiecutter.project_name}}/makefile @@ -26,14 +26,12 @@ help: install: ## Install dependencies @echo "Installing the '{{ cookiecutter.project_name }}' project..." - @$(MAKE) --quiet install-brew - @$(MAKE) --quiet install-gpg - @$(MAKE) --quiet generate-gpg-key{{'\n @$(MAKE) --quiet install-pipx\n @$(MAKE) --quiet install-poetry' if cookiecutter.dependency_manager != 'pip'}} + @$(MAKE) --quiet install-brew{{'\n\t@$(MAKE) --quiet install-gpg' if cookiecutter.open_source != 'y'}} + @$(MAKE) --quiet generate-gpg-key{{'\n\t@$(MAKE) --quiet install-pipx\n\t@$(MAKE) --quiet install-poetry' if cookiecutter.dependency_manager != 'pip'}} @$(MAKE) --quiet install-dependencies - @$(MAKE) --quiet setup-environment-variables - @$(MAKE) --quiet setup-git{{'\n\t@$(MAKE) --quiet freeze' if cookiecutter.dependency_manager == 'pip'}} + @$(MAKE) --quiet setup-environment-variables{{'\n\t@$(MAKE) --quiet setup-git' if cookiecutter.open_source != 'y'}}{{'\n\t@$(MAKE) --quiet freeze' if cookiecutter.dependency_manager == 'pip'}} @$(MAKE) --quiet add-repo-to-git - @echo "Installed the '{{ cookiecutter.project_name }}' project. You can now activate your virtual environment with 'source .venv/bin/activate'." + @echo "Installed the '{{ cookiecutter.project_name }}' project. You can now activate your virtual environment with 'source .venv/bin/activate'. If you want to use pre-commit hooks, run 'make install-pre-commit'." @echo "Note that this is a {{'Poetry' if cookiecutter.dependency_manager != 'pip' else 'pip'}} project. Use '{{'poetry add ' if cookiecutter.dependency_manager != 'pip' else 'pip install '}}' to install new dependencies and '{{'poetry remove ' if cookiecutter.dependency_manager != 'pip' else 'pip uninstall '}}' to remove them.{{' Freeze your dependencies into pyproject.toml with \'make freeze\'.' if cookiecutter.dependency_manager == 'pip'}}" install-brew: @@ -109,6 +107,8 @@ setup-git: git config --local user.signingkey ${GPG_KEY_ID}; \ echo "Signed with GPG key ID ${GPG_KEY_ID}."; \ fi + +install-pre-commit: ## Install pre-commit hooks @{{'poetry run ' if cookiecutter.dependency_manager != 'pip' else '. .venv/bin/activate && '}}pre-commit install add-repo-to-git: