diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e5363c2..0005272 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Download actionlint - run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.6.21 + run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.7.11 shell: bash - name: Check workflow files run: ./actionlint -color @@ -19,22 +19,28 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - name: Install uv + uses: astral-sh/setup-uv@v7 with: + enable-cache: false python-version: "3.12" - - run: python -m pip install pre-commit - - run: pre-commit run --all-files + activate-environment: true + - run: uv pip install prek + - run: prek run --all-files test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - name: Install uv + uses: astral-sh/setup-uv@v7 with: + enable-cache: false python-version: "3.12" - - run: python -m pip install cookiecutter pytest pyyaml toml - - run: pytest + activate-environment: true + - run: uv pip install cookiecutter pytest pyyaml toml + - run: uv run pytest lint-generated-project: runs-on: ubuntu-latest @@ -44,8 +50,8 @@ jobs: - uses: actions/setup-python@v5 with: python-version: "3.12" - - run: python -m pip install cookiecutter poetry - - run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.6.21 + - run: python -m pip install cookiecutter uv prek + - run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.7.11 - name: Generate project run: | cookiecutter --config-file tests/context.yaml --no-input . @@ -63,6 +69,6 @@ jobs: - name: Lint project run: | cd example-project - poetry install - poetry run pre-commit run -a - poetry run mkdocs build + uv sync + prek run --all-files + uv run mkdocs build diff --git a/.gitignore b/.gitignore index c18dd8d..9cb7b23 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ __pycache__/ + +# Claude Code +.agents/ +.claude/ diff --git a/README.md b/README.md index ca34de7..e8266d7 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ A [cookiecutter](https://cookiecutter.readthedocs.io/en/latest/README.html) (pro * Powered by [mkdocs-material](https://github.com/squidfunk/mkdocs-material) * Auto-generated API documentation from docstrings via [mkdocstrings](https://github.com/mkdocstrings/mkdocstrings) * See the extensive list of [MkDocs plugins](https://github.com/mkdocs/mkdocs/wiki/MkDocs-Plugins) which can help you - to tune the documentation to fit your project's needs + to tune the documentation to fit your project's needs #### Automated releases @@ -42,9 +42,10 @@ A [cookiecutter](https://cookiecutter.readthedocs.io/en/latest/README.html) (pro #### Bells and whistles -* [Poetry](https://python-poetry.org/docs/) for managing dependencies and packaging -* [pre-commit](https://pre-commit.com/) for running all the goodies listed below -* [mypy](https://mypy.readthedocs.io/en/stable/) for static type checking +* [uv](https://docs.astral.sh/uv/) for managing dependencies and packaging +* [hatchling](https://github.com/pypa/hatch) as the build backend +* [prek](https://github.com/j178/prek) for running all the goodies listed below +* [pyrefly](https://pyrefly.org/) for static type checking * [ruff](https://docs.astral.sh/ruff/) for automatic formatting, linting and automatically fixing some linting errors #### Automation diff --git a/cookiecutter.json b/cookiecutter.json index 9ba6450..a1331e3 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -12,7 +12,8 @@ "3.10+", "3.11+", "3.12+", - "3.13+" + "3.13+", + "3.14+" ], "_python_version_specs": { "3.9+": { @@ -21,7 +22,8 @@ "3.10", "3.11", "3.12", - "3.13" + "3.13", + "3.14" ] }, "3.10+": { @@ -29,25 +31,34 @@ "3.10", "3.11", "3.12", - "3.13" + "3.13", + "3.14" ] }, "3.11+": { "versions": [ "3.11", "3.12", - "3.13" + "3.13", + "3.14" ] }, "3.12+": { "versions": [ "3.12", - "3.13" + "3.13", + "3.14" ] }, "3.13+": { "versions": [ - "3.13" + "3.13", + "3.14" + ] + }, + "3.14+": { + "versions": [ + "3.14" ] } }, diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..6c24800 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,29 @@ +[project] +name = "cookiecutter-python-package" +version = "0.1.0" +description = "Cookiecutter template for Python packages" +authors = [{name = "Szymon Cader", email = "szymon.sc.cader@gmail.com"}] +readme = "README.md" +requires-python = ">=3.11" +dependencies = [ + "cookiecutter>=2.2.3", + "pytest>=7.4.0", + "pyyaml>=6.0.1", + "toml>=0.10.2", +] + +[dependency-groups] +dev = [ + "flake8-to-ruff>=0.0.233", + "black>=23.7.0", + "pre-commit>=3.3.3", + "python-redmine>=2.4.0", + "cffi>=1.17.1", +] + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.build.targets.wheel] +packages = ["."] diff --git a/tests/test_project_generation.py b/tests/test_project_generation.py index 8effe19..03345d9 100644 --- a/tests/test_project_generation.py +++ b/tests/test_project_generation.py @@ -1,3 +1,4 @@ +import subprocess from typing import Any import pytest @@ -38,16 +39,27 @@ def test_generate_new_project(tmp_path, generated_project_path): assert generated_project_path == tmp_path / PROJECT_NAME -def test_poetry_uses_dev_group(generated_project_path): +def test_uses_hatchling_build_system(generated_project_path): pyproject_toml_content = generated_project_path.joinpath( "pyproject.toml" ).read_text() - assert "dev-dependencies" not in pyproject_toml_content - assert "[tool.poetry.group.dev.dependencies]" in pyproject_toml_content.splitlines() + assert '[build-system]' in pyproject_toml_content + assert 'hatchling' in pyproject_toml_content + assert 'poetry' not in pyproject_toml_content -def test_python_version_is_correctly_included_in_black_config(generated_project_path): +def test_uses_dependency_groups(generated_project_path): + pyproject_toml_content = generated_project_path.joinpath( + "pyproject.toml" + ).read_text() + + assert '[dependency-groups]' in pyproject_toml_content + assert 'pyrefly' in pyproject_toml_content + assert 'prek' in pyproject_toml_content + + +def test_python_version_is_correctly_included_in_ruff_config(generated_project_path): parsed_pyproject_toml = toml.loads( generated_project_path.joinpath("pyproject.toml").read_text() ) @@ -65,7 +77,7 @@ def test_python_version_is_correctly_included_in_github_workflow( assert parsed_github_workflow["jobs"]["test"]["strategy"]["matrix"][ "python-version" - ] == ["3.9", "3.10", "3.11", "3.12", "3.13"] + ] == ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] def test_specific_files_and_packages_are_not_include_if_package_is_meant_to_be_not_releasable(tmp_path): @@ -77,5 +89,40 @@ def test_specific_files_and_packages_are_not_include_if_package_is_meant_to_be_n parsed_pyproject_toml = toml.loads( project_path.joinpath("pyproject.toml").read_text() ) - assert "python-kacl" not in parsed_pyproject_toml["tool"]["poetry"]["group"]["dev"]["dependencies"] + dev_deps = parsed_pyproject_toml.get("dependency-groups", {}).get("dev", []) + assert "python-kacl" not in dev_deps assert "pypi" not in Path(project_path / "README.md").read_text().lower() + + +def test_dependencies_can_be_installed(generated_project_path): + """Verify that all dependencies in the generated project can be installed with uv sync.""" + result = subprocess.run( + ["uv", "sync"], + cwd=generated_project_path, + capture_output=True, + text=True, + ) + assert result.returncode == 0, f"uv sync failed: {result.stderr}" + + +def test_precommit_hooks_pass(generated_project_path): + """Verify that all pre-commit hooks pass on the generated project.""" + subprocess.run( + ["git", "init"], + cwd=generated_project_path, + capture_output=True, + text=True, + ) + subprocess.run( + ["git", "add", "."], + cwd=generated_project_path, + capture_output=True, + text=True, + ) + result = subprocess.run( + ["uv", "run", "prek", "run", "--all-files"], + cwd=generated_project_path, + capture_output=True, + text=True, + ) + assert result.returncode == 0, f"prek run failed:\nstdout: {result.stdout}\nstderr: {result.stderr}" diff --git a/{{cookiecutter.project_slug}}/.github/actions/python-poetry-env/action.yml b/{{cookiecutter.project_slug}}/.github/actions/python-poetry-env/action.yml deleted file mode 100644 index 2883e78..0000000 --- a/{{cookiecutter.project_slug}}/.github/actions/python-poetry-env/action.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: 'Setup Python + Poetry environment' -description: 'Setup Python + Poetry environment' -{% raw %} -inputs: - python-version: - required: false - description: 'Python version' - default: '3.12' -outputs: {} -runs: - using: 'composite' - steps: - - uses: actions/setup-python@v5 - with: - python-version: ${{inputs.python-version}} - - name: Install poetry - run: python -m pip install poetry - shell: bash - - name: Create virtual environment - run: poetry install - shell: bash{% endraw +%} diff --git a/{{cookiecutter.project_slug}}/.github/workflows/cookiecutter.yml b/{{cookiecutter.project_slug}}/.github/workflows/cookiecutter.yml index ef28db5..9c72837 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/cookiecutter.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/cookiecutter.yml @@ -15,7 +15,7 @@ jobs: python-version: "3.12" - name: Install dependencies - run: python -m pip install cruft poetry jello tabulate + run: python -m pip install cruft jello tabulate prek - name: Update project structure run: | @@ -23,14 +23,20 @@ jobs: - name: Check if there are changes id: changes - run: echo "::set-output name=changed::$(git status --porcelain | wc -l)" + run: echo "changed=$(git status --porcelain | wc -l)" >> "$GITHUB_OUTPUT" - - name: apply additional changes and fixes + - name: Install uv + if: steps.changes.outputs.changed > 0 + uses: astral-sh/setup-uv@v7 + with: + enable-cache: false + + - name: Apply additional changes and fixes if: steps.changes.outputs.changed > 0 run: | - poetry lock --no-update # add new dependencies - poetry install - poetry run pre-commit run -a || true # we have to fix other issues manually + uv lock # add new dependencies + uv sync + prek run --all-files - name: Get template versions id: get_versions @@ -39,8 +45,8 @@ jobs: run: | CURRENT_VERSION=$(git show HEAD:.cruft.json | jello -r "_['commit'][:8]") NEXT_VERSION=$(jello -r "_['commit'][:8]" < .cruft.json) - echo ::set-output name="current_version::$CURRENT_VERSION" - echo ::set-output name="next_version::$NEXT_VERSION" + echo "current_version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT" + echo "next_version=$NEXT_VERSION" >> "$GITHUB_OUTPUT" - name: Get changelog id: get_changelog @@ -60,7 +66,7 @@ jobs: body="${body//'%'/'%25'}" body="${body//$'\n'/'%0A'}" body="${body//$'\r'/'%0D'}" - echo ::set-output name="changelog::$body" + echo "changelog=$body" >> "$GITHUB_OUTPUT" # behaviour if PR already exists: https://github.com/marketplace/actions/create-pull-request#action-behaviour - name: Create Pull Request @@ -68,7 +74,7 @@ jobs: # a PAT is required to be able to update workflows GITHUB_TOKEN: ${{ secrets.AUTO_UPDATE_GITHUB_TOKEN }} if: ${{ steps.changes.outputs.changed > 0 && env.GITHUB_TOKEN != 0 }} - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v6 with: token: ${{ env.GITHUB_TOKEN }} commit-message: >- diff --git a/{{cookiecutter.project_slug}}/.github/workflows/dependencies.yml b/{{cookiecutter.project_slug}}/.github/workflows/dependencies.yml index 38203bd..e6d710d 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/dependencies.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/dependencies.yml @@ -9,7 +9,16 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/python-poetry-env + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + enable-cache: false +{% endraw %} + python-version: "{{ cookiecutter._python_version_specs[cookiecutter.python_version]['versions'][0] }}" +{% raw %} + + - name: Sync project dependencies + run: uv sync - name: Install tabulate run: python -m pip install tabulate @@ -17,15 +26,17 @@ jobs: - name: Gather outdated dependencies id: check_for_outdated_dependencies run: | - body=$(poetry show -o -n) - echo ::set-output name="body::$body" + body=$(uv pip list --outdated --format json --python .venv/bin/python) + if [ "$body" != "[]" ]; then + echo "body=$body" >> "$GITHUB_OUTPUT" + fi - - name: Format PR message + - name: Format PR Message if: ${{ steps.check_for_outdated_dependencies.outputs.body != 0 }} id: get_outdated_dependencies shell: bash run: | - body=$(poetry show -o -n | sed 's/(!)//' | awk 'BEGIN {print "Package","Used","Update"}; {print $1,$2,$3}' | tabulate --header --format github -) + body=$(echo '${{ steps.check_for_outdated_dependencies.outputs.body }}' | jq -r '.[] | "\(.name) \(.version) \(.latest_version)"' | awk 'BEGIN {print "Package","Used","Latest"}; {print $1,$2,$3}' | tabulate --header --format github -) body=$(cat <> "$GITHUB_OUTPUT" - name: Update outdated packages if: ${{ steps.check_for_outdated_dependencies.outputs.body != 0 }} - run: poetry lock + run: uv lock # behaviour if PR already exists: https://github.com/marketplace/actions/create-pull-request#action-behaviour - name: Create Pull Request env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} if: ${{ steps.check_for_outdated_dependencies.outputs.body != 0 }} - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v6 with: token: ${{ env.GITHUB_TOKEN }} commit-message: >- diff --git a/{{cookiecutter.project_slug}}/.github/workflows/draft_release.yml b/{{cookiecutter.project_slug}}/.github/workflows/draft_release.yml index c67ae6e..51c49e5 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/draft_release.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/draft_release.yml @@ -13,21 +13,27 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/python-poetry-env + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + enable-cache: false +{% endraw %} + python-version: "{{ cookiecutter._python_version_specs[cookiecutter.python_version]['versions'][0] }}" +{% raw %} - name: Update version id: updated_version shell: bash run: | - poetry version ${{ github.event.inputs.version }} - version=$(poetry version --short) + uv version ${{ github.event.inputs.version }} + version=$(uv version --short) echo ::set-output name="version::$version" - name: Update changelog id: changelog shell: bash run: | - poetry run kacl-cli release ${{ steps.updated_version.outputs.version }} --modify --auto-link + uv run kacl-cli release ${{ steps.updated_version.outputs.version }} --modify --auto-link echo "" >> CHANGELOG.md - body=$(poetry run kacl-cli get ${{ steps.updated_version.outputs.version }}) + body=$(uv run kacl-cli get ${{ steps.updated_version.outputs.version }}) body="${body//'%'/'%25'}" body="${body//$'\n'/'%0A'}" body="${body//$'\r'/'%0D'}" diff --git a/{{cookiecutter.project_slug}}/.github/workflows/release.yml b/{{cookiecutter.project_slug}}/.github/workflows/release.yml index 8100ddd..aee386f 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/release.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/release.yml @@ -9,10 +9,16 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/python-poetry-env + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + enable-cache: false +{% endraw %} + python-version: "{{ cookiecutter._python_version_specs[cookiecutter.python_version]['versions'][0] }}" +{% raw %} - name: Publish to pypi - run: | - poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} - poetry publish --build --no-interaction + env: + UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }} + run: uv publish --build - name: Deploy docs - run: poetry run mkdocs gh-deploy --force{% endraw +%} + run: uv run mkdocs gh-deploy --force{% endraw +%} diff --git a/{{cookiecutter.project_slug}}/.github/workflows/test.yml b/{{cookiecutter.project_slug}}/.github/workflows/test.yml index 8676966..e9db5cb 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/test.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Download actionlint - run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.6.21 + run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.7.11 shell: bash - name: Check workflow files run: ./actionlint -color @@ -30,9 +30,15 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/python-poetry-env - - run: poetry run pre-commit run --all-files - {%- endraw %} + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + enable-cache: false + python-version: "3.12" + - name: Install prek + run: uv pip install prek + - run: prek run --all-files +{%- endraw %} test: runs-on: ubuntu-latest @@ -42,14 +48,20 @@ jobs: python-version: {{ cookiecutter._python_version_specs[cookiecutter.python_version].versions }} steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/python-poetry-env + - name: Install uv + uses: astral-sh/setup-uv@v7 with: + enable-cache: false python-version: {% raw %}${{ matrix.python-version }}{% endraw +%} - - run: poetry run pytest + - run: uv run pytest docs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/python-poetry-env - - run: poetry run mkdocs build + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + enable-cache: false + python-version: "3.12" + - run: uv run mkdocs build diff --git a/{{cookiecutter.project_slug}}/.gitignore b/{{cookiecutter.project_slug}}/.gitignore index cd7bdfe..4b33e59 100644 --- a/{{cookiecutter.project_slug}}/.gitignore +++ b/{{cookiecutter.project_slug}}/.gitignore @@ -84,3 +84,7 @@ CHANGELOG.md .github/workflows/draft_release.yml .github/workflows/release.yml {% endif %} + +# Claude Code +.agents/ +.claude/ diff --git a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml index a1d1bc3..8d4c937 100644 --- a/{{cookiecutter.project_slug}}/.pre-commit-config.yaml +++ b/{{cookiecutter.project_slug}}/.pre-commit-config.yaml @@ -1,45 +1,79 @@ repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 - hooks: - - id: check-ast - - id: check-added-large-files - - id: check-merge-conflict - - id: check-case-conflict - - id: check-docstring-first - - id: check-json - - id: check-yaml - - id: debug-statements - - id: end-of-file-fixer - - id: trailing-whitespace - - id: mixed-line-ending -- repo: local - hooks: - - id: ruff-format - name: ruff-format - entry: poetry run ruff format - require_serial: true - language: system - types: [ python ] - - id: ruff - name: ruff - # Remove --fix, in case you want it to disable autofix when this hook runs - entry: poetry run ruff check --fix --force-exclude - require_serial: true - language: system - types: [ python ] - - id: mypy - name: mypy - entry: poetry run mypy . - require_serial: true - language: system - types: [python] - pass_filenames: false - {% if cookiecutter.releasable %} - - id: kacl-verify - name: kacl-verify - entry: poetry run kacl-cli verify - language: system - files: 'CHANGELOG.md' - pass_filenames: false - {% endif %} + # Prek builtin hooks (fast Rust implementations) + - repo: builtin + hooks: + # Phase 0-2: File fixers run sequentially + - id: mixed-line-ending + priority: 0 + - id: trailing-whitespace + priority: 1 + - id: end-of-file-fixer + priority: 2 + + # Project-specific hooks + - repo: local + hooks: + # Phase 10: Format code (runs alone, sequentially) + - id: ruff-format + name: ruff-format + entry: uv run ruff format + require_serial: true + language: system + types: [python] + priority: 10 + + # Phase 20: Fix linting issues (runs alone, sequentially) + - id: ruff + name: ruff + entry: uv run ruff check --fix --force-exclude + require_serial: true + language: system + types: [python] + priority: 20 + + # Phase 100: All read-only checks run in parallel + - repo: builtin + hooks: + - id: check-added-large-files + priority: 100 + - id: check-merge-conflict + priority: 100 + - id: check-case-conflict + priority: 100 + - id: check-json + priority: 100 + - id: check-yaml + priority: 100 + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + - id: check-ast + priority: 100 + - id: check-docstring-first + priority: 100 + - id: debug-statements + priority: 100 + + - repo: local + hooks: + - id: pyrefly + name: pyrefly + entry: uv run pyrefly check + require_serial: false + language: system + types: [python] + pass_filenames: false + priority: 100 + +{% if cookiecutter.releasable %} + - repo: local + hooks: + - id: kacl-verify + name: kacl-verify + entry: uv run kacl-cli verify + language: system + files: 'CHANGELOG.md' + pass_filenames: false + priority: 100 +{% endif %} diff --git a/{{cookiecutter.project_slug}}/poetry.toml b/{{cookiecutter.project_slug}}/poetry.toml deleted file mode 100644 index ab1033b..0000000 --- a/{{cookiecutter.project_slug}}/poetry.toml +++ /dev/null @@ -1,2 +0,0 @@ -[virtualenvs] -in-project = true diff --git a/{{cookiecutter.project_slug}}/pyproject.toml b/{{cookiecutter.project_slug}}/pyproject.toml index 11b551a..845d7b3 100644 --- a/{{cookiecutter.project_slug}}/pyproject.toml +++ b/{{cookiecutter.project_slug}}/pyproject.toml @@ -28,29 +28,28 @@ documentation = "https://{{ cookiecutter.github_username }}.github.io/{{ cookiec homepage = "https://{{ cookiecutter.github_username }}.github.io/{{ cookiecutter.project_slug }}" repository = "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}" - -[tool.poetry] -packages = [ - { include = "{{ cookiecutter.package_name }}", from = "src" } -] - -[tool.poetry.group.dev.dependencies] -mkdocstrings = {version = ">=0.23", extras = ["python"]} -mkdocs-material = "*" -mypy = "*" -pre-commit = "*" -pymdown-extensions = "*" -pytest = "*" -pytest-github-actions-annotate-failures = "*" -pytest-cov = "*" +[dependency-groups] +dev = [ + "pyrefly", + "prek", + "pytest", + "pytest-cov", + "ruff", + "mkdocs-material", + "mkdocstrings[python]", + "pymdown-extensions", + "pytest-github-actions-annotate-failures", {% if cookiecutter.releasable %} -python-kacl = "*" + "python-kacl", {% endif %} -ruff = "*" +] [build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.build.targets.wheel] +packages = ["src/{{ cookiecutter.package_name }}"] [tool.ruff] target-version = "py{{ cookiecutter._python_version_specs[cookiecutter.python_version]['versions'][0].replace('.', '') }}" @@ -119,24 +118,4 @@ exclude_lines = [ 'pragma: no cover' ] -[tool.mypy] -# This is the global mypy configuration. -# Avoid changing this! -strict = true # See all the enabled flags `mypy --help | grep -A 10 'Strict mode'` -disallow_any_unimported = true - -# If you need to ignore something for some specific module, -# add overrides for them. Avoid changing the global config! -# For example: -# [[tool.mypy.overrides]] -# module = [ -# "my_unpyted_dependency1.*", -# "my_unpyted_dependency2.*" -# ] -# ignore_missing_imports = true - -# [[tool.mypy.overrides]] -# module = [ -# "tests/my_thing/test_my_thing", -# ] -# disallow_untyped_defs = false +[tool.pyrefly]