Skip to content

Commit ba09a18

Browse files
committed
cookiecutter: updated handling of license name standards
1 parent 266b853 commit ba09a18

3 files changed

Lines changed: 26 additions & 45 deletions

File tree

cookiecutter.json

Lines changed: 14 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -8,50 +8,22 @@
88
"author_email": "your@email",
99
"github_organization": "saezlab",
1010
"project_repo": "https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }}",
11-
"license": {
12-
"type": "select",
13-
"choices": [
14-
[
15-
"MIT License",
16-
"MIT"
17-
],
18-
[
19-
"BSD 2-Clause License",
20-
"BSD-2-Clause"
21-
],
22-
[
23-
"BSD 3-Clause License",
24-
"BSD-3-Clause"
25-
],
26-
[
27-
"Apache License Version 2.0",
28-
"Apache-2.0"
29-
],
30-
[
31-
"GNU Lesser General Public License Version 3",
32-
"LGPL-3.0-or-later"
33-
],
34-
[
35-
"GNU General Public License Version 3",
36-
"GPL-3.0-or-later"
37-
],
38-
[
39-
"ISC License",
40-
"ISC"
41-
],
42-
[
43-
"Unlicense",
44-
"Unlicense"
45-
]
46-
],
47-
"default": "LGPL-3.0-or-later"
48-
},
11+
"license": [
12+
"GNU Lesser General Public License Version 3",
13+
"Apache License Version 2.0",
14+
"MIT License",
15+
"BSD 2-Clause License",
16+
"BSD 3-Clause License",
17+
"GNU General Public License Version 3",
18+
"ISC License",
19+
"Unlicense"
20+
],
4921
"python_version": [
50-
"3.9",
51-
"3.10",
52-
"3.11",
22+
"3.13",
5323
"3.12",
54-
"3.13"
24+
"3.11",
25+
"3.10",
26+
"3.9"
5527
],
5628
"copyright_holder": "Heidelberg University Hospital",
5729
"__year": "{% now 'utc', '%Y' %}",

hooks/pre_gen_project.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import cookiecutter
2-
31
LICENSE_CLASSIFIERS = {
42
'MIT': 'MIT License',
53
'BSD-2-Clause': 'BSD License',
@@ -11,5 +9,16 @@
119
'Unlicense': 'The Unlicense (Unlicense)',
1210
}
1311

12+
LICENSE_SPDX = {
13+
'MIT License': 'MIT',
14+
'BSD 2-Clause License': 'BSD-2-Clause',
15+
'BSD 3-Clause License': 'BSD-3-Clause',
16+
'Apache License Version 2.0': 'Apache-2.0',
17+
'GNU General Public License Version 3': 'GPL-3.0-or-later',
18+
'ISC License': 'ISC',
19+
'Unlicense': 'Unlicense',
20+
}
21+
1422
license = cookiecutter.license
1523
cookiecutter.license_classifier = LICENSE_CLASSIFIERS.get(license, license)
24+
cookiecutter.license_spdx = LICENSE_SPDX.get(license, license)

{{cookiecutter.project_slug}}/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ packages = [ "{{ cookiecutter.package_name }}" ]
1111
name = "{{ cookiecutter.project_slug }}"
1212
version = "0.0.1"
1313
description = "{{ cookiecutter.short_description }}"
14-
license = "{{ cookiecutter.license }}"
14+
license = "{{ cookiecutter.license_spdx }}"
1515
maintainers = [
1616
"{{ cookiecutter.author_full_name }} <{{ cookiecutter.author_email }}>"
1717
]

0 commit comments

Comments
 (0)