Skip to content

Commit 851bee6

Browse files
authored
Update template. (#52)
1 parent a5c6937 commit 851bee6

File tree

12 files changed

+138
-238
lines changed

12 files changed

+138
-238
lines changed

.github/workflows/main.yml

+17-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,21 @@ on:
1515

1616
jobs:
1717

18+
run-type-checking:
19+
20+
name: Run tests for type-checking
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: actions/setup-python@v5
26+
with:
27+
python-version-file: .python-version
28+
allow-prereleases: true
29+
cache: pip
30+
- run: pip install tox-uv
31+
- run: tox -e typing
32+
1833
run-tests:
1934

2035
name: Run tests for ${{ matrix.os }} on ${{ matrix.python-version }}
@@ -24,7 +39,7 @@ jobs:
2439
fail-fast: false
2540
matrix:
2641
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
27-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
42+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
2843

2944
steps:
3045
- uses: actions/checkout@v4
@@ -35,7 +50,7 @@ jobs:
3550
allow-prereleases: true
3651
- uses: prefix-dev/[email protected]
3752
with:
38-
pixi-version: v0.22.0
53+
pixi-version: v0.39.4
3954
run-install: false
4055

4156
- run: pip install tox-uv

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,4 @@ dist
151151

152152
.ruff_cache
153153
.mypy_cache
154+
uv.lock

.pre-commit-config.yaml

+15-21
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
ci:
2+
skip: [typing]
3+
14
exclude: |
25
(?x)^(
36
{{cookiecutter.project_slug}}/tests/test_import.py
@@ -15,7 +18,6 @@ repos:
1518
- id: check-yaml
1619
exclude: |
1720
(?x)^(
18-
{{cookiecutter.project_slug}}/environment.yml|
1921
{{cookiecutter.project_slug}}/.pre-commit-config.yaml
2022
)$
2123
- id: debug-statements
@@ -34,10 +36,6 @@ repos:
3436
- id: python-no-log-warn
3537
- id: python-use-type-annotations
3638
- id: text-unicode-replacement-char
37-
- repo: https://github.com/aio-libs/sort-all
38-
rev: v1.3.0
39-
hooks:
40-
- id: sort-all
4139
- repo: https://github.com/astral-sh/ruff-pre-commit
4240
rev: v0.8.4
4341
hooks:
@@ -46,18 +44,13 @@ repos:
4644
pass_filenames: false
4745
- id: ruff-format
4846
args: [--config, pyproject.toml]
49-
- repo: https://github.com/dosisod/refurb
50-
rev: v2.0.0
51-
hooks:
52-
- id: refurb
53-
exclude: ({{cookiecutter.project_slug}})
5447
- repo: https://github.com/executablebooks/mdformat
5548
rev: 0.7.21
5649
hooks:
5750
- id: mdformat
5851
additional_dependencies: [
5952
mdformat-gfm,
60-
mdformat-black,
53+
mdformat-ruff,
6154
]
6255
args: [--wrap, "88"]
6356
files: (README\.md)
@@ -71,22 +64,23 @@ repos:
7164
- id: mdformat
7265
additional_dependencies: [
7366
mdformat-myst,
74-
mdformat-black,
67+
mdformat-ruff,
7568
]
7669
args: [--wrap, "88"]
7770
files: (docs/.)
78-
- repo: https://github.com/codespell-project/codespell
79-
rev: v2.3.0
80-
hooks:
81-
- id: codespell
82-
additional_dependencies: [tomli]
83-
- repo: https://github.com/pre-commit/mirrors-mypy
84-
rev: 'v1.14.0'
71+
- repo: https://github.com/crate-ci/typos
72+
rev: v1.28.4
8573
hooks:
86-
- id: mypy
87-
pass_filenames: false
74+
- id: typos
8875
- repo: meta
8976
hooks:
9077
- id: check-hooks-apply
9178
- id: check-useless-excludes
9279
# - id: identity # Prints all files passed to pre-commits. Debugging.
80+
- repo: local
81+
hooks:
82+
- id: typing
83+
name: typing
84+
language: system
85+
entry: uv run tox -e typing
86+
pass_filenames: false

cookiecutter.json

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"python_version": "3.10",
1010
"add_tox": ["yes", "no"],
1111
"add_github_actions": ["yes", "no"],
12-
"add_mypy": ["yes", "no"],
1312
"add_readthedocs": ["yes", "no"],
1413
"open_source_license": [
1514
"MIT",

docs/source/changes.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
This is a record of all past cookiecutter-pytask-project releases and what went into
44
them in reverse chronological order.
55

6-
## 1.7.0 - 2024-xx-xx
6+
## 1.8.0 - 2024-12-24
7+
8+
- {pull}`52` updates the template in many different ways. Better pre-commit hooks,
9+
better integration with pixi, mypy is not optional anymore, etc..
10+
11+
## 1.7.0 - 2024-05-03
712

813
- {pull}`39` updates the pre-commit hooks.
914
- {pull}`41` updates the infrastructure.

hooks/pre_gen_project.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
MODULE_REGEX = r"^[_a-zA-Z][_a-zA-Z0-9]*$"
66
ENVIRON_REGEX = r"^[-_a-zA-Z0-9]*$"
77
PYTHONVERSION_REGEX = r"^(3\.(1[0-9]|[8-9])(\.[0-9]{1,2})?)$"
8-
PYTHONVERSION_MIN = "3.8"
8+
PYTHONVERSION_MIN = "3.9"
99

1010
EXCEPTION_MSG_MODULE_NAME = """
1111
ERROR: The project slug ({module_name}) is not a valid Python module name.

pyproject.toml

+6-9
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@ classifiers = [
1515
"Topic :: Scientific/Engineering",
1616
"Topic :: Software Development :: Build Tools",
1717
]
18-
requires-python = ">=3.8"
18+
requires-python = ">=3.9"
1919
dependencies = ["cookiecutter"]
2020

2121
[[project.authors]]
2222
name = "Tobias Raabe"
2323
2424

25+
[tool.uv]
26+
dev-dependencies = ["tox-uv>=1.7.0"]
27+
2528
[project.optional-dependencies]
2629
docs = [
2730
"furo",
@@ -36,6 +39,7 @@ docs = [
3639
"sphinxext-opengraph",
3740
]
3841
test = ["pytest", "pytest-cookies", "pytest-cov"]
42+
typing = ["mypy"]
3943

4044
[project.readme]
4145
file = "README.md"
@@ -51,13 +55,6 @@ Documentation = "https://cookiecutter-pytask-project.readthedocs.io/en/latest"
5155
Github = "https://github.com/pytask-dev/cookiecutter-pytask-project"
5256
Tracker = "https://github.com/pytask-dev/cookiecutter-pytask-project/issues"
5357

54-
[tool.rye]
55-
managed = true
56-
virtual = true
57-
dev-dependencies = [
58-
"tox-uv>=1.8.2",
59-
]
60-
6158
[tool.mypy]
6259
files = ["hooks", "tests"]
6360
exclude = "{{cookiecutter.project_slug}}"
@@ -75,7 +72,7 @@ disallow_untyped_defs = false
7572
ignore_errors = true
7673

7774
[tool.ruff]
78-
target-version = "py38"
75+
target-version = "py39"
7976
fix = true
8077
unsafe-fixes = true
8178

requirements-dev.lock

-80
This file was deleted.

requirements.lock

-52
This file was deleted.

{{cookiecutter.project_slug}}/.github/workflows/main.yml

+15-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@ on:
1515

1616
jobs:
1717

18+
run-type-checking:
19+
20+
name: Run tests for type-checking
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: prefix-dev/[email protected]
26+
with:
27+
pixi-version: v0.39.4
28+
cache: true
29+
- run: pixi run typing
30+
1831
run-tests:
1932

2033
name: Run tests for ${{ matrix.os }} on ${{ matrix.python-version }}
@@ -28,9 +41,9 @@ jobs:
2841

2942
steps:
3043
- uses: actions/checkout@v4
31-
- uses: prefix-dev/setup-pixi@v0.7.0
44+
- uses: prefix-dev/setup-pixi@v0.8.1
3245
with:
33-
pixi-version: v0.22.0
46+
pixi-version: v0.39.4
3447
cache: true
3548

3649
- name: Run tests and doctests.

0 commit comments

Comments
 (0)