-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpyproject.toml
More file actions
165 lines (127 loc) · 4.68 KB
/
pyproject.toml
File metadata and controls
165 lines (127 loc) · 4.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
[project]
name = "python-package-cookiecutter"
version = "2.0.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.13"
dependencies = []
[dependency-groups]
dev = [
"cookiecutter>=2.6.0",
"git-cliff>=2.0.0",
"poethepoet>=0.35.0",
"pytest>=8.4.0",
"ruff>=0.11.13",
"sphinx>=8.2.3",
"toml-cli",
]
docs = [
"mkdocs>=1.6.1",
"mkdocs-material>=9.5.0",
"pymdown-extensions>=10.0.0",
]
[tool.poe.tasks]
test.cmd = "pytest"
test.help = "Test cookiecutter package."
test_fast.cmd = "pytest -m 'not slow and not integration and not cross_platform' --ignore=tests/test_configuration_matrix.py --ignore=tests/test_generate_projects.py tests/"
test_fast.help = "Run fast subset of tests for release validation."
ruff_check.cmd = "ruff check hooks tests"
ruff_check.help = "ruff check on hooks and tests."
ruff_format.cmd = "ruff format hooks tests"
ruff_format.help = "Ruff format hooks and tests."
ruff_check_template.cmd = "ruff --isolated check '{{ cookiecutter.package_name }}'/src '{{ cookiecutter.package_name }}'/tests"
ruff_check_template.help = "Ruff check template src and tests."
ruff_format_template.cmd = "ruff --isolated format '{{ cookiecutter.package_name }}'/src '{{ cookiecutter.package_name }}'/tests"
ruff_format_template.help = "Ruff format template src and tests."
ruff.sequence = [ "ruff_check", "ruff_check_template", "ruff_format", "ruff_format_template" ]
ruff.help = "Run ruff check and format on all code."
# Release tasks
_patch_bump = "uv version --bump patch"
_minor_bump = "uv version --bump minor"
_major_bump = "uv version --bump major"
_add = "git add pyproject.toml uv.lock"
_commit = {shell = "git commit -m v`uv version --short`"}
_tag = {shell = "git tag v`uv version --short`"}
_push = "git push --all"
_push_tags = "git push --tags"
_update_pyproject = ["_add", "_commit", "_tag", "_push_tags", "_push"]
# Release management tasks
changelog.cmd = "git cliff"
changelog.help = "[Release] Generate full changelog to stdout."
release_notes.cmd = "git cliff --latest --strip header"
release_notes.help = "[Release] Generate release notes for the latest tag."
_preflight.shell = """
if [ "$(git branch --show-current)" != "main" ]; then
echo "ERROR: release must run from main branch" >&2
exit 1
fi
if [ -n "$(git status --porcelain)" ]; then
echo "ERROR: working tree is dirty" >&2
exit 1
fi
"""
_preflight.help = "Verify on main branch with clean working tree."
release_patch.sequence = [ "_preflight", "_patch_bump", "_update_pyproject"]
release_patch.help = "Publish patch release."
release_minor.sequence = [ "_preflight", "_minor_bump", "_update_pyproject"]
release_minor.help = "Publish minor release."
release_major.sequence = [ "_preflight", "_major_bump", "_update_pyproject"]
release_major.help = "Publish major release."
release.ref = "release_patch"
release.help = "Publish patch release"
# Create a project with the template for local testing in tmp/thing.
_tmpdir = "mkdir -p tmp"
_generate = "cookiecutter --no-input -o tmp --overwrite-if-exists ."
bake.sequence = [ "_tmpdir", "_generate" ]
bake.help = "Create a project in ./tmp"
# Cleanup tasks
_remove_tmp = "rm -rf tmp"
_remove_gh_repo = "gh repo delete thing --yes"
clean.sequence = ["_remove_tmp", "_remove_gh_repo" ]
clean.help = "Cleanup project."
# Documentation tasks
docs-serve.cmd = "mkdocs serve"
docs-serve.help = "[Docs] Serve docs locally for development."
docs-build.cmd = "mkdocs build"
docs-build.help = "[Docs] Build docs for production."
docs-deploy.cmd = "mkdocs gh-deploy --force"
docs-deploy.help = "[Docs] Deploy docs to GitHub Pages."
# Misc
tree.cmd = "tree . -a -I .venv -I .git -I .ruff_cache -I .pytest_cache"
tree.help = "[Misc] List project files in tree format."
[tool.ruff]
fix = true
lint.select = [ "ALL" ]
lint.ignore = [
# incorrect-blank-line-before-class (D203)
"D203",
# blank-line-before-class (D211)
"D211",
# multi-line-summary-first-line (D212)
"D212",
# multi-line-summary-second-line (D213)
"D213",
# missing-trailing-comma (COM812)
"COM812",
# blind-except (BLE001)
"BLE001"
]
[tool.ruff.lint.per-file-ignores]
"tests/*" = [
# assert (S101)
"S101",
# subprocess-without-shell-equals-true (S603)
"S603"
]
[tool.pytest.ini_options]
# Narrow to just tests to avoid finding {{ cookiecutter.package_name }}/tests
# which fail when executed in-place.
testpaths = [ "tests" ]
markers = [
"integration: marks tests as integration tests (may be slow)",
"performance: marks tests as performance tests",
"slow: marks tests as slow running tests",
"cross_platform: marks tests that validate cross-platform compatibility",
]
[tool.python-package-cookiecutter.ci]
test-python-versions = ["3.13"]