From 3d55dda5000fb965620c709818a4fb738ed71cba Mon Sep 17 00:00:00 2001 From: haztecaso Date: Thu, 31 Jul 2025 20:45:26 +0200 Subject: [PATCH 1/6] fix(template): make GPLv3 the default license --- cookiecutter.json | 8 +++----- {{cookiecutter.project_slug}}/LICENSE | 10 +++++----- {{cookiecutter.project_slug}}/pyproject.toml | 1 + 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/cookiecutter.json b/cookiecutter.json index 72ea159..bb25349 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -13,12 +13,10 @@ ], "use_mkdocs": "y", "open_source_license": [ - "MIT license", - "BSD license", - "ISC license", - "Apache Software License 2.0", "GNU General Public License v3", - "Not open source" + "Apache Software License 2.0", + "MIT license", + "BSD license" ], "security_advisories_email": "{{ cookiecutter.email }}", "__gh_slug": "{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}" diff --git a/{{cookiecutter.project_slug}}/LICENSE b/{{cookiecutter.project_slug}}/LICENSE index f7f3843..75c827e 100644 --- a/{{cookiecutter.project_slug}}/LICENSE +++ b/{{cookiecutter.project_slug}}/LICENSE @@ -1,7 +1,7 @@ {% if cookiecutter.open_source_license == 'MIT license' -%} MIT License -Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_name }} +Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.author }} Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -23,7 +23,7 @@ SOFTWARE. {%- elif cookiecutter.open_source_license == 'BSD license' -%} BSD License -Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_name }} +Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.author }} All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -53,7 +53,7 @@ OF THE POSSIBILITY OF SUCH DAMAGE. {%- elif cookiecutter.open_source_license == 'ISC license' -%} ISC License -Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_name }} +Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.author }} Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. @@ -61,7 +61,7 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH RE {%- elif cookiecutter.open_source_license == 'Apache Software License 2.0' -%} Apache Software License 2.0 -Copyright (c) {%- now 'local', '%Y' %}, {{ cookiecutter.full_name }} +Copyright (c) {%- now 'local', '%Y' %}, {{ cookiecutter.author }} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -79,7 +79,7 @@ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 {{ cookiecutter.project_short_description }} - Copyright (C) {% now 'local', '%Y' %} {{ cookiecutter.full_name }} + Copyright (C) {% now 'local', '%Y' %} {{ cookiecutter.author }} This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/{{cookiecutter.project_slug}}/pyproject.toml b/{{cookiecutter.project_slug}}/pyproject.toml index 2f3bd8f..473c713 100644 --- a/{{cookiecutter.project_slug}}/pyproject.toml +++ b/{{cookiecutter.project_slug}}/pyproject.toml @@ -12,6 +12,7 @@ dependencies = [ "asyncio", {%- endif %} ] +license = "{{ cookiecutter.open_source_license }}" [build-system] requires = ["hatchling"] From f943899c712838c2f9f692ba461091bde6c441ec Mon Sep 17 00:00:00 2001 From: haztecaso Date: Thu, 31 Jul 2025 20:54:07 +0200 Subject: [PATCH 2/6] fix(template): author and author_email variables --- {{cookiecutter.project_slug}}/mkdocs.yml | 2 +- {{cookiecutter.project_slug}}/pyproject.toml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/mkdocs.yml b/{{cookiecutter.project_slug}}/mkdocs.yml index 8dfb256..5f6e03d 100644 --- a/{{cookiecutter.project_slug}}/mkdocs.yml +++ b/{{cookiecutter.project_slug}}/mkdocs.yml @@ -1,6 +1,6 @@ site_name: {{ cookiecutter.project_name }} site_description: {{ cookiecutter.project_short_description }} -site_author: {{ cookiecutter.full_name }} +site_author: {{ cookiecutter.author }} repo_url: https://github.com/{{ cookiecutter.__gh_slug }} repo_name: {{ cookiecutter.__gh_slug }} diff --git a/{{cookiecutter.project_slug}}/pyproject.toml b/{{cookiecutter.project_slug}}/pyproject.toml index 473c713..0686f1e 100644 --- a/{{cookiecutter.project_slug}}/pyproject.toml +++ b/{{cookiecutter.project_slug}}/pyproject.toml @@ -4,6 +4,9 @@ version = "0.1.0" description = "{{ cookiecutter.project_short_description }}" readme = "README.md" requires-python = ">=3.10" +authors = [ + {name="{{ cookiecutter.author }}", email="{{ cookiecutter.author_email }}"}, +] dependencies = [ {%- if cookiecutter.command_line_interface.lower() == "click" %} "click", From a2bd0e08197b2992162303c5d7af0453a12d5669 Mon Sep 17 00:00:00 2001 From: haztecaso Date: Thu, 31 Jul 2025 20:54:28 +0200 Subject: [PATCH 3/6] feat(pyproject): add classifiers to pyproject --- {{cookiecutter.project_slug}}/pyproject.toml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/{{cookiecutter.project_slug}}/pyproject.toml b/{{cookiecutter.project_slug}}/pyproject.toml index 0686f1e..e861b81 100644 --- a/{{cookiecutter.project_slug}}/pyproject.toml +++ b/{{cookiecutter.project_slug}}/pyproject.toml @@ -16,6 +16,17 @@ dependencies = [ {%- endif %} ] license = "{{ cookiecutter.open_source_license }}" +classifiers=[ + "Development Status :: 2 - Pre-Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: {{ cookiecutter.open_source_license }}", + "Programming Language :: Python", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Natural Language :: English", +] [build-system] requires = ["hatchling"] From 04b39b4c43388fed6d09fb35558d8df22f8ba742 Mon Sep 17 00:00:00 2001 From: haztecaso Date: Thu, 31 Jul 2025 20:54:55 +0200 Subject: [PATCH 4/6] feat(flake): add description --- {{cookiecutter.project_slug}}/flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/{{cookiecutter.project_slug}}/flake.nix b/{{cookiecutter.project_slug}}/flake.nix index a372241..1990354 100644 --- a/{{cookiecutter.project_slug}}/flake.nix +++ b/{{cookiecutter.project_slug}}/flake.nix @@ -1,4 +1,5 @@ { + description = "{{ cookiecutter.project_short_description }}"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; From 4d264ccd711e1bf77d7f83859552acbcdabf4007 Mon Sep 17 00:00:00 2001 From: haztecaso Date: Thu, 31 Jul 2025 20:56:42 +0200 Subject: [PATCH 5/6] fix(template): variable defaults and order --- cookiecutter.json | 12 ++++++------ tests/contexts.json | 28 +++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/cookiecutter.json b/cookiecutter.json index bb25349..f04a975 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -1,10 +1,10 @@ { - "full_name": "Adrián Lattes", - "email": "adrianlattes@disroot.org", - "github_username": "haztecaso", - "project_name": "My cool python project", + "project_name": null, "project_slug": "{{ cookiecutter.project_name.lower().replace(' ', '_').replace('-', '_') }}", - "project_short_description": "Short description", + "project_short_description": null, + "author": null, + "author_email": null, + "github_username": null, "use_asyncio": "y", "command_line_interface": [ "click", @@ -18,6 +18,6 @@ "MIT license", "BSD license" ], - "security_advisories_email": "{{ cookiecutter.email }}", + "security_advisories_email": "{{ cookiecutter.author_email }}", "__gh_slug": "{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}" } diff --git a/tests/contexts.json b/tests/contexts.json index 3a3f7c1..01c58c3 100644 --- a/tests/contexts.json +++ b/tests/contexts.json @@ -1,21 +1,47 @@ { - "default": {}, + "default": { + "author": "Test Author", + "author_email": "test@email.com", + "project_name": "My Cool Python Project", + "project_short_description": "A short description", + "github_username": "testuser" + }, "minimalist": { + "author": "Test Author", + "author_email": "test@email.com", + "project_name": "My Cool Python Project", + "project_short_description": "A short description", + "github_username": "testuser", "use_asyncio": "n", "command_line_interface": "None", "use_mkdocs": "n" }, "click": { + "author": "Test Author", + "author_email": "test@email.com", + "project_name": "My Cool Python Project", + "project_short_description": "A short description", + "github_username": "testuser", "use_asyncio": "n", "command_line_interface": "click", "use_mkdocs": "n" }, "argparse": { + "author": "Test Author", + "author_email": "test@email.com", + "project_name": "My Cool Python Project", + "project_short_description": "A short description", + "github_username": "testuser", "use_asyncio": "n", "command_line_interface": "argparse", "use_mkdocs": "n" }, "mkdocs": { + "author": "Test Author", + "author_email": "test@email.com", + "project_name": "My Cool Python Project", + "project_short_description": "A short description", + "github_username": "testuser", "use_asyncio": "n", "command_line_interface": "None", "use_mkdocs": "y" From 46f4f80cc790945ed335ca89ae340f1a4de5bcff Mon Sep 17 00:00:00 2001 From: haztecaso Date: Thu, 31 Jul 2025 21:04:38 +0200 Subject: [PATCH 6/6] fix(template): license names --- cookiecutter.json | 8 ++++---- {{cookiecutter.project_slug}}/LICENSE | 16 ++++------------ {{cookiecutter.project_slug}}/pyproject.toml | 1 - 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/cookiecutter.json b/cookiecutter.json index f04a975..87ea83e 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -13,10 +13,10 @@ ], "use_mkdocs": "y", "open_source_license": [ - "GNU General Public License v3", - "Apache Software License 2.0", - "MIT license", - "BSD license" + "GNU General Public License v3 (GPLv3)", + "Apache Software License", + "MIT License", + "BSD License" ], "security_advisories_email": "{{ cookiecutter.author_email }}", "__gh_slug": "{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}" diff --git a/{{cookiecutter.project_slug}}/LICENSE b/{{cookiecutter.project_slug}}/LICENSE index 75c827e..a763da9 100644 --- a/{{cookiecutter.project_slug}}/LICENSE +++ b/{{cookiecutter.project_slug}}/LICENSE @@ -1,4 +1,4 @@ -{% if cookiecutter.open_source_license == 'MIT license' -%} +{% if cookiecutter.open_source_license == 'MIT License' -%} MIT License Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.author }} @@ -20,7 +20,7 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -{%- elif cookiecutter.open_source_license == 'BSD license' -%} +{%- elif cookiecutter.open_source_license == 'BSD License' -%} BSD License Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.author }} @@ -50,15 +50,7 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -{%- elif cookiecutter.open_source_license == 'ISC license' -%} -ISC License - -Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.author }} - -Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -{%- elif cookiecutter.open_source_license == 'Apache Software License 2.0' -%} +{%- elif cookiecutter.open_source_license == 'Apache Software License' -%} Apache Software License 2.0 Copyright (c) {%- now 'local', '%Y' %}, {{ cookiecutter.author }} @@ -74,7 +66,7 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -{%- elif cookiecutter.open_source_license == 'GNU General Public License v3' -%} +{%- elif cookiecutter.open_source_license == 'GNU General Public License v3 (GPLv3)' -%} GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 diff --git a/{{cookiecutter.project_slug}}/pyproject.toml b/{{cookiecutter.project_slug}}/pyproject.toml index e861b81..3631be9 100644 --- a/{{cookiecutter.project_slug}}/pyproject.toml +++ b/{{cookiecutter.project_slug}}/pyproject.toml @@ -15,7 +15,6 @@ dependencies = [ "asyncio", {%- endif %} ] -license = "{{ cookiecutter.open_source_license }}" classifiers=[ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers",