Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
python-version: ['3.11', '3.12', '3.13', '3.14']

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
Expand Down
8 changes: 0 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ repos:
- id: python-no-log-warn
- id: python-use-type-annotations
- id: text-unicode-replacement-char
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v3.2.0
hooks:
- id: setup-cfg-fmt
exclude: |
(?x)^(
{{cookiecutter.package_name}}/setup.cfg
)$
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.16.10
hooks:
Expand Down
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
This is a record of all past cookiecutter-pytask-plugin releases and what went into them
in reverse chronological order.

## Unreleased

- {pull}`59` migrates generated plugin metadata to `pyproject.toml`, removes redundant
`setup.cfg` files, and provides an importable plugin hook module. Generated plugins
use `uv_build` and a static initial version of `0.1.0` instead of SCM versioning.
- {pull}`59` requires Python 3.11 or newer for the template and generated projects.

## 1.1.0 - 2023-01-06

- {pull}`2` fixes the readme.
Expand Down
2 changes: 1 addition & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"package_description": "A pytask plugin for ...",
"github_username": "{{ cookiecutter.author.lower().replace(' ', '') }}",
"github_email": "{{ cookiecutter.email }}",
"python_version": "3.10",
"python_version": "3.11",
"add_github_actions": ["yes", "no"],
"add_readthedocs": ["yes", "no"],
"add_codecov": ["yes", "no"],
Expand Down
4 changes: 2 additions & 2 deletions hooks/pre_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import re

MODULE_REGEX = r"^[_a-zA-Z][_a-zA-Z0-9]*$"
PYTHONVERSION_REGEX = r"^(3\.(1[0-9]|[2-9][0-9])(\.[0-9]{1,2})?)$"
PYTHONVERSION_MIN = "3.10"
PYTHONVERSION_REGEX = r"^(3\.(1[1-9]|[2-9][0-9])(\.[0-9]{1,2})?)$"
PYTHONVERSION_MIN = "3.11"

EXCEPTION_MSG_MODULE_NAME = """
ERROR: The project slug ({module_name}) is not a valid Python module name.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
name = "cookiecutter_pytask_plugin"
version = "1.0.0"
description = "A minimal template for plugins for pytask."
requires-python = ">=3.10"
requires-python = ">=3.11"
dependencies = ["cookiecutter"]
classifiers = [
"Development Status :: 3 - Alpha",
Expand Down
29 changes: 0 additions & 29 deletions setup.cfg

This file was deleted.

58 changes: 58 additions & 0 deletions tests/test_cookie.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

import shutil
import subprocess
import sys

import pytest
Expand Down Expand Up @@ -61,3 +63,59 @@ def test_remove_license(cookies):
assert result.exception is None

assert not license_.exists()


@pytest.mark.end_to_end
@pytest.mark.parametrize("license_name", ["MIT", "Not open source"])
def test_install_generated_plugin(cookies, tmp_path, license_name):
uv = shutil.which("uv")
assert uv is not None
result = cookies.bake(
extra_context={
"package_name": "pytask-template-check",
"open_source_license": license_name,
}
)
assert result.exit_code == 0
project_path = tmp_path / "project"
shutil.copytree(
result.project_path, project_path, ignore=shutil.ignore_patterns(".git")
)
wheel_dir = tmp_path / "dist"
subprocess.run( # noqa: S603
(uv, "build", "--wheel", "--out-dir", str(wheel_dir)),
cwd=project_path,
check=True,
)
wheel = next(wheel_dir.glob("*.whl"))
source = """
from importlib import metadata
from pytask import cli
from click.testing import CliRunner
import pytask_template_check

entry_point, = metadata.entry_points(
group="pytask", name="pytask_template_check"
)
assert entry_point.load().__name__ == "pytask_template_check.plugin"
assert metadata.version("pytask-template-check") == "0.1.0"
assert pytask_template_check.__version__ == metadata.version("pytask-template-check")
assert CliRunner().invoke(cli, ["--help"]).exit_code == 0
"""
subprocess.run( # noqa: S603
(
uv,
"run",
"--no-project",
"--isolated",
"--python",
sys.executable,
"--with",
str(wheel),
"python",
"-c",
source,
),
cwd=project_path,
check=True,
)
Loading
Loading