Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion docs/source/infrastructure.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
Expand Down
9 changes: 3 additions & 6 deletions tests/test_cookiecutter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 = (
Expand Down Expand Up @@ -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",
]
Expand Down Expand Up @@ -321,4 +318,4 @@ def test_pip_install(pip_install):
"Author-email: Test Cookiecutter <testing@cookiecutter.com>"
in show_details
)
assert "License: MIT" in show_details
assert "License-Expression: MIT" in show_details
2 changes: 1 addition & 1 deletion {{cookiecutter.package_name}}/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ venv/
# OS
.DS_Store

# written by setuptools_scm
# written by setuptools-scm
**/_version.py
5 changes: 4 additions & 1 deletion {{cookiecutter.package_name}}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 9 additions & 20 deletions {{cookiecutter.package_name}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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' -%}
Expand Down Expand Up @@ -72,7 +61,7 @@ dev = [

[build-system]
requires = [
"setuptools>=64",
"setuptools>=77",
"wheel",
"setuptools-scm[toml]>=8",
]
Expand Down