Skip to content

Commit b9bb6d6

Browse files
committed
Added project option build_backend
Users can now choose between UV and Hatchling for their build backend. UV is FAST.
1 parent a4d9184 commit b9bb6d6

File tree

2 files changed

+42
-12
lines changed

2 files changed

+42
-12
lines changed

cookiecutter.json

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,27 @@
1313
"python_version_max": "4.0",
1414
"python_version_dev": "{{ cookiecutter._python_versions[-1] }}",
1515
"repository": "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.package_name }}",
16+
"build_backend": [
17+
"uv",
18+
"hatch"
19+
],
1620
"readme_badges": true,
1721
"create_github_repo": true,
1822
"make_github_repo_private": false,
19-
"license": ["apache-2.0", "mit", "agpl-3.0", "bsd-2-clause", "bsd-3-clause", "bsl-1.0", "cc0-1.0", "epl-2.0", "gpl-2.0", "gpl-3.0", "lgpl-2.1", "no-license"],
23+
"license": [
24+
"Apache-2.0",
25+
"MIT",
26+
"AGPL-3.0",
27+
"BSD-2-Clause",
28+
"BSD-3-Clause",
29+
"BSL-1.0",
30+
"CC0-1.0",
31+
"EPL-2.0",
32+
"GPL-2.0",
33+
"GPL-3.0",
34+
"LGPL-2.1",
35+
"no-license"
36+
],
2037
"use_pydantic_settings": true,
2138
"log_to_file": true,
2239
"python_testing_matrix": [
@@ -47,23 +64,29 @@
4764
"python_version_min": "Minimum Python version (inclusive)",
4865
"python_version_max": "Maximum Python version (non-inclusive)",
4966
"python_version_dev": "Python version to use in development",
67+
"build_backend": {
68+
"__prompt__":"Package build backend",
69+
"uv": "UV build backend",
70+
"hatch": "Hatchling, the official PyPA build backend"
71+
},
5072
"repository": "GitHub project URL",
5173
"readme_badges": "Include badges in project README.md",
5274
"create_github_repo": "Create public GitHub repository and sync",
5375
"make_github_repo_private": "Make the GitHub repository private",
5476
"license": {
5577
"__prompt__":"Pick a license for this project",
56-
"apache-2.0": "Apache License 2.0",
57-
"mit": "MIT License",
58-
"agpl-3.0": "GNU Affero General Public License v3.0",
59-
"bsd-2-clause": "BSD 2-Clause 'Simplified' License",
60-
"bsd-3-clause": "BSD 3-Clause 'New' or 'Revised' License",
61-
"bsl-1.0": "Boost Software License 1.0",
62-
"cc0-1.0": "Creative Commons Zero v1.0 Universal",
63-
"epl-2.0": "Eclipse Public License 2.0",
64-
"gpl-2.0": "GNU General Public License v2.0",
65-
"gpl-3.0": "GNU General Public License v3.0",
66-
"lgpl-2.1": "GNU Lesser General Public License v2.1",
78+
79+
"Apache-2.0": "Apache License 2.0",
80+
"MIT": "MIT License",
81+
"AGPL-3.0": "GNU Affero General Public License v3.0",
82+
"BSD-2-Clause": "BSD 2-Clause 'Simplified' License",
83+
"BSD-3-Clause": "BSD 3-Clause 'New' or 'Revised' License",
84+
"BSL-1.0": "Boost Software License 1.0",
85+
"CC0-1.0": "Creative Commons Zero v1.0 Universal",
86+
"EPL-2.0": "Eclipse Public License 2.0",
87+
"GPL-2.0": "GNU General Public License v2.0",
88+
"GPL-3.0": "GNU General Public License v3.0",
89+
"LGPL-2.1": "GNU Lesser General Public License v2.1",
6790
"no-license": "No License"
6891
},
6992
"os_testing_matrix": {

{{ cookiecutter.package_name }}/pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,20 @@ Source = "https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.
3737
[project.scripts]
3838
{{cookiecutter.cli_name}} = "{{ cookiecutter.package_name }}.__main__:cli"
3939

40+
{% if cookiecutter.build_backend == "hatch" -%}
4041
[build-system]
4142
requires = ["hatchling"]
4243
build-backend = "hatchling.build"
4344

4445
[tool.hatch.build.targets.wheel]
4546
packages = ["src/{{ cookiecutter.package_name }}"]
4647

48+
{% elif cookiecutter.build_backend == "uv" -%}
49+
[build-system]
50+
requires = ["uv_build>=0.7.19,<0.8"]
51+
build-backend = "uv_build"
52+
{%- endif %}
53+
4754
[dependency-groups]
4855
dev = [
4956
"mypy",

0 commit comments

Comments
 (0)