Skip to content

Commit b75225d

Browse files
AlgoFoepre-commit-ci[bot]sfmig
authored
Fix license deprecations and align setuptools requirements (#161)
* Fix license deprecations and align setuptools req * Update tests related to license and build config * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Minor license fix in tests * Fix license assertion in tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix license syntax in root pyproject.toml * Fix license syntax in root pyproject.toml * Slight preference for hyphen in dependencies * Assertion more consistent with previous ones * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: sfmig <33267254+sfmig@users.noreply.github.com>
1 parent bb8edb6 commit b75225d

8 files changed

Lines changed: 23 additions & 33 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ tools, including:
1616
- [Pre-commit hooks](https://pre-commit.com/) to maintain code
1717
quality.
1818
- Automatic versioning with
19-
[setuptools_scm](https://setuptools-scm.readthedocs.io/en/latest/).
19+
[setuptools-scm](https://setuptools-scm.readthedocs.io/en/latest/).
2020
- A test setup using [pytest](https://docs.pytest.org/en/7.0.x/).
2121
- Automated formatting, testing, and publishing via [GitHub
2222
Actions](https://github.com/features/actions).

docs/source/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ tools, including:
1717
- [Pre-commit hooks](https://pre-commit.com/) to maintain code
1818
quality.
1919
- Automatic versioning with
20-
[setuptools_scm](https://setuptools-scm.readthedocs.io/en/latest/).
20+
[setuptools-scm](https://setuptools-scm.readthedocs.io/en/latest/).
2121
- A test setup using [pytest](https://docs.pytest.org/en/7.0.x/).
2222
- Automated formatting, testing, and publishing via [GitHub
2323
Actions](https://github.com/features/actions).

docs/source/infrastructure.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ We recommend the use of [semantic versioning](https://semver.org/), which uses a
9494
* MAJOR = breaking change
9595

9696
## Automated versioning
97-
[`setuptools_scm`](https://github.com/pypa/setuptools_scm) can be used to automatically version your package. It has been pre-configured in the `pyproject.toml` file. [`setuptools_scm` will automatically infer the version using git](https://github.com/pypa/setuptools_scm#default-versioning-scheme). To manually set a new semantic version, create a tag and make sure the tag is pushed to GitHub. Make sure you commit any changes you wish to be included in this version. E.g. to bump the version to `1.0.0`:
97+
[`setuptools-scm`](https://github.com/pypa/setuptools_scm) can be used to automatically version your package. It has been pre-configured in the `pyproject.toml` file. [`setuptools-scm` will automatically infer the version using git](https://github.com/pypa/setuptools_scm#default-versioning-scheme). To manually set a new semantic version, create a tag and make sure the tag is pushed to GitHub. Make sure you commit any changes you wish to be included in this version. E.g. to bump the version to `1.0.0`:
9898

9999
```sh
100100
git add .

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ description = "A tool to automatically create a Python project structure ready t
55
readme = "README.md"
66
dynamic = ["version"]
77

8-
license = { text = "BSD-3-Clause" }
8+
license = "BSD-3-Clause"
9+
license-files = ["LICENSE"]
910

1011
[build-system]
1112
requires = [
12-
"setuptools>=64",
13+
"setuptools>=77",
1314
"wheel",
1415
"setuptools-scm[toml]>=8",
1516
]

tests/test_cookiecutter.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,7 @@ def test_pyproject_toml(package_path_config_dict):
228228
assert project_toml["project"]["description"] == "Lets Test CookieCutter"
229229
assert project_toml["project"]["readme"] == "README.md"
230230
assert project_toml["project"]["requires-python"] == ">=3.11.0"
231-
assert (
232-
project_toml["project"]["license"]["text"] == "MIT"
233-
) # parameterize this? test if url not given?
231+
assert project_toml["project"]["license"] == "MIT"
234232

235233
assert project_toml["project"]["classifiers"] == [
236234
"Development Status :: 2 - Pre-Alpha",
@@ -240,7 +238,6 @@ def test_pyproject_toml(package_path_config_dict):
240238
"Programming Language :: Python :: 3.12",
241239
"Programming Language :: Python :: 3.13",
242240
"Operating System :: OS Independent",
243-
"License :: OSI Approved :: MIT License",
244241
]
245242

246243
test_repo_url = (
@@ -276,7 +273,7 @@ def test_pyproject_toml(package_path_config_dict):
276273
]
277274

278275
assert project_toml["build-system"]["requires"] == [
279-
"setuptools>=64",
276+
"setuptools>=77",
280277
"wheel",
281278
"setuptools-scm[toml]>=8",
282279
]
@@ -321,4 +318,4 @@ def test_pip_install(pip_install):
321318
"Author-email: Test Cookiecutter <testing@cookiecutter.com>"
322319
in show_details
323320
)
324-
assert "License: MIT" in show_details
321+
assert "License-Expression: MIT" in show_details

{{cookiecutter.package_name}}/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,5 @@ venv/
7979
# OS
8080
.DS_Store
8181

82-
# written by setuptools_scm
82+
# written by setuptools-scm
8383
**/_version.py

{{cookiecutter.package_name}}/.pre-commit-config.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ repos:
3737
hooks:
3838
- id: check-manifest
3939
args: [--no-build-isolation]
40-
additional_dependencies: [setuptools-scm, wheel]
40+
additional_dependencies:
41+
- setuptools>=77
42+
- wheel
43+
- setuptools-scm[toml]>=8
4144
- repo: https://github.com/codespell-project/codespell
4245
# Configuration for codespell is in pyproject.toml
4346
rev: v2.4.1

{{cookiecutter.package_name}}/pyproject.toml

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,21 @@ dynamic = ["version"]
99
dependencies = []
1010

1111
{% if cookiecutter.license == "MIT" -%}
12-
license = {text = "{{cookiecutter.license}}"}
12+
license = "MIT"
1313
{%- elif cookiecutter.license == "BSD-3" -%}
14-
license = {text = "BSD-3-Clause"}
14+
license = "BSD-3-Clause"
1515
{%- elif cookiecutter.license == "GNU GPL v3.0" -%}
16-
license = {text = "GPL-3.0-only"}
16+
license = "GPL-3.0-only"
1717
{%- elif cookiecutter.license == "GNU LGPL v3.0" -%}
18-
license = {text = "LGPL-3.0-only"}
18+
license = "LGPL-3.0-only"
1919
{%- elif cookiecutter.license == "Apache Software License 2.0" -%}
20-
license = {text = "Apache-2.0"}
20+
license = "Apache-2.0"
2121
{%- elif cookiecutter.license == "Mozilla Public License 2.0" -%}
22-
license = {text = "MPL-2.0"}
22+
license = "MPL-2.0"
2323
{%- endif %}
2424

25+
license-files = ["LICENSE"]
26+
2527
classifiers = [
2628
"Development Status :: 2 - Pre-Alpha",
2729
"Programming Language :: Python",
@@ -30,19 +32,6 @@ classifiers = [
3032
"Programming Language :: Python :: 3.12",
3133
"Programming Language :: Python :: 3.13",
3234
"Operating System :: OS Independent",
33-
{% if cookiecutter.license == "MIT" -%}
34-
"License :: OSI Approved :: MIT License",
35-
{%- elif cookiecutter.license == "BSD-3" -%}
36-
"License :: OSI Approved :: BSD License",
37-
{%- elif cookiecutter.license == "GNU GPL v3.0" -%}
38-
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
39-
{%- elif cookiecutter.license == "GNU LGPL v3.0" -%}
40-
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
41-
{%- elif cookiecutter.license == "Apache Software License 2.0" -%}
42-
"License :: OSI Approved :: Apache Software License",
43-
{%- elif cookiecutter.license == "Mozilla Public License 2.0" -%}
44-
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
45-
{%- endif %}
4635
]
4736

4837
{% if cookiecutter.github_repository_url != 'provide later' -%}
@@ -72,7 +61,7 @@ dev = [
7261

7362
[build-system]
7463
requires = [
75-
"setuptools>=64",
64+
"setuptools>=77",
7665
"wheel",
7766
"setuptools-scm[toml]>=8",
7867
]

0 commit comments

Comments
 (0)