diff --git a/project/.github/workflows/ci.yml.jinja b/project/.github/workflows/ci.yml.jinja index e186e40b..e4700c10 100644 --- a/project/.github/workflows/ci.yml.jinja +++ b/project/.github/workflows/ci.yml.jinja @@ -48,44 +48,27 @@ jobs: steps: - uses: actions/checkout@v4{% endraw %} {%- if is_django_package %}{% raw %} - - name: Install poetry with export plugin - run: | - pipx install poetry - pipx inject poetry poetry-plugin-export - poetry config warnings.export false - - name: Poetry export dev deps - run: poetry export --without-hashes --only=dev --format=requirements.txt --output=requirements-dev.txt - shell: bash - - name: Set up Python - uses: actions/setup-python@v5 + - uses: actions/setup-python@v5 with: - cache: pip python-version: ${{ matrix.python-version }} - - name: Install test dependencies - run: pip install tox + - uses: astral-sh/setup-uv@v5 + - run: uv pip install --system tox tox-uv shell: bash - - name: Run tests - run: tox -f py$(echo ${{ matrix.python-version }} | tr -d .) + - run: tox -f py$(echo ${{ matrix.python-version }} | tr -d .) shell: bash {% endraw %} {%- else %}{% raw %} - - name: Install poetry - run: pipx install poetry - - name: Set up Python - uses: actions/setup-python@v5 + - uses: actions/setup-python@v5 id: setup-python with: python-version: ${{ matrix.python-version }} - cache: poetry - - name: Install Dependencies - run: poetry install + - uses: astral-sh/setup-uv@v5 + - run: uv sync --no-python-downloads shell: bash - - name: Test with Pytest - run: poetry run pytest + - run: uv run pytest shell: bash{% endraw %} {%- endif %}{% raw %} - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 + - uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} @@ -119,6 +102,7 @@ jobs: if: github.ref_name != 'main' with: root_options: --noop + github_token: noop # On main branch: actual PSR + upload to PyPI & GitHub - name: Release diff --git a/project/.github/workflows/poetry-upgrade.yml.jinja b/project/.github/workflows/upgrader.yml.jinja similarity index 76% rename from project/.github/workflows/poetry-upgrade.yml.jinja rename to project/.github/workflows/upgrader.yml.jinja index 833de5ab..92e53f03 100644 --- a/project/.github/workflows/poetry-upgrade.yml.jinja +++ b/project/.github/workflows/upgrader.yml.jinja @@ -7,6 +7,6 @@ on: jobs: upgrade: - uses: browniebroke/github-actions/.github/workflows/poetry-upgrade.yml@v1 + uses: browniebroke/github-actions/.github/workflows/uv-upgrade.yml@v1 secrets: gh_pat: {% raw %}${{ secrets.GH_PAT }}{% endraw %} diff --git a/project/.gitpod.yml b/project/.gitpod.yml index 450add9c..44344a59 100644 --- a/project/.gitpod.yml +++ b/project/.gitpod.yml @@ -1,7 +1,7 @@ tasks: - command: | - pip install poetry - PIP_USER=false poetry install + pip install uv + PIP_USER=false uv sync - command: | pip install pre-commit pre-commit install diff --git a/project/.pre-commit-config.yaml b/project/.pre-commit-config.yaml index 3fd4d329..e68f1d0f 100644 --- a/project/.pre-commit-config.yaml +++ b/project/.pre-commit-config.yaml @@ -1,7 +1,7 @@ # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks exclude: "CHANGELOG.md|.copier-answers.yml|.all-contributorsrc|project" -default_stages: [commit] +default_stages: [pre-commit] ci: autofix_commit_msg: "chore(pre-commit.ci): auto fixes" @@ -31,10 +31,10 @@ repos: rev: "v2.5.0" hooks: - id: pyproject-fmt - - repo: https://github.com/python-poetry/poetry - rev: 1.8.5 + - repo: https://github.com/astral-sh/uv-pre-commit + rev: 0.5.11 hooks: - - id: poetry-check + - id: uv-lock - repo: https://github.com/pre-commit/mirrors-prettier rev: v3.1.0 hooks: diff --git a/project/.readthedocs.yml b/project/.readthedocs.yml index 07fdc544..6f6667d5 100644 --- a/project/.readthedocs.yml +++ b/project/.readthedocs.yml @@ -9,13 +9,12 @@ build: os: ubuntu-22.04 tools: python: "3.12" - jobs: - post_create_environment: - # Install poetry - - python -m pip install poetry - post_install: - # Install dependencies, reusing RTD virtualenv - - VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs + commands: + - asdf plugin add uv + - asdf install uv latest + - asdf global uv latest + - uv sync --only-group docs --frozen + - uv run -m sphinx -T -b html -d docs/_build/doctrees -D language=en docs $READTHEDOCS_OUTPUT/html # Build documentation in the docs directory with Sphinx sphinx: diff --git a/project/CONTRIBUTING.md.jinja b/project/CONTRIBUTING.md.jinja index 6493a06d..b8c6bbb8 100644 --- a/project/CONTRIBUTING.md.jinja +++ b/project/CONTRIBUTING.md.jinja @@ -46,10 +46,10 @@ Ready to contribute? Here's how to set yourself up for local development. $ git clone git@github.com:your_name_here/{{ project_slug }}.git ``` -3. Install the project dependencies with [Poetry](https://python-poetry.org): +3. Install the project dependencies with [uv](https://docs.astral.sh/uv/): ```shell - $ poetry install + $ uv sync ``` 4. Create a branch for local development: @@ -63,7 +63,7 @@ Ready to contribute? Here's how to set yourself up for local development. 5. When you're done making changes, check that your changes pass our tests: ```shell - $ poetry run pytest + $ uv run pytest ``` 6. Linting is done through [pre-commit](https://pre-commit.com). Provided you have the tool installed globally, you can run them all as one-off: diff --git a/project/README.md.jinja b/project/README.md.jinja index 1da3866c..de3d9c28 100644 --- a/project/README.md.jinja +++ b/project/README.md.jinja @@ -14,8 +14,8 @@

- - Poetry + + uv Ruff diff --git a/project/pyproject.toml.jinja b/project/pyproject.toml.jinja index 2d0c1639..73b9446b 100644 --- a/project/pyproject.toml.jinja +++ b/project/pyproject.toml.jinja @@ -1,18 +1,17 @@ [build-system] -build-backend = "poetry.core.masonry.api" -requires = [ "poetry-core>=1.0.0" ] +build-backend = "setuptools.build_meta" +requires = [ "setuptools" ] -[tool.poetry] +[project] name = "{{ project_slug }}" version = "0.0.0" description = "{{ project_short_description }}" -authors = [ "{{ full_name }} <{{ email }}>" ] -license = "{{ open_source_license }}" readme = "README.md" -repository = "https://github.com/{{ github_username }}/{{ project_slug }}" -{%- if documentation %} -documentation = "https://{{ project_slug }}.readthedocs.io" -{%- endif %} +license = { text = "{{ open_source_license }}" } +authors = [ + { name = "{{ full_name }}", email = "{{ email }}" }, +] +requires-python = ">=3.9" classifiers = [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", @@ -24,47 +23,48 @@ classifiers = [ "Framework :: Django :: 5.0", "Framework :: Django :: 5.1", {%- endif %} + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Software Development :: Libraries", ] -packages = [ - { include = "{{ package_name }}", from = "src" }, -] -[tool.poetry.urls] -"Bug Tracker" = "https://github.com/{{ github_username }}/{{ project_slug }}/issues" -"Changelog" = "https://github.com/{{ github_username }}/{{ project_slug }}/blob/main/CHANGELOG.md" +dependencies = [ + {%- if is_django_package %} + "django>=4.2", + {%- endif %} + {%- if has_cli %} + "rich>=10", + "typer>=0.15,<1", + {%- endif %} +] +urls."Bug Tracker" = "https://github.com/{{ github_username }}/{{ project_slug }}/issues" +urls.Changelog = "https://github.com/{{ github_username }}/{{ project_slug }}/blob/main/CHANGELOG.md" +{%- if documentation %} +urls.documentation = "https://{{ project_slug }}.readthedocs.io" +{%- endif %} +urls.repository = "https://github.com/{{ github_username }}/{{ project_slug }}" {%- if has_cli %} - -[tool.poetry.scripts] -{{ cli_name }} = "{{ package_name }}.cli:app" +scripts.{{ cli_name }} = "{{ package_name }}.cli:app" {%- endif %} -[tool.poetry.dependencies] -python = "^3.9" -{%- if is_django_package %} -django = ">=4.2" -{%- endif %} -{%- if has_cli %} -rich = ">=10" -typer = { extras = [ "all" ], version = "^0.9.0" } -{%- endif %} - -[tool.poetry.group.dev.dependencies] -pytest = "^8.0.0" -pytest-cov = "^5.0.0" +[dependency-groups] +dev = [ + "pytest>=8,<9", + "pytest-cov>=6,<7", {%- if is_django_package %} -pytest-django = "^4.5" + "pytest-django>=4.5,<5", {%- endif %} +] {%- if documentation %} - -[tool.poetry.group.docs] -optional = true - -[tool.poetry.group.docs.dependencies] -myst-parser = { version = ">=0.16", python = ">=3.11" } -sphinx = { version = ">=4.0", python = ">=3.11" } -furo = { version = ">=2023.5.20", python = ">=3.11" } -sphinx-autobuild = { version = ">=2024.0.0", python = ">=3.11" } +docs = [ + "furo>=2023.5.20; python_version>='3.11'", + "myst-parser>=0.16; python_version>='3.11'", + "sphinx>=4; python_version>='3.11'", + "sphinx-autobuild>=2024,<2025; python_version>='3.11'", +] {%- endif %} [tool.ruff] @@ -161,14 +161,19 @@ ignore_errors = true {%- endif %} [tool.semantic_release] -version_toml = [ "pyproject.toml:tool.poetry.version" ] +version_toml = [ "pyproject.toml:project.version" ] version_variables = [ "src/{{ package_name }}/__init__.py:__version__", {%- if documentation %} "docs/conf.py:release", {%- endif %} ] -build_command = "pip install poetry && poetry build" +build_command = """ +pip install uv +uv lock +git add uv.lock +uv build +""" [tool.semantic_release.changelog] exclude_commit_patterns = [ diff --git a/project/{% if is_django_package %}tox.ini{% endif %}.jinja b/project/{% if is_django_package %}tox.ini{% endif %}.jinja index 7f38018b..ad220408 100644 --- a/project/{% if is_django_package %}tox.ini{% endif %}.jinja +++ b/project/{% if is_django_package %}tox.ini{% endif %}.jinja @@ -11,11 +11,9 @@ env_list = [testenv] set_env = PYTHONDONTWRITEBYTECODE=1 +dependency_groups = + dev deps = - # Dev dependencies only, generated from Poetry deps with: - # poetry export --without-hashes --only=dev --format=requirements.txt --output=requirements-dev.txt - -r requirements-dev.txt - # All supported Django versions django51: Django>=5.1,<5.2 django50: Django>=5.0,<5.1 django42: Django>=4.2,<5.0