diff --git a/README.md b/README.md index d9a6eda..424429b 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ tools, including: - [Pre-commit hooks](https://pre-commit.com/) to maintain code quality. - Automatic versioning with - [setuptools_scm](https://setuptools-scm.readthedocs.io/en/latest/). + [setuptools-scm](https://setuptools-scm.readthedocs.io/en/latest/). - A test setup using [pytest](https://docs.pytest.org/en/7.0.x/). - Automated formatting, testing, and publishing via [GitHub Actions](https://github.com/features/actions). diff --git a/docs/source/index.md b/docs/source/index.md index 2b50b5c..38a981d 100644 --- a/docs/source/index.md +++ b/docs/source/index.md @@ -17,7 +17,7 @@ tools, including: - [Pre-commit hooks](https://pre-commit.com/) to maintain code quality. - Automatic versioning with - [setuptools_scm](https://setuptools-scm.readthedocs.io/en/latest/). + [setuptools-scm](https://setuptools-scm.readthedocs.io/en/latest/). - A test setup using [pytest](https://docs.pytest.org/en/7.0.x/). - Automated formatting, testing, and publishing via [GitHub Actions](https://github.com/features/actions). diff --git a/docs/source/infrastructure.md b/docs/source/infrastructure.md index 6e3b8f6..620baa1 100644 --- a/docs/source/infrastructure.md +++ b/docs/source/infrastructure.md @@ -94,7 +94,7 @@ We recommend the use of [semantic versioning](https://semver.org/), which uses a * MAJOR = breaking change ## Automated versioning -[`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`: +[`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`: ```sh git add . diff --git a/pyproject.toml b/pyproject.toml index dcbc0d6..cae9935 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,11 +5,12 @@ description = "A tool to automatically create a Python project structure ready t readme = "README.md" dynamic = ["version"] -license = { text = "BSD-3-Clause" } +license = "BSD-3-Clause" +license-files = ["LICENSE"] [build-system] requires = [ - "setuptools>=64", + "setuptools>=77", "wheel", "setuptools-scm[toml]>=8", ] diff --git a/tests/test_cookiecutter.py b/tests/test_cookiecutter.py index a0fc366..d97b280 100644 --- a/tests/test_cookiecutter.py +++ b/tests/test_cookiecutter.py @@ -228,9 +228,7 @@ def test_pyproject_toml(package_path_config_dict): assert project_toml["project"]["description"] == "Lets Test CookieCutter" assert project_toml["project"]["readme"] == "README.md" assert project_toml["project"]["requires-python"] == ">=3.11.0" - assert ( - project_toml["project"]["license"]["text"] == "MIT" - ) # parameterize this? test if url not given? + assert project_toml["project"]["license"] == "MIT" assert project_toml["project"]["classifiers"] == [ "Development Status :: 2 - Pre-Alpha", @@ -240,7 +238,6 @@ def test_pyproject_toml(package_path_config_dict): "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Operating System :: OS Independent", - "License :: OSI Approved :: MIT License", ] test_repo_url = ( @@ -276,7 +273,7 @@ def test_pyproject_toml(package_path_config_dict): ] assert project_toml["build-system"]["requires"] == [ - "setuptools>=64", + "setuptools>=77", "wheel", "setuptools-scm[toml]>=8", ] @@ -321,4 +318,4 @@ def test_pip_install(pip_install): "Author-email: Test Cookiecutter " in show_details ) - assert "License: MIT" in show_details + assert "License-Expression: MIT" in show_details diff --git a/{{cookiecutter.package_name}}/.gitignore b/{{cookiecutter.package_name}}/.gitignore index aedc8d7..0cbf68d 100644 --- a/{{cookiecutter.package_name}}/.gitignore +++ b/{{cookiecutter.package_name}}/.gitignore @@ -79,5 +79,5 @@ venv/ # OS .DS_Store -# written by setuptools_scm +# written by setuptools-scm **/_version.py diff --git a/{{cookiecutter.package_name}}/.pre-commit-config.yaml b/{{cookiecutter.package_name}}/.pre-commit-config.yaml index 204c93e..1daa333 100644 --- a/{{cookiecutter.package_name}}/.pre-commit-config.yaml +++ b/{{cookiecutter.package_name}}/.pre-commit-config.yaml @@ -37,7 +37,10 @@ repos: hooks: - id: check-manifest args: [--no-build-isolation] - additional_dependencies: [setuptools-scm, wheel] + additional_dependencies: + - setuptools>=77 + - wheel + - setuptools-scm[toml]>=8 - repo: https://github.com/codespell-project/codespell # Configuration for codespell is in pyproject.toml rev: v2.4.1 diff --git a/{{cookiecutter.package_name}}/pyproject.toml b/{{cookiecutter.package_name}}/pyproject.toml index 2696c21..fc25ced 100644 --- a/{{cookiecutter.package_name}}/pyproject.toml +++ b/{{cookiecutter.package_name}}/pyproject.toml @@ -9,19 +9,21 @@ dynamic = ["version"] dependencies = [] {% if cookiecutter.license == "MIT" -%} -license = {text = "{{cookiecutter.license}}"} +license = "MIT" {%- elif cookiecutter.license == "BSD-3" -%} -license = {text = "BSD-3-Clause"} +license = "BSD-3-Clause" {%- elif cookiecutter.license == "GNU GPL v3.0" -%} -license = {text = "GPL-3.0-only"} +license = "GPL-3.0-only" {%- elif cookiecutter.license == "GNU LGPL v3.0" -%} -license = {text = "LGPL-3.0-only"} +license = "LGPL-3.0-only" {%- elif cookiecutter.license == "Apache Software License 2.0" -%} -license = {text = "Apache-2.0"} +license = "Apache-2.0" {%- elif cookiecutter.license == "Mozilla Public License 2.0" -%} -license = {text = "MPL-2.0"} +license = "MPL-2.0" {%- endif %} +license-files = ["LICENSE"] + classifiers = [ "Development Status :: 2 - Pre-Alpha", "Programming Language :: Python", @@ -30,19 +32,6 @@ classifiers = [ "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Operating System :: OS Independent", - {% if cookiecutter.license == "MIT" -%} - "License :: OSI Approved :: MIT License", - {%- elif cookiecutter.license == "BSD-3" -%} - "License :: OSI Approved :: BSD License", - {%- elif cookiecutter.license == "GNU GPL v3.0" -%} - "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", - {%- elif cookiecutter.license == "GNU LGPL v3.0" -%} - "License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", - {%- elif cookiecutter.license == "Apache Software License 2.0" -%} - "License :: OSI Approved :: Apache Software License", - {%- elif cookiecutter.license == "Mozilla Public License 2.0" -%} - "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", - {%- endif %} ] {% if cookiecutter.github_repository_url != 'provide later' -%} @@ -72,7 +61,7 @@ dev = [ [build-system] requires = [ - "setuptools>=64", + "setuptools>=77", "wheel", "setuptools-scm[toml]>=8", ]