From dd79ccd768e12bf45094c4cdd3ea62e00e4d12a5 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Tue, 30 Jul 2024 12:03:59 +0200 Subject: [PATCH 001/285] Rename template folder and files in preparation of migration to copier --- {{{cookiecutter.directory_name}} => template}/.editorconfig | 0 .../.githooks/pre-commit | 0 .../.github/next_steps/01_sonarcloud_integration.md.jinja | 0 .../.github/next_steps/02_citation.md.jinja | 0 .../.github/next_steps/03_readthedocs.md.jinja | 0 .../.github/next_steps/04_zenodo_integration.md.jinja | 0 .../.github/next_steps/05_linting.md.jinja | 0 .../.github/workflows/build.yml | 0 .../.github/workflows/cffconvert.yml | 0 .../.github/workflows/documentation.yml | 0 .../.github/workflows/markdown-link-check.yml | 0 .../.github/workflows/next_steps.yml | 0 .../.github/workflows/sonarcloud.yml | 0 {{{cookiecutter.directory_name}} => template}/.gitignore | 0 {{{cookiecutter.directory_name}} => template}/.mlc-config.json | 0 {{{cookiecutter.directory_name}} => template}/.readthedocs.yaml | 0 {{{cookiecutter.directory_name}} => template}/CHANGELOG.md | 0 .../CITATION.cff => template/CITATION.cff.jinja | 0 .../CODE_OF_CONDUCT.md => template/CODE_OF_CONDUCT.md.jinja | 0 .../CONTRIBUTING.md => template/CONTRIBUTING.md.jinja | 0 {{cookiecutter.directory_name}}/LICENSE => template/LICENSE.jinja | 0 {{{cookiecutter.directory_name}} => template}/MANIFEST.in | 0 {{cookiecutter.directory_name}}/NOTICE => template/NOTICE.jinja | 0 .../README.dev.md => template/README.dev.md.jinja | 0 .../README.md => template/README.md.jinja | 0 .../docs/Makefile => template/docs/Makefile.jinja | 0 .../docs/_templates/.gitignore | 0 .../docs/conf.py => template/docs/conf.py.jinja | 0 .../docs/index.rst => template/docs/index.rst.jinja | 0 .../docs/make.bat => template/docs/make.bat.jinja | 0 .../next_steps.md => template/next_steps.md.jinja | 0 .../project_setup.md => template/project_setup.md.jinja | 0 .../pyproject.toml => template/pyproject.toml.jinja | 0 .../sonar-project.properties.jinja | 0 .../src/{{package_name}}/__init__.py.jinja | 0 .../src/{{package_name}}/my_module.py.jinja | 0 {{{cookiecutter.directory_name}} => template}/tests/__init__.py | 0 .../test_my_module.py => template/tests/test_my_module.py.jinja | 0 38 files changed, 0 insertions(+), 0 deletions(-) rename {{{cookiecutter.directory_name}} => template}/.editorconfig (100%) rename {{{cookiecutter.directory_name}} => template}/.githooks/pre-commit (100%) rename {{cookiecutter.directory_name}}/.github/next_steps/01_sonarcloud_integration.md => template/.github/next_steps/01_sonarcloud_integration.md.jinja (100%) rename {{cookiecutter.directory_name}}/.github/next_steps/02_citation.md => template/.github/next_steps/02_citation.md.jinja (100%) rename {{cookiecutter.directory_name}}/.github/next_steps/03_readthedocs.md => template/.github/next_steps/03_readthedocs.md.jinja (100%) rename {{cookiecutter.directory_name}}/.github/next_steps/04_zenodo_integration.md => template/.github/next_steps/04_zenodo_integration.md.jinja (100%) rename {{cookiecutter.directory_name}}/.github/next_steps/05_linting.md => template/.github/next_steps/05_linting.md.jinja (100%) rename {{{cookiecutter.directory_name}} => template}/.github/workflows/build.yml (100%) rename {{{cookiecutter.directory_name}} => template}/.github/workflows/cffconvert.yml (100%) rename {{{cookiecutter.directory_name}} => template}/.github/workflows/documentation.yml (100%) rename {{{cookiecutter.directory_name}} => template}/.github/workflows/markdown-link-check.yml (100%) rename {{{cookiecutter.directory_name}} => template}/.github/workflows/next_steps.yml (100%) rename {{{cookiecutter.directory_name}} => template}/.github/workflows/sonarcloud.yml (100%) rename {{{cookiecutter.directory_name}} => template}/.gitignore (100%) rename {{{cookiecutter.directory_name}} => template}/.mlc-config.json (100%) rename {{{cookiecutter.directory_name}} => template}/.readthedocs.yaml (100%) rename {{{cookiecutter.directory_name}} => template}/CHANGELOG.md (100%) rename {{cookiecutter.directory_name}}/CITATION.cff => template/CITATION.cff.jinja (100%) rename {{cookiecutter.directory_name}}/CODE_OF_CONDUCT.md => template/CODE_OF_CONDUCT.md.jinja (100%) rename {{cookiecutter.directory_name}}/CONTRIBUTING.md => template/CONTRIBUTING.md.jinja (100%) rename {{cookiecutter.directory_name}}/LICENSE => template/LICENSE.jinja (100%) rename {{{cookiecutter.directory_name}} => template}/MANIFEST.in (100%) rename {{cookiecutter.directory_name}}/NOTICE => template/NOTICE.jinja (100%) rename {{cookiecutter.directory_name}}/README.dev.md => template/README.dev.md.jinja (100%) rename {{cookiecutter.directory_name}}/README.md => template/README.md.jinja (100%) rename {{cookiecutter.directory_name}}/docs/Makefile => template/docs/Makefile.jinja (100%) rename {{{cookiecutter.directory_name}} => template}/docs/_templates/.gitignore (100%) rename {{cookiecutter.directory_name}}/docs/conf.py => template/docs/conf.py.jinja (100%) rename {{cookiecutter.directory_name}}/docs/index.rst => template/docs/index.rst.jinja (100%) rename {{cookiecutter.directory_name}}/docs/make.bat => template/docs/make.bat.jinja (100%) rename {{cookiecutter.directory_name}}/next_steps.md => template/next_steps.md.jinja (100%) rename {{cookiecutter.directory_name}}/project_setup.md => template/project_setup.md.jinja (100%) rename {{cookiecutter.directory_name}}/pyproject.toml => template/pyproject.toml.jinja (100%) rename {{cookiecutter.directory_name}}/sonar-project.properties => template/sonar-project.properties.jinja (100%) rename {{cookiecutter.directory_name}}/src/{{cookiecutter.package_name}}/__init__.py => template/src/{{package_name}}/__init__.py.jinja (100%) rename {{cookiecutter.directory_name}}/src/{{cookiecutter.package_name}}/my_module.py => template/src/{{package_name}}/my_module.py.jinja (100%) rename {{{cookiecutter.directory_name}} => template}/tests/__init__.py (100%) rename {{cookiecutter.directory_name}}/tests/test_my_module.py => template/tests/test_my_module.py.jinja (100%) diff --git a/{{cookiecutter.directory_name}}/.editorconfig b/template/.editorconfig similarity index 100% rename from {{cookiecutter.directory_name}}/.editorconfig rename to template/.editorconfig diff --git a/{{cookiecutter.directory_name}}/.githooks/pre-commit b/template/.githooks/pre-commit similarity index 100% rename from {{cookiecutter.directory_name}}/.githooks/pre-commit rename to template/.githooks/pre-commit diff --git a/{{cookiecutter.directory_name}}/.github/next_steps/01_sonarcloud_integration.md b/template/.github/next_steps/01_sonarcloud_integration.md.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/.github/next_steps/01_sonarcloud_integration.md rename to template/.github/next_steps/01_sonarcloud_integration.md.jinja diff --git a/{{cookiecutter.directory_name}}/.github/next_steps/02_citation.md b/template/.github/next_steps/02_citation.md.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/.github/next_steps/02_citation.md rename to template/.github/next_steps/02_citation.md.jinja diff --git a/{{cookiecutter.directory_name}}/.github/next_steps/03_readthedocs.md b/template/.github/next_steps/03_readthedocs.md.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/.github/next_steps/03_readthedocs.md rename to template/.github/next_steps/03_readthedocs.md.jinja diff --git a/{{cookiecutter.directory_name}}/.github/next_steps/04_zenodo_integration.md b/template/.github/next_steps/04_zenodo_integration.md.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/.github/next_steps/04_zenodo_integration.md rename to template/.github/next_steps/04_zenodo_integration.md.jinja diff --git a/{{cookiecutter.directory_name}}/.github/next_steps/05_linting.md b/template/.github/next_steps/05_linting.md.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/.github/next_steps/05_linting.md rename to template/.github/next_steps/05_linting.md.jinja diff --git a/{{cookiecutter.directory_name}}/.github/workflows/build.yml b/template/.github/workflows/build.yml similarity index 100% rename from {{cookiecutter.directory_name}}/.github/workflows/build.yml rename to template/.github/workflows/build.yml diff --git a/{{cookiecutter.directory_name}}/.github/workflows/cffconvert.yml b/template/.github/workflows/cffconvert.yml similarity index 100% rename from {{cookiecutter.directory_name}}/.github/workflows/cffconvert.yml rename to template/.github/workflows/cffconvert.yml diff --git a/{{cookiecutter.directory_name}}/.github/workflows/documentation.yml b/template/.github/workflows/documentation.yml similarity index 100% rename from {{cookiecutter.directory_name}}/.github/workflows/documentation.yml rename to template/.github/workflows/documentation.yml diff --git a/{{cookiecutter.directory_name}}/.github/workflows/markdown-link-check.yml b/template/.github/workflows/markdown-link-check.yml similarity index 100% rename from {{cookiecutter.directory_name}}/.github/workflows/markdown-link-check.yml rename to template/.github/workflows/markdown-link-check.yml diff --git a/{{cookiecutter.directory_name}}/.github/workflows/next_steps.yml b/template/.github/workflows/next_steps.yml similarity index 100% rename from {{cookiecutter.directory_name}}/.github/workflows/next_steps.yml rename to template/.github/workflows/next_steps.yml diff --git a/{{cookiecutter.directory_name}}/.github/workflows/sonarcloud.yml b/template/.github/workflows/sonarcloud.yml similarity index 100% rename from {{cookiecutter.directory_name}}/.github/workflows/sonarcloud.yml rename to template/.github/workflows/sonarcloud.yml diff --git a/{{cookiecutter.directory_name}}/.gitignore b/template/.gitignore similarity index 100% rename from {{cookiecutter.directory_name}}/.gitignore rename to template/.gitignore diff --git a/{{cookiecutter.directory_name}}/.mlc-config.json b/template/.mlc-config.json similarity index 100% rename from {{cookiecutter.directory_name}}/.mlc-config.json rename to template/.mlc-config.json diff --git a/{{cookiecutter.directory_name}}/.readthedocs.yaml b/template/.readthedocs.yaml similarity index 100% rename from {{cookiecutter.directory_name}}/.readthedocs.yaml rename to template/.readthedocs.yaml diff --git a/{{cookiecutter.directory_name}}/CHANGELOG.md b/template/CHANGELOG.md similarity index 100% rename from {{cookiecutter.directory_name}}/CHANGELOG.md rename to template/CHANGELOG.md diff --git a/{{cookiecutter.directory_name}}/CITATION.cff b/template/CITATION.cff.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/CITATION.cff rename to template/CITATION.cff.jinja diff --git a/{{cookiecutter.directory_name}}/CODE_OF_CONDUCT.md b/template/CODE_OF_CONDUCT.md.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/CODE_OF_CONDUCT.md rename to template/CODE_OF_CONDUCT.md.jinja diff --git a/{{cookiecutter.directory_name}}/CONTRIBUTING.md b/template/CONTRIBUTING.md.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/CONTRIBUTING.md rename to template/CONTRIBUTING.md.jinja diff --git a/{{cookiecutter.directory_name}}/LICENSE b/template/LICENSE.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/LICENSE rename to template/LICENSE.jinja diff --git a/{{cookiecutter.directory_name}}/MANIFEST.in b/template/MANIFEST.in similarity index 100% rename from {{cookiecutter.directory_name}}/MANIFEST.in rename to template/MANIFEST.in diff --git a/{{cookiecutter.directory_name}}/NOTICE b/template/NOTICE.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/NOTICE rename to template/NOTICE.jinja diff --git a/{{cookiecutter.directory_name}}/README.dev.md b/template/README.dev.md.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/README.dev.md rename to template/README.dev.md.jinja diff --git a/{{cookiecutter.directory_name}}/README.md b/template/README.md.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/README.md rename to template/README.md.jinja diff --git a/{{cookiecutter.directory_name}}/docs/Makefile b/template/docs/Makefile.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/docs/Makefile rename to template/docs/Makefile.jinja diff --git a/{{cookiecutter.directory_name}}/docs/_templates/.gitignore b/template/docs/_templates/.gitignore similarity index 100% rename from {{cookiecutter.directory_name}}/docs/_templates/.gitignore rename to template/docs/_templates/.gitignore diff --git a/{{cookiecutter.directory_name}}/docs/conf.py b/template/docs/conf.py.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/docs/conf.py rename to template/docs/conf.py.jinja diff --git a/{{cookiecutter.directory_name}}/docs/index.rst b/template/docs/index.rst.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/docs/index.rst rename to template/docs/index.rst.jinja diff --git a/{{cookiecutter.directory_name}}/docs/make.bat b/template/docs/make.bat.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/docs/make.bat rename to template/docs/make.bat.jinja diff --git a/{{cookiecutter.directory_name}}/next_steps.md b/template/next_steps.md.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/next_steps.md rename to template/next_steps.md.jinja diff --git a/{{cookiecutter.directory_name}}/project_setup.md b/template/project_setup.md.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/project_setup.md rename to template/project_setup.md.jinja diff --git a/{{cookiecutter.directory_name}}/pyproject.toml b/template/pyproject.toml.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/pyproject.toml rename to template/pyproject.toml.jinja diff --git a/{{cookiecutter.directory_name}}/sonar-project.properties b/template/sonar-project.properties.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/sonar-project.properties rename to template/sonar-project.properties.jinja diff --git a/{{cookiecutter.directory_name}}/src/{{cookiecutter.package_name}}/__init__.py b/template/src/{{package_name}}/__init__.py.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/src/{{cookiecutter.package_name}}/__init__.py rename to template/src/{{package_name}}/__init__.py.jinja diff --git a/{{cookiecutter.directory_name}}/src/{{cookiecutter.package_name}}/my_module.py b/template/src/{{package_name}}/my_module.py.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/src/{{cookiecutter.package_name}}/my_module.py rename to template/src/{{package_name}}/my_module.py.jinja diff --git a/{{cookiecutter.directory_name}}/tests/__init__.py b/template/tests/__init__.py similarity index 100% rename from {{cookiecutter.directory_name}}/tests/__init__.py rename to template/tests/__init__.py diff --git a/{{cookiecutter.directory_name}}/tests/test_my_module.py b/template/tests/test_my_module.py.jinja similarity index 100% rename from {{cookiecutter.directory_name}}/tests/test_my_module.py rename to template/tests/test_my_module.py.jinja From 616ee560498a469a579345cf9bb350e8fc32696b Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Tue, 30 Jul 2024 12:13:35 +0200 Subject: [PATCH 002/285] Migrate from cookiecutter to copier This migrates from cookiecutter template to copier while keeping all original features. Closes #348 Co-authored-by: Olga Lyashevska Co-authored-by: Sander van Rijn --- .copier-answers.yml | 0 .../ISSUE_TEMPLATE/10_generated_package.md | 2 +- .github/ISSUE_TEMPLATE/20_template.md | 2 +- .gitignore | 2 + ADD_TO_EXISTING_PACKAGE.md | 6 +- CITATION.cff | 2 +- README.md | 2 +- cookiecutter.json | 14 - copier.yml | 70 +++ hooks/post_gen_project.py | 1 - hooks/pre_gen_project.py | 11 - setup.cfg | 7 +- .../01_sonarcloud_integration.md.jinja | 6 +- .../.github/next_steps/02_citation.md.jinja | 4 +- .../next_steps/03_readthedocs.md.jinja | 10 +- .../next_steps/04_zenodo_integration.md.jinja | 2 +- .../.github/next_steps/05_linting.md.jinja | 4 +- template/.gitignore | 2 + template/CITATION.cff.jinja | 16 +- template/CODE_OF_CONDUCT.md.jinja | 2 +- template/CONTRIBUTING.md.jinja | 18 +- template/NOTICE.jinja | 4 +- template/README.dev.md.jinja | 20 +- template/docs/Makefile.jinja | 2 +- template/docs/conf.py.jinja | 8 +- template/docs/index.rst.jinja | 4 +- template/docs/make.bat.jinja | 2 +- template/next_steps.md.jinja | 10 +- template/project_setup.md.jinja | 2 +- template/pyproject.toml.jinja | 32 +- template/sonar-project.properties.jinja | 14 +- .../src/{{package_name}}/__init__.py.jinja | 8 +- .../src/{{package_name}}/my_module.py.jinja | 4 +- template/tests/test_my_module.py.jinja | 4 +- ...== 'Apache-2.0' %}LICENSE{% endif %}.jinja | 201 +++++++++ ...= 'BSD license' %}LICENSE{% endif %}.jinja | 30 ++ ...e v3 or later' %}LICENSE{% endif %}.jinja} | 419 ------------------ ...se v3 or later' %}LICENSE{% endif %}.jinja | 166 +++++++ ...= 'ISC license' %}LICENSE{% endif %}.jinja | 12 + ...= 'MIT licence' %}LICENSE{% endif %}.jinja | 16 + ...ot open source' %}LICENSE{% endif %}.jinja | 1 + template/{{_copier_conf.answers_file}}.jinja | 2 + tests/test_project.py | 24 +- tests/test_values.py | 16 +- 44 files changed, 622 insertions(+), 562 deletions(-) create mode 100644 .copier-answers.yml delete mode 100644 cookiecutter.json create mode 100644 copier.yml delete mode 100644 hooks/post_gen_project.py delete mode 100644 hooks/pre_gen_project.py create mode 100644 template/{% if license == 'Apache-2.0' %}LICENSE{% endif %}.jinja create mode 100644 template/{% if license == 'BSD license' %}LICENSE{% endif %}.jinja rename template/{LICENSE.jinja => {% if license == 'GNU General Public License v3 or later' %}LICENSE{% endif %}.jinja} (60%) create mode 100644 template/{% if license == 'GNU Lesser General Public License v3 or later' %}LICENSE{% endif %}.jinja create mode 100644 template/{% if license == 'ISC license' %}LICENSE{% endif %}.jinja create mode 100644 template/{% if license == 'MIT licence' %}LICENSE{% endif %}.jinja create mode 100644 template/{% if license == 'Not open source' %}LICENSE{% endif %}.jinja create mode 100644 template/{{_copier_conf.answers_file}}.jinja diff --git a/.copier-answers.yml b/.copier-answers.yml new file mode 100644 index 00000000..e69de29b diff --git a/.github/ISSUE_TEMPLATE/10_generated_package.md b/.github/ISSUE_TEMPLATE/10_generated_package.md index 3fdb2a41..19215dd6 100644 --- a/.github/ISSUE_TEMPLATE/10_generated_package.md +++ b/.github/ISSUE_TEMPLATE/10_generated_package.md @@ -7,5 +7,5 @@ assignees: '' --- diff --git a/.github/ISSUE_TEMPLATE/20_template.md b/.github/ISSUE_TEMPLATE/20_template.md index c25688bf..df6e73dc 100644 --- a/.github/ISSUE_TEMPLATE/20_template.md +++ b/.github/ISSUE_TEMPLATE/20_template.md @@ -7,5 +7,5 @@ assignees: '' --- diff --git a/.gitignore b/.gitignore index ec774d30..5b4bd3df 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,5 @@ env env3 venv venv3 + +.swp diff --git a/ADD_TO_EXISTING_PACKAGE.md b/ADD_TO_EXISTING_PACKAGE.md index 140c28ea..9edfca2b 100644 --- a/ADD_TO_EXISTING_PACKAGE.md +++ b/ADD_TO_EXISTING_PACKAGE.md @@ -4,12 +4,12 @@ The following steps requires that your existing code is in a GitHub repository. 1. Follow the [instructions to create a new package](https://github.com/NLeSC/python-template#how-to-use) with the Python template, while answering the questions like you would for the existing package. -2. Create a Git structure for the new directory: (replace `` with directory name you used during cookiecutter questionnaire) +2. Create a Git structure for the new directory: (replace `` with directory name you used during coopier questionnaire) ```shell $ cd $ git init $ git add --all -$ git commit -m "Added code generated by cookiecutter" +$ git commit -m "Added code generated by copier" $ git branch -M main ``` @@ -24,6 +24,6 @@ $ git merge existing_code/ --allow-unrelated-histories 5. Once all conflicts have been resolved then add all the files to GitHub: ```shell $ git add --all -$ git commit -m "Merged existing code with code generated by cookiecutter" +$ git commit -m "Merged existing code with code generated by copier" $ git push ``` diff --git a/CITATION.cff b/CITATION.cff index 045e0e43..ca4e3295 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -72,7 +72,7 @@ cff-version: "1.2.0" date-released: 2018-07-17 doi: 10.5281/zenodo.1310751 keywords: - - cookiecutter + - copier - template - Python license: Apache-2.0 diff --git a/README.md b/README.md index e23cebc9..181db8c8 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Use this [Cookiecutter](https://cookiecutter.readthedocs.io) template to generat an empty Python package. Features include: - Boilerplate unit tests and documentation, -- [Python static setup configuration]({{cookiecutter.directory_name}}/pyproject.toml), +- [Python static setup configuration]({{directory_name}}/pyproject.toml), - Open source software license, - Continuous integration with [GitHub action workflows]({{cookiecutter.directory_name}}/.github/workflows) for building, testing, link checking and linting, - Code style checking with [ruff](https://beta.ruff.rs/), diff --git a/cookiecutter.json b/cookiecutter.json deleted file mode 100644 index 60d0b3f3..00000000 --- a/cookiecutter.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "directory_name": "my-python-project", - "package_name": "my_python_package", - "package_short_description": "Short description of package", - "keyword1": "keyword1", - "keyword2": "keyword2", - "version": "0.1.0", - "github_organization": "", - "license": ["Apache Software License 2.0", "MIT license", "BSD license", "ISC license", "GNU General Public License v3 or later", "GNU Lesser General Public License v3 or later", "Not open source"], - "full_name": "Jane Smith", - "email": "yourname@esciencecenter.nl", - "copyright_holder": "Netherlands eScience Center", - "code_of_conduct_email": "{{ cookiecutter.email }}" -} diff --git a/copier.yml b/copier.yml new file mode 100644 index 00000000..77fc3fd3 --- /dev/null +++ b/copier.yml @@ -0,0 +1,70 @@ +# Essential questions + +package_name: + type: str + default: my_python_package + help: Enter the name of the Python package. + validator: >- + {% if not (package_name | regex_search('^[a-z][a-z0-9\_]+$')) %} + package_name must start with a letter, followed one or more letters, digits or underscores all lowercase. + {% endif %} +package_short_description: + type: str + default: Short description of package + # validator: >- + # {% if '"' in package_short_description %} + # package_short_description must not contain unescaped double quotes. Use \\" for double quotes. + # {% endif %} +keyword1: + type: str + default: keyword1 +keyword2: + type: str + default: keyword2 +version: + type: str + default: 0.1.0 +github_organization: + type: str + default: "" +license: + type: str + choices: + - "Apache Software License 2.0" + - "MIT license" + - "BSD license" + - "ISC license" + - "GNU General Public License v3 or later" + - "GNU Lesser General Public License v3 or later" + - "Not open source" + default: "MIT license" +full_name: + type: str + default: Jane Smith + help: Enter your full name. + # validator: >- + # {% if '"' in full_name %} + # full_name must not contain unescaped double quotes. Use \\" for double quotes. + # {% endif %} +email: + type: str + default: yourname@esciencecenter.nl +copyright_holder: + type: str + default: Netherlands eScience Center +code_of_conduct_email: + type: str + default: "{{ email }}" + +_subdirectory: template + +repository: + default: git@github.com:{{ github_organization }}/{{ directory_name }} + when: false + +repository_url: + default: https://github.com/{{ github_organization }}/{{ directory_name }} + when: false + + +# Optional questions diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py deleted file mode 100644 index f7ceaa80..00000000 --- a/hooks/post_gen_project.py +++ /dev/null @@ -1 +0,0 @@ -print("\nProject was successfully generated. For next steps, refer to file {{ cookiecutter.directory_name }}/next_steps.md.\n") diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py deleted file mode 100644 index 665cbe50..00000000 --- a/hooks/pre_gen_project.py +++ /dev/null @@ -1,11 +0,0 @@ -# Note: cookiecutter first makes the main level directory using -# directory_name from cookiecutter.json before running this hook - -{{ cookiecutter.update({ - "package_name": cookiecutter.package_name.lower().replace(" ", "_").replace("-", "_"), - "directory_name": cookiecutter.directory_name.lower().replace(" ", "-"), - "full_name": cookiecutter.full_name.replace('\"', '\\\"'), - "repository": "git@github.com:" + cookiecutter.github_organization + "/" + cookiecutter.directory_name.lower().replace(" ", "-"), - "repository_url": "https://github.com/" + cookiecutter.github_organization + "/" + cookiecutter.directory_name.lower().replace(" ", "-"), - "package_short_description": cookiecutter.package_short_description.replace('\"', '\\\"') -}) }} diff --git a/setup.cfg b/setup.cfg index 5aef0661..b6b2cb16 100644 --- a/setup.cfg +++ b/setup.cfg @@ -33,7 +33,7 @@ include_package_data = True python_requires = >=3.8 packages = install_requires = - cookiecutter==1.7.2 + copier==9.2.0 [options.data_files] # This section requires setuptools>=40.6.0 @@ -45,9 +45,10 @@ install_requires = dev = coverage [toml] pytest - pytest-cookies + pytest-copie + pyprojroot [tool:pytest] testpaths = tests -norecursedirs = .git .github hooks {{cookiecutter.directory_name}} +norecursedirs = .git .github hooks {{directory_name}} diff --git a/template/.github/next_steps/01_sonarcloud_integration.md.jinja b/template/.github/next_steps/01_sonarcloud_integration.md.jinja index 23761831..152edb6b 100644 --- a/template/.github/next_steps/01_sonarcloud_integration.md.jinja +++ b/template/.github/next_steps/01_sonarcloud_integration.md.jinja @@ -4,13 +4,13 @@ title: 'Next step: Sonarcloud integration' Continuous code quality can be handled by [Sonarcloud](https://sonarcloud.io/). This repository is configured to use Sonarcloud to perform quality analysis and code coverage report on each push. -In order to configure Sonarcloud analysis [GitHub Action workflow]({{cookiecutter.repository_url}}/blob/main/.github/workflows/sonarcloud.yml) you must follow the steps below: +In order to configure Sonarcloud analysis [GitHub Action workflow]({{repository_url}}/blob/main/.github/workflows/sonarcloud.yml) you must follow the steps below: 1. go to [Sonarcloud](https://sonarcloud.io/projects/create) to create a new Sonarcloud project 1. login with your GitHub account 1. add Sonarcloud organization or reuse existing one 1. set up a repository -1. go to [new code definition administration page](https://sonarcloud.io/project/new_code?id={{cookiecutter.github_organization}}_{{cookiecutter.directory_name}}) and select `Number of days` option +1. go to [new code definition administration page](https://sonarcloud.io/project/new_code?id={{github_organization}}_{{directory_name}}) and select `Number of days` option 1. To be able to run the analysis: 1. a token must be created at [Sonarcloud account](https://sonarcloud.io/account/security/) - 1. the created token must be added as `SONAR_TOKEN` to [secrets on GitHub](https://github.com/{{cookiecutter.github_organization}}/{{cookiecutter.directory_name}}/settings/secrets/actions) + 1. the created token must be added as `SONAR_TOKEN` to [secrets on GitHub](https://github.com/{{github_organization}}/{{directory_name}}/settings/secrets/actions) diff --git a/template/.github/next_steps/02_citation.md.jinja b/template/.github/next_steps/02_citation.md.jinja index 7a3279d7..90ffd88f 100644 --- a/template/.github/next_steps/02_citation.md.jinja +++ b/template/.github/next_steps/02_citation.md.jinja @@ -2,7 +2,7 @@ title: 'Next step: Citation data' --- -It is likely that your `CITATION.cff` currently doesn't pass validation. The error messages you get from the [`cffconvert`]({{cookiecutter.repository_url}}/actions/workflows/cffconvert.yml) GitHub Action are unfortunately a bit cryptic, but doing the following helps: +It is likely that your `CITATION.cff` currently doesn't pass validation. The error messages you get from the [`cffconvert`]({{repository_url}}/actions/workflows/cffconvert.yml) GitHub Action are unfortunately a bit cryptic, but doing the following helps: - [ ] Check if the `given-name` and `family-name` keys need updating. If your family name has a name particle like `von` or `van` or `de`, use the `name-particle` key; if your name has a suffix like `Sr` or `IV`, use `name-suffix`. For details, refer to the schema description: https://github.com/citation-file-format/citation-file-format - [ ] Update the value of the `orcid` key. If you do not have an orcid yet, you can get one here [https://orcid.org/](https://orcid.org/). @@ -13,7 +13,7 @@ It is likely that your `CITATION.cff` currently doesn't pass validation. The err Afterwards, the `cffconvert` GitHub Action should be green. -To make sure services like [Zenodo](https://zenodo.org) and the [Research Software Directory](https://research-software-directory.org/) can keep your citation data up to date, the [`cffconvert`]({{cookiecutter.repository_url}}/actions/workflows/cffconvert.yml) GitHub Action checks the following: +To make sure services like [Zenodo](https://zenodo.org) and the [Research Software Directory](https://research-software-directory.org/) can keep your citation data up to date, the [`cffconvert`]({{repository_url}}/actions/workflows/cffconvert.yml) GitHub Action checks the following: 1. Whether your repository includes a `CITATION.cff` file. diff --git a/template/.github/next_steps/03_readthedocs.md.jinja b/template/.github/next_steps/03_readthedocs.md.jinja index fb72b7f3..5c7917d0 100644 --- a/template/.github/next_steps/03_readthedocs.md.jinja +++ b/template/.github/next_steps/03_readthedocs.md.jinja @@ -9,12 +9,12 @@ To host the documentation of this repository please perform the following instru 1. go to [Read the Docs](https://readthedocs.org/dashboard/import/?) 1. log in with your GitHub account -1. find `{{ cookiecutter.github_organization }}/{{ cookiecutter.directory_name }}` in list and press `+` button. +1. find `{{ github_organization }}/{{ directory_name }}` in list and press `+` button. * If repository is not listed, 1. go to [Read the Docs GitHub app](https://github.com/settings/connections/applications/fae83c942bc1d89609e2) - 2. make sure {{ cookiecutter.github_organization }} has been granted access. + 2. make sure {{ github_organization }} has been granted access. 3. reload repository list on Read the Docs import page -1. wait for the first build to be completed at -1. check that the link of the documentation badge in the [README.md]({{ cookiecutter.repository_url }}) works +1. wait for the first build to be completed at +1. check that the link of the documentation badge in the [README.md]({{ repository_url }}) works -See [README.dev.md#]({{cookiecutter.repository_url}}/blob/main/README.dev.md#generating-the-api-docs) how to build documentation site locally. +See [README.dev.md#]({{repository_url}}/blob/main/README.dev.md#generating-the-api-docs) how to build documentation site locally. diff --git a/template/.github/next_steps/04_zenodo_integration.md.jinja b/template/.github/next_steps/04_zenodo_integration.md.jinja index 45ecb639..911d824b 100644 --- a/template/.github/next_steps/04_zenodo_integration.md.jinja +++ b/template/.github/next_steps/04_zenodo_integration.md.jinja @@ -8,7 +8,7 @@ To enable Zenodo integration: 1. Go to http://zenodo.org and login with your GitHub account. When you are redirected to GitHub, *Authorize application* to give permission to Zenodo to access your account. 1. Go to and enable Zenodo integration of your repository by clicking on `On` toggle button. -2. Your package will get a DOI only after you make a release. Create a new release as described in [README.dev.md]({{cookiecutter.repository_url}}/blob/main/README.dev.md#33-github) +2. Your package will get a DOI only after you make a release. Create a new release as described in [README.dev.md]({{repository_url}}/blob/main/README.dev.md#33-github) 3. At this point you should have a DOI. To find out the DOI generated by Zenodo: 1. Visit https://zenodo.org/deposit and click on your repository link 2. You will find the latest DOI in the right column in Versions box in **Cite all versions?** section diff --git a/template/.github/next_steps/05_linting.md.jinja b/template/.github/next_steps/05_linting.md.jinja index cc603833..3c1db2b7 100644 --- a/template/.github/next_steps/05_linting.md.jinja +++ b/template/.github/next_steps/05_linting.md.jinja @@ -2,9 +2,9 @@ title: 'Next step: Linting' --- -Your repository has a [workflow]({{ cookiecutter.repository_url }}/blob/main/.github/workflows/build.yml) which [lints](https://en.wikipedia.org/wiki/Lint_(software)) your code after every push and when creating a pull request. +Your repository has a [workflow]({{ repository_url }}/blob/main/.github/workflows/build.yml) which [lints](https://en.wikipedia.org/wiki/Lint_(software)) your code after every push and when creating a pull request. -Linter workflow may fail if `description` or `keywords` field in [pyproject.toml]({{ cookiecutter.repository_url }}/blob/main/pyproject.toml) is empty. Please update these fields. To validate your changes run: +Linter workflow may fail if `description` or `keywords` field in [pyproject.toml]({{ repository_url }}/blob/main/pyproject.toml) is empty. Please update these fields. To validate your changes run: ```shell ruff . diff --git a/template/.gitignore b/template/.gitignore index 57fb2ab9..baba4dd6 100644 --- a/template/.gitignore +++ b/template/.gitignore @@ -29,3 +29,5 @@ env env3 venv venv3 + +.swp diff --git a/template/CITATION.cff.jinja b/template/CITATION.cff.jinja index 88cb9c25..c4facdd5 100644 --- a/template/CITATION.cff.jinja +++ b/template/CITATION.cff.jinja @@ -1,19 +1,19 @@ # YAML 1.2 --- cff-version: "1.2.0" -title: "{{ cookiecutter.package_name }}" +title: "{{ package_name }}" authors: - - family-names: {{ cookiecutter.full_name.split(' ')[-1] }} - given-names: {{ cookiecutter.full_name.split(' ')[0] }} + family-names: {{ full_name.split(' ')[-1] }} + given-names: {{ full_name.split(' ')[0] }} orcid: "https://orcid.org/0000-0000-0000-0000" date-released: 20??-MM-DD doi: -version: "{{ cookiecutter.version }}" -repository-code: "{{ cookiecutter.repository_url }}" +version: "{{ version }}" +repository-code: "{{ repository_url }}" keywords: - - {{ cookiecutter.keyword1 }} - - {{ cookiecutter.keyword2 }} + - {{ keyword1 }} + - {{ keyword2 }} message: "If you use this software, please cite it using these metadata." {{ { "Apache Software License 2.0": "license: Apache-2.0", "MIT license": "license: MIT", @@ -21,4 +21,4 @@ message: "If you use this software, please cite it using these metadata." "ISC license": "license: ISC", "GNU General Public License v3 or later": "license: GPL-3.0-or-later", "Not open source": "" -}[cookiecutter.license] }} +}[license] }} diff --git a/template/CODE_OF_CONDUCT.md.jinja b/template/CODE_OF_CONDUCT.md.jinja index 500a1c9e..ed591351 100644 --- a/template/CODE_OF_CONDUCT.md.jinja +++ b/template/CODE_OF_CONDUCT.md.jinja @@ -55,7 +55,7 @@ further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at {{ cookiecutter.code_of_conduct_email }}. All +reported by contacting the project team at {{ code_of_conduct_email }}. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. diff --git a/template/CONTRIBUTING.md.jinja b/template/CONTRIBUTING.md.jinja index c3ec5d42..fe1b7e11 100644 --- a/template/CONTRIBUTING.md.jinja +++ b/template/CONTRIBUTING.md.jinja @@ -13,13 +13,13 @@ The sections below outline the steps in each case. ## You have a question -1. use the search functionality [here]({{cookiecutter.repository_url}}/issues) to see if someone already filed the same issue; +1. use the search functionality [here]({{repository_url}}/issues) to see if someone already filed the same issue; 2. if your issue search did not yield any relevant results, make a new issue; 3. apply the "Question" label; apply other labels when relevant. ## You think you may have found a bug -1. use the search functionality [here]({{cookiecutter.repository_url}}/issues) to see if someone already filed the same issue; +1. use the search functionality [here]({{repository_url}}/issues) to see if someone already filed the same issue; 1. if your issue search did not yield any relevant results, make a new issue, making sure to provide enough information to the rest of the community to understand the cause and context of the problem. Depending on the issue, you may want to include: - the [SHA hashcode](https://help.github.com/articles/autolinked-references-and-urls/#commit-shas) of the commit that is causing your problem; - some identifying information (name and version number) for dependencies you're using; @@ -36,7 +36,7 @@ The sections below outline the steps in each case. 1. add your own tests (if necessary); 1. update or expand the documentation; 1. update the `CHANGELOG.md` file with your change; -1. [push](http://rogerdudler.github.io/git-guide/) your feature branch to (your fork of) the {{ cookiecutter.package_name }} repository on GitHub; +1. [push](http://rogerdudler.github.io/git-guide/) your feature branch to (your fork of) the {{ package_name }} repository on GitHub; 1. create the pull request, e.g. following the instructions [here](https://help.github.com/articles/creating-a-pull-request/). In case you feel like you've made a valuable contribution, but you don't know how to write or run tests for it, or how to generate the documentation: don't let this discourage you from making the pull request; we can help you! Just go ahead and submit the pull request, but keep in mind that you might be asked to append additional commits to your pull request. @@ -46,23 +46,23 @@ In case you feel like you've made a valuable contribution, but you don't know ho To create a release you need write permission on the repository. 1. Check the author list in [`CITATION.cff`](CITATION.cff) -1. Bump the version using `bump-my-version bump `. For example, `bump-my-version bump major` will increase major version numbers everywhere it's needed (code, meta, etc.) in the repo. Alternatively the version can be manually changed in {{ cookiecutter.package_name }}/__init__.py, pyproject.toml, CITATION.cff and docs/conf.py (and other places it was possibly added). +1. Bump the version using `bump-my-version bump `. For example, `bump-my-version bump major` will increase major version numbers everywhere it's needed (code, meta, etc.) in the repo. Alternatively the version can be manually changed in {{ package_name }}/__init__.py, pyproject.toml, CITATION.cff and docs/conf.py (and other places it was possibly added). 1. Update the `CHANGELOG.md` to include changes made -1. Go to the [GitHub release page]({{ cookiecutter.repository_url }}/releases) +1. Go to the [GitHub release page]({{ repository_url }}/releases) 1. Press draft a new release button 1. Fill version, title and description field 1. Press the Publish Release button -Also a Zenodo entry will be made for the release with its own DOI. \ No newline at end of file +Also a Zenodo entry will be made for the release with its own DOI. diff --git a/template/NOTICE.jinja b/template/NOTICE.jinja index 3ddc2d32..6bfd7580 100644 --- a/template/NOTICE.jinja +++ b/template/NOTICE.jinja @@ -1,2 +1,2 @@ -This product includes {{ cookiecutter.package_name }}, software developed by -{{ cookiecutter.copyright_holder }}. +This product includes {{ package_name }}, software developed by +{{ copyright_holder }}. diff --git a/template/README.dev.md.jinja b/template/README.dev.md.jinja index b839f920..b108be81 100644 --- a/template/README.dev.md.jinja +++ b/template/README.dev.md.jinja @@ -1,4 +1,4 @@ -# `{{ cookiecutter.package_name }}` developer documentation +# `{{ package_name }}` developer documentation If you're looking for user documentation, go [here](README.md). @@ -15,7 +15,7 @@ source env/bin/activate python -m pip install --upgrade pip setuptools # (from the project root directory) -# install {{ cookiecutter.package_name }} as an editable package +# install {{ package_name }} as an editable package python -m pip install --no-cache-dir --editable . # install development dependencies python -m pip install --no-cache-dir --editable .[dev] @@ -35,7 +35,7 @@ The first way requires an activated virtual environment with the development too pytest -v ``` -The second is to use `tox`, which can be installed separately (e.g. with `pip install tox`), i.e. not necessarily inside the virtual environment you use for installing `{{ cookiecutter.package_name }}`, but then builds the necessary virtual environments itself by simply running: +The second is to use `tox`, which can be installed separately (e.g. with `pip install tox`), i.e. not necessarily inside the virtual environment you use for installing `{{ package_name }}`, but then builds the necessary virtual environments itself by simply running: ```shell tox @@ -64,7 +64,7 @@ coverage report ## Running linters locally -For linting and sorting imports we will use [ruff](https://beta.ruff.rs/docs/). Running the linters requires an +For linting and sorting imports we will use [ruff](https://beta.ruff.rs/docs/). Running the linters requires an activated virtual environment with the development tools installed. ```shell @@ -145,8 +145,8 @@ In a new terminal: ```shell # OPTIONAL: prepare a new directory with fresh git clone to ensure the release # has the state of origin/main branch -cd $(mktemp -d {{ cookiecutter.package_name }}.XXXXXX) -git clone {{ cookiecutter.repository }} . +cd $(mktemp -d {{ package_name }}.XXXXXX) +git clone {{ repository }} . # make sure to have a recent version of pip and the publishing dependencies python -m pip install --upgrade pip @@ -160,13 +160,13 @@ python -m twine upload --repository testpypi dist/* ``` Visit -[https://test.pypi.org/project/{{cookiecutter.package_name}}](https://test.pypi.org/project/{{cookiecutter.package_name}}) +[https://test.pypi.org/project/{{package_name}}](https://test.pypi.org/project/{{package_name}}) and verify that your package was uploaded successfully. Keep the terminal open, we'll need it later. In a new terminal, without an activated virtual environment or an env directory: ```shell -cd $(mktemp -d {{ cookiecutter.package_name }}-test.XXXXXX) +cd $(mktemp -d {{ package_name }}-test.XXXXXX) # prepare a clean virtual environment and activate it python -m venv env @@ -178,7 +178,7 @@ python -m pip install --upgrade pip # install from test pypi instance: python -m pip -v install --no-cache-dir \ --index-url https://test.pypi.org/simple/ \ ---extra-index-url https://pypi.org/simple {{ cookiecutter.package_name }} +--extra-index-url https://pypi.org/simple {{ package_name }} ``` Check that the package works as it should when installed from pypitest. @@ -193,4 +193,4 @@ python -m twine upload dist/* ### (3/3) GitHub -Don't forget to also make a [release on GitHub]({{cookiecutter.repository_url}}/releases/new). If your repository uses the GitHub-Zenodo integration this will also trigger Zenodo into making a snapshot of your repository and sticking a DOI on it. +Don't forget to also make a [release on GitHub]({{repository_url}}/releases/new). If your repository uses the GitHub-Zenodo integration this will also trigger Zenodo into making a snapshot of your repository and sticking a DOI on it. diff --git a/template/docs/Makefile.jinja b/template/docs/Makefile.jinja index 48ea1625..db428cf5 100644 --- a/template/docs/Makefile.jinja +++ b/template/docs/Makefile.jinja @@ -4,7 +4,7 @@ # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build -SPHINXPROJ = {{ cookiecutter.package_name }} +SPHINXPROJ = {{ package_name }} SOURCEDIR = . BUILDDIR = _build diff --git a/template/docs/conf.py.jinja b/template/docs/conf.py.jinja index c73e3d3b..530c4d8f 100644 --- a/template/docs/conf.py.jinja +++ b/template/docs/conf.py.jinja @@ -17,9 +17,9 @@ # -- Project information ----------------------------------------------------- -project = u"{{ cookiecutter.package_name }}" -copyright = u"{% now "local", "%Y" %}, {{ cookiecutter.copyright_holder }}" -author = u"{{ cookiecutter.full_name.replace('\"', '\\\"') }}" +project = u"{{ package_name }}" +copyright = u"{{ '%Y-%m-%d %H:%M:%S' | strftime }}, {{ copyright_holder }}" +author = u"{{ full_name.replace('\"', '\\\"') }}" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -61,7 +61,7 @@ todo_include_todos = False # -- Use autoapi.extension to run sphinx-apidoc ------- -autoapi_dirs = ['../src/{{ cookiecutter.package_name }}'] +autoapi_dirs = ['../src/{{ package_name }}'] # -- Options for HTML output ---------------------------------------------- diff --git a/template/docs/index.rst.jinja b/template/docs/index.rst.jinja index d4af697b..61a86b28 100644 --- a/template/docs/index.rst.jinja +++ b/template/docs/index.rst.jinja @@ -1,9 +1,9 @@ -.. {{ cookiecutter.package_name }} documentation master file, created by +.. {{ package_name }} documentation master file, created by sphinx-quickstart on Wed May 5 22:45:36 2021. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -Welcome to {{ cookiecutter.package_name }}'s documentation! +Welcome to {{ package_name }}'s documentation! ========================================================== .. toctree:: diff --git a/template/docs/make.bat.jinja b/template/docs/make.bat.jinja index 8176c5be..aa58b03f 100644 --- a/template/docs/make.bat.jinja +++ b/template/docs/make.bat.jinja @@ -9,7 +9,7 @@ if "%SPHINXBUILD%" == "" ( ) set SOURCEDIR=. set BUILDDIR=_build -set SPHINXPROJ={{ cookiecutter.package_name }} +set SPHINXPROJ={{ package_name }} if "%1" == "" goto help diff --git a/template/next_steps.md.jinja b/template/next_steps.md.jinja index c9710c54..a44875d6 100644 --- a/template/next_steps.md.jinja +++ b/template/next_steps.md.jinja @@ -14,19 +14,19 @@ Alternatively, you can also use a personal access token, see `git@github.com:` by `https://github.com/`. ```shell -cd {{ cookiecutter.directory_name }} +cd {{ directory_name }} git init git add --all git commit -m "first commit" git branch -M main -git remote add origin {{ cookiecutter.repository }} +git remote add origin {{ repository }} ``` ## Push the initial commit to a new repo on GitHub Go to -[https://github.com/organizations/{{cookiecutter.github_organization}}/repositories/new](https://github.com/organizations/{{cookiecutter.github_organization}}/repositories/new) -and create a new repository named `{{ cookiecutter.directory_name }}` as an empty repository, then push your commits to GitHub: +[https://github.com/organizations/{{github_organization}}/repositories/new](https://github.com/organizations/{{github_organization}}/repositories/new) +and create a new repository named `{{ directory_name }}` as an empty repository, then push your commits to GitHub: ```shell git push --set-upstream origin main @@ -35,7 +35,7 @@ git push --set-upstream origin main ## Check automatically generated issues A short while after you push your commits to GitHub for the first time, a few issues outlining next steps will added -automatically ([here]({{cookiecutter.repository_url}}/issues?q=author%3Aapp%2Fgithub-actions)). Resolve them to complete the +automatically ([here]({{repository_url}}/issues?q=author%3Aapp%2Fgithub-actions)). Resolve them to complete the setup of your repository. ## Project development documentation diff --git a/template/project_setup.md.jinja b/template/project_setup.md.jinja index 3d1b196e..ca065bf2 100644 --- a/template/project_setup.md.jinja +++ b/template/project_setup.md.jinja @@ -76,7 +76,7 @@ help you decide which tool to use for packaging. ## Package version number - We recommend using [semantic versioning](https://guide.esciencecenter.nl/#/best_practices/releases?id=semantic-versioning). -- For convenience, the package version is stored in a single place: `{{ cookiecutter.directory_name }}/pyproject.toml` under the `tool.bumpversion` header. +- For convenience, the package version is stored in a single place: `{{ directory_name }}/pyproject.toml` under the `tool.bumpversion` header. - Don't forget to update the version number before [making a release](https://guide.esciencecenter.nl/#/best_practices/releases)! ## Logging diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index ffdb0a0b..4298f46d 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta" [project] authors = [ - { name = "{{ cookiecutter.full_name }}", email = "{{ cookiecutter.email }}" } + { name = "{{ full_name }}", email = "{{ email }}" } ] classifiers = [ "Development Status :: 2 - Pre-Alpha", @@ -21,7 +21,7 @@ classifiers = [ 'ISC license': 'License :: OSI Approved :: ISC License (ISCL)', 'GNU General Public License v3 or later': 'License :: OSI Approved :: GNU General Public License', 'Not open source': 'License :: Other/Proprietary License' - }[cookiecutter.license] }}", + }[license] }}", "Natural Language :: English", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.8", @@ -31,16 +31,16 @@ classifiers = [ "Programming Language :: Python :: 3.12", ] dependencies = [] -description = "{{ cookiecutter.package_short_description }}" +description = "{{ package_short_description }}" keywords = [ - "{{ cookiecutter.keyword1 }}", - "{{ cookiecutter.keyword2 }}", + "{{ keyword1 }}", + "{{ keyword2 }}", ] license = {file = "LICENSE"} -name = "{{ cookiecutter.package_name }}" +name = "{{ package_name }}" readme = {file = "README.md", content-type = "text/markdown"} requires-python = ">=3.8" -version = "{{ cookiecutter.version }}" +version = "{{ version }}" [project.optional-dependencies] dev = [ @@ -69,24 +69,24 @@ publishing = [ ] [project.urls] -Repository = "{{ cookiecutter.repository_url }}" -Issues = "{{ cookiecutter.repository_url }}/issues" -Changelog = "{{ cookiecutter.repository_url }}/CHANGELOG.md" +Repository = "{{ repository_url }}" +Issues = "{{ repository_url }}/issues" +Changelog = "{{ repository_url }}/CHANGELOG.md" [tool.pytest.ini_options] testpaths = ["tests"] [tool.coverage.run] branch = true -source = ["src/{{ cookiecutter.package_name }}"] +source = ["src/{{ package_name }}"] command_line = "-m pytest" [tool.isort] lines_after_imports = 2 force_single_line = 1 no_lines_before = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"] -known_first_party = "{{ cookiecutter.package_name }}" -src_paths = ["src/{{ cookiecutter.package_name }}", "tests"] +known_first_party = "{{ package_name }}" +src_paths = ["src/{{ package_name }}", "tests"] line_length = 120 [tool.tox] @@ -170,15 +170,15 @@ target-version = "py39" line-length = 120 [tool.ruff.isort] -known-first-party = ["{{ cookiecutter.package_name }}"] +known-first-party = ["{{ package_name }}"] force-single-line = true no-lines-before = ["future","standard-library","third-party","first-party","local-folder"] [tool.bumpversion] -current_version = "{{ cookiecutter.version }}" +current_version = "{{ version }}" [[tool.bumpversion.files]] -filename = "src/{{ cookiecutter.package_name }}/__init__.py" +filename = "src/{{ package_name }}/__init__.py" [[tool.bumpversion.files]] filename = "pyproject.toml" diff --git a/template/sonar-project.properties.jinja b/template/sonar-project.properties.jinja index 512f6831..2455ef43 100644 --- a/template/sonar-project.properties.jinja +++ b/template/sonar-project.properties.jinja @@ -1,12 +1,12 @@ -sonar.organization={{ cookiecutter.github_organization }} -sonar.projectKey={{ cookiecutter.github_organization }}_{{ cookiecutter.directory_name }} +sonar.organization={{ github_organization }} +sonar.projectKey={{ github_organization }}_{{ directory_name }} sonar.host.url=https://sonarcloud.io -sonar.sources=src/{{ cookiecutter.package_name }}/ +sonar.sources=src/{{ package_name }}/ sonar.tests=tests/ -sonar.links.homepage={{ cookiecutter.repository_url }} -sonar.links.scm={{ cookiecutter.repository }} -sonar.links.issue={{ cookiecutter.repository_url }}/issues -sonar.links.ci={{ cookiecutter.repository_url }}/actions +sonar.links.homepage={{ repository_url }} +sonar.links.scm={{ repository }} +sonar.links.issue={{ repository_url }}/issues +sonar.links.ci={{ repository_url }}/actions sonar.python.coverage.reportPaths=coverage.xml sonar.python.xunit.reportPath=xunit-result.xml sonar.python.pylint.reportPaths=pylint-report.txt diff --git a/template/src/{{package_name}}/__init__.py.jinja b/template/src/{{package_name}}/__init__.py.jinja index 4a72a364..27c656dd 100644 --- a/template/src/{{package_name}}/__init__.py.jinja +++ b/template/src/{{package_name}}/__init__.py.jinja @@ -1,8 +1,8 @@ -"""Documentation about {{ cookiecutter.package_name }}.""" +"""Documentation about {{ package_name }}.""" import logging logging.getLogger(__name__).addHandler(logging.NullHandler()) -__author__ = "{{ cookiecutter.full_name }}" -__email__ = "{{ cookiecutter.email }}" -__version__ = "{{ cookiecutter.version }}" +__author__ = "{{ full_name }}" +__email__ = "{{ email }}" +__version__ = "{{ version }}" diff --git a/template/src/{{package_name}}/my_module.py.jinja b/template/src/{{package_name}}/my_module.py.jinja index 1ebf6f27..5b4ecff9 100644 --- a/template/src/{{package_name}}/my_module.py.jinja +++ b/template/src/{{package_name}}/my_module.py.jinja @@ -1,4 +1,4 @@ -"""Documentation about the {{ cookiecutter.package_name }} module.""" +"""Documentation about the {{ package_name }} module.""" # FIXME: put actual code here @@ -19,7 +19,7 @@ def hello(name): Example: This function can be called with `Jane Smith` as argument using - >>> from {{ cookiecutter.package_name }}.my_module import hello + >>> from {{ package_name }}.my_module import hello >>> hello('Jane Smith') 'Hello Jane Smith!' diff --git a/template/tests/test_my_module.py.jinja b/template/tests/test_my_module.py.jinja index ad6481d6..e9047790 100644 --- a/template/tests/test_my_module.py.jinja +++ b/template/tests/test_my_module.py.jinja @@ -1,6 +1,6 @@ -"""Tests for the {{ cookiecutter.package_name }}.my_module module.""" +"""Tests for the {{ package_name }}.my_module module.""" import pytest -from {{ cookiecutter.package_name }}.my_module import hello +from {{ package_name }}.my_module import hello def test_hello(): diff --git a/template/{% if license == 'Apache-2.0' %}LICENSE{% endif %}.jinja b/template/{% if license == 'Apache-2.0' %}LICENSE{% endif %}.jinja new file mode 100644 index 00000000..0183c52a --- /dev/null +++ b/template/{% if license == 'Apache-2.0' %}LICENSE{% endif %}.jinja @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + 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. diff --git a/template/{% if license == 'BSD license' %}LICENSE{% endif %}.jinja b/template/{% if license == 'BSD license' %}LICENSE{% endif %}.jinja new file mode 100644 index 00000000..c154409e --- /dev/null +++ b/template/{% if license == 'BSD license' %}LICENSE{% endif %}.jinja @@ -0,0 +1,30 @@ +BSD License + +Copyright (c) {{ '%Y' | strftime }}, {{ copyright_holder }} +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +* Neither the name of {{ package_name }} nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +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. + diff --git a/template/LICENSE.jinja b/template/{% if license == 'GNU General Public License v3 or later' %}LICENSE{% endif %}.jinja similarity index 60% rename from template/LICENSE.jinja rename to template/{% if license == 'GNU General Public License v3 or later' %}LICENSE{% endif %}.jinja index aa06a167..f288702d 100644 --- a/template/LICENSE.jinja +++ b/template/{% if license == 'GNU General Public License v3 or later' %}LICENSE{% endif %}.jinja @@ -1,255 +1,3 @@ -{% if cookiecutter.license == 'MIT license' %} -MIT License - -Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.copyright_holder }} - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 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.license == 'BSD license' %} -BSD License - -Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.copyright_holder }} -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or - other materials provided with the distribution. - -* Neither the name of {{ cookiecutter.package_name }} nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -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.license == 'ISC license' %} -ISC License - -Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.copyright_holder }} - -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.license == 'Apache Software License 2.0' %} - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - 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.license == 'GNU General Public License v3 or later' %} GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 @@ -924,170 +672,3 @@ may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . -{% elif cookiecutter.license == 'GNU Lesser General Public License v3 or later' %} - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. -{% endif %} diff --git a/template/{% if license == 'GNU Lesser General Public License v3 or later' %}LICENSE{% endif %}.jinja b/template/{% if license == 'GNU Lesser General Public License v3 or later' %}LICENSE{% endif %}.jinja new file mode 100644 index 00000000..7125e3e6 --- /dev/null +++ b/template/{% if license == 'GNU Lesser General Public License v3 or later' %}LICENSE{% endif %}.jinja @@ -0,0 +1,166 @@ +GNU LESSER GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + + +This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + +0. Additional Definitions. + +As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + +"The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + +An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + +A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + +The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + +The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + +1. Exception to Section 3 of the GNU GPL. + +You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + +2. Conveying Modified Versions. + +If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + +a) under this License, provided that you make a good faith effort to +ensure that, in the event an Application does not supply the +function or data, the facility still operates, and performs +whatever part of its purpose remains meaningful, or + +b) under the GNU GPL, with none of the additional permissions of +this License applicable to that copy. + +3. Object Code Incorporating Material from Library Header Files. + +The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + +a) Give prominent notice with each copy of the object code that the +Library is used in it and that the Library and its use are +covered by this License. + +b) Accompany the object code with a copy of the GNU GPL and this license +document. + +4. Combined Works. + +You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + +a) Give prominent notice with each copy of the Combined Work that +the Library is used in it and that the Library and its use are +covered by this License. + +b) Accompany the Combined Work with a copy of the GNU GPL and this license +document. + +c) For a Combined Work that displays copyright notices during +execution, include the copyright notice for the Library among +these notices, as well as a reference directing the user to the +copies of the GNU GPL and this license document. + +d) Do one of the following: + +0) Convey the Minimal Corresponding Source under the terms of this +License, and the Corresponding Application Code in a form +suitable for, and under terms that permit, the user to +recombine or relink the Application with a modified version of +the Linked Version to produce a modified Combined Work, in the +manner specified by section 6 of the GNU GPL for conveying +Corresponding Source. + +1) Use a suitable shared library mechanism for linking with the +Library. A suitable mechanism is one that (a) uses at run time +a copy of the Library already present on the user's computer +system, and (b) will operate properly with a modified version +of the Library that is interface-compatible with the Linked +Version. + +e) Provide Installation Information, but only if you would otherwise +be required to provide such information under section 6 of the +GNU GPL, and only to the extent that such information is +necessary to install and execute a modified version of the +Combined Work produced by recombining or relinking the +Application with a modified version of the Linked Version. (If +you use option 4d0, the Installation Information must accompany +the Minimal Corresponding Source and Corresponding Application +Code. If you use option 4d1, you must provide the Installation +Information in the manner specified by section 6 of the GNU GPL +for conveying Corresponding Source.) + +5. Combined Libraries. + +You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + +a) Accompany the combined library with a copy of the same work based +on the Library, uncombined with any other library facilities, +conveyed under the terms of this License. + +b) Give prominent notice with the combined library that part of it +is a work based on the Library, and explaining where to find the +accompanying uncombined form of the same work. + +6. Revised Versions of the GNU Lesser General Public License. + +The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + +If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. \ No newline at end of file diff --git a/template/{% if license == 'ISC license' %}LICENSE{% endif %}.jinja b/template/{% if license == 'ISC license' %}LICENSE{% endif %}.jinja new file mode 100644 index 00000000..137e91fa --- /dev/null +++ b/template/{% if license == 'ISC license' %}LICENSE{% endif %}.jinja @@ -0,0 +1,12 @@ +ISC License + +Copyright (c) {{ '%Y' | strftime }}, {{ copyright_holder }} + +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. diff --git a/template/{% if license == 'MIT licence' %}LICENSE{% endif %}.jinja b/template/{% if license == 'MIT licence' %}LICENSE{% endif %}.jinja new file mode 100644 index 00000000..416f547d --- /dev/null +++ b/template/{% if license == 'MIT licence' %}LICENSE{% endif %}.jinja @@ -0,0 +1,16 @@ +MIT License + +Copyright (c) {{ '%Y' | strftime }}, {{ copyright_holder }} + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 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. \ No newline at end of file diff --git a/template/{% if license == 'Not open source' %}LICENSE{% endif %}.jinja b/template/{% if license == 'Not open source' %}LICENSE{% endif %}.jinja new file mode 100644 index 00000000..f816229f --- /dev/null +++ b/template/{% if license == 'Not open source' %}LICENSE{% endif %}.jinja @@ -0,0 +1 @@ +Not open source diff --git a/template/{{_copier_conf.answers_file}}.jinja b/template/{{_copier_conf.answers_file}}.jinja new file mode 100644 index 00000000..ea97bd4b --- /dev/null +++ b/template/{{_copier_conf.answers_file}}.jinja @@ -0,0 +1,2 @@ +# Changes here will be overwritten by Copier +{{ _copier_answers|to_nice_yaml -}} \ No newline at end of file diff --git a/tests/test_project.py b/tests/test_project.py index 1163013b..a9cbbdcd 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -4,18 +4,19 @@ from sys import platform from typing import Sequence +from pyprojroot.here import here +from copier import run_copy import pytest IS_WINDOWS = platform.startswith('win') -def test_project_folder(cookies): - project = cookies.bake() +def test_project_folder(copie): + project = copie.copy() assert project.exit_code == 0 assert project.exception is None - assert project.project_path.name == 'my-python-project' - assert project.project_path.is_dir() + assert project.project_dir.is_dir() def run(args: Sequence[str], dirpath: os.PathLike) -> subprocess.CompletedProcess: @@ -41,15 +42,16 @@ def project_env_bin_dir(tmp_path_factory): @pytest.fixture(scope='session') -def baked_with_development_dependencies(cookies_session, project_env_bin_dir): - result = cookies_session.bake() - assert result.exit_code == 0 +def baked_with_development_dependencies(tmp_path_factory, project_env_bin_dir): + project = run_copy(src_path=str(here()), dst_path=str(tmp_path_factory.mktemp('projects')), defaults=True) + project_dir = project.dst_path + bin_dir = project_env_bin_dir - latest_pip_output = run([f'{bin_dir}python', '-m', 'pip', 'install', '--upgrade', 'pip', 'setuptools'], result.project_path) + latest_pip_output = run([f'{bin_dir}python', '-m', 'pip', 'install', '--upgrade', 'pip', 'setuptools'], project_dir) assert latest_pip_output.returncode == 0 - pip_output = run([f'{bin_dir}python', '-m', 'pip', 'install', '--editable', '.[dev]'], result.project_path) + pip_output = run([f'{bin_dir}python', '-m', 'pip', 'install', '--editable', '.[dev]'], project_dir) assert pip_output.returncode == 0 - return result.project_path + return project_dir def test_pytest(baked_with_development_dependencies, project_env_bin_dir): @@ -167,7 +169,7 @@ def test_ruff_check(baked_with_development_dependencies, project_env_bin_dir): project_dir = baked_with_development_dependencies bin_dir = project_env_bin_dir - result = run([f'{bin_dir}ruff', '.'], project_dir) + result = run([f'{bin_dir}ruff', 'check', '.'], project_dir) assert result.returncode == 0 assert '' in result.stdout diff --git a/tests/test_values.py b/tests/test_values.py index 01d748a9..1f240323 100644 --- a/tests/test_values.py +++ b/tests/test_values.py @@ -1,36 +1,36 @@ -def test_double_quotes_in_name_and_description(cookies): +def test_double_quotes_in_name_and_description(copie): ctx = { "project_short_description": '"double quotes"', "full_name": '"name"name' } - project = cookies.bake(extra_context=ctx) + project = copie.copy(extra_answers=ctx) assert project.exit_code == 0 -def test_single_quotes_in_name_and_description(cookies): +def test_single_quotes_in_name_and_description(copie): ctx = { "project_short_description": "'single quotes'", "full_name": "Mr. O'Keefe" } - project = cookies.bake(extra_context=ctx) + project = copie.copy(extra_answers=ctx) assert project.exit_code == 0 -def test_dash_in_directory_name(cookies): +def test_dash_in_directory_name(copie): ctx = { "directory_name": "my-python-project" } - project = cookies.bake(extra_context=ctx) + project = copie.copy(extra_answers=ctx) assert project.exit_code == 0 -def test_space_in_directory_name(cookies): +def test_space_in_directory_name(copie): ctx = { "directory_name": "my python project" } - project = cookies.bake(extra_context=ctx) + project = copie.copy(extra_answers=ctx) assert project.exit_code == 0 From d8ad6a86e29b9acdc2d0fdac216a8ae4806da59d Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Tue, 30 Jul 2024 13:53:26 +0200 Subject: [PATCH 003/285] Update template/README.md.jinja to copier --- template/README.md.jinja | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/template/README.md.jinja b/template/README.md.jinja index 0e5e2918..4ffb4ea4 100644 --- a/template/README.md.jinja +++ b/template/README.md.jinja @@ -4,35 +4,35 @@ | fair-software.eu recommendations | | | :-- | :-- | -| (1/5) code repository | [![github repo badge](https://img.shields.io/badge/github-repo-000.svg?logo=github&labelColor=gray&color=blue)]({{cookiecutter.repository_url}}) | -| (2/5) license | [![github license badge](https://img.shields.io/github/license/{{cookiecutter.github_organization}}/{{cookiecutter.directory_name}})]({{cookiecutter.repository_url}}) | -| (3/5) community registry | [![RSD](https://img.shields.io/badge/rsd-{{cookiecutter.package_name}}-00a3e3.svg)](https://www.research-software.nl/software/{{cookiecutter.package_name}}) [![workflow pypi badge](https://img.shields.io/pypi/v/{{cookiecutter.package_name}}.svg?colorB=blue)](https://pypi.python.org/project/{{cookiecutter.package_name}}/) | +| (1/5) code repository | [![github repo badge](https://img.shields.io/badge/github-repo-000.svg?logo=github&labelColor=gray&color=blue)]({{repository_url}}) | +| (2/5) license | [![github license badge](https://img.shields.io/github/license/{{github_organization}}/{{directory_name}})]({{repository_url}}) | +| (3/5) community registry | [![RSD](https://img.shields.io/badge/rsd-{{package_name}}-00a3e3.svg)](https://www.research-software.nl/software/{{package_name}}) [![workflow pypi badge](https://img.shields.io/pypi/v/{{package_name}}.svg?colorB=blue)](https://pypi.python.org/project/{{package_name}}/) | | (4/5) citation | [![DOI](https://zenodo.org/badge/DOI/.svg)](https://doi.org/) | | (5/5) checklist | [![workflow cii badge](https://bestpractices.coreinfrastructure.org/projects//badge)](https://bestpractices.coreinfrastructure.org/projects/) | | howfairis | [![fair-software badge](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8B-yellow)](https://fair-software.eu) | | **Other best practices** |   | -| Static analysis | [![workflow scq badge](https://sonarcloud.io/api/project_badges/measure?project={{cookiecutter.github_organization}}_{{cookiecutter.directory_name}}&metric=alert_status)](https://sonarcloud.io/dashboard?id={{cookiecutter.github_organization}}_{{cookiecutter.directory_name}}) | -| Coverage | [![workflow scc badge](https://sonarcloud.io/api/project_badges/measure?project={{cookiecutter.github_organization}}_{{cookiecutter.directory_name}}&metric=coverage)](https://sonarcloud.io/dashboard?id={{cookiecutter.github_organization}}_{{cookiecutter.directory_name}}) | -| Documentation | [![Documentation Status](https://readthedocs.org/projects/{{cookiecutter.directory_name}}/badge/?version=latest)](https://{{cookiecutter.directory_name}}.readthedocs.io/en/latest/?badge=latest) | +| Static analysis | [![workflow scq badge](https://sonarcloud.io/api/project_badges/measure?project={{github_organization}}_{{directory_name}}&metric=alert_status)](https://sonarcloud.io/dashboard?id={{github_organization}}_{{directory_name}}) | +| Coverage | [![workflow scc badge](https://sonarcloud.io/api/project_badges/measure?project={{github_organization}}_{{directory_name}}&metric=coverage)](https://sonarcloud.io/dashboard?id={{github_organization}}_{{directory_name}}) | +| Documentation | [![Documentation Status](https://readthedocs.org/projects/{{directory_name}}/badge/?version=latest)](https://{{directory_name}}.readthedocs.io/en/latest/?badge=latest) | | **GitHub Actions** |   | -| Build | [![build]({{cookiecutter.repository_url}}/actions/workflows/build.yml/badge.svg)]({{cookiecutter.repository_url}}/actions/workflows/build.yml) | -| Citation data consistency | [![cffconvert]({{cookiecutter.repository_url}}/actions/workflows/cffconvert.yml/badge.svg)]({{cookiecutter.repository_url}}/actions/workflows/cffconvert.yml) | -| SonarCloud | [![sonarcloud]({{cookiecutter.repository_url}}/actions/workflows/sonarcloud.yml/badge.svg)]({{cookiecutter.repository_url}}/actions/workflows/sonarcloud.yml) | -| MarkDown link checker | [![markdown-link-check]({{cookiecutter.repository_url}}/actions/workflows/markdown-link-check.yml/badge.svg)]({{cookiecutter.repository_url}}/actions/workflows/markdown-link-check.yml) | +| Build | [![build]({{repository_url}}/actions/workflows/build.yml/badge.svg)]({{repository_url}}/actions/workflows/build.yml) | +| Citation data consistency | [![cffconvert]({{repository_url}}/actions/workflows/cffconvert.yml/badge.svg)]({{repository_url}}/actions/workflows/cffconvert.yml) | +| SonarCloud | [![sonarcloud]({{repository_url}}/actions/workflows/sonarcloud.yml/badge.svg)]({{repository_url}}/actions/workflows/sonarcloud.yml) | +| MarkDown link checker | [![markdown-link-check]({{repository_url}}/actions/workflows/markdown-link-check.yml/badge.svg)]({{repository_url}}/actions/workflows/markdown-link-check.yml) | -## How to use {{ cookiecutter.package_name }} +## How to use {{ package_name }} -{{ cookiecutter.package_short_description }} +{{ package_short_description }} The project setup is documented in [project_setup.md](project_setup.md). Feel free to remove this document (and/or the link to this document) if you don't need it. ## Installation -To install {{ cookiecutter.package_name }} from GitHub repository, do: +To install {{ package_name }} from GitHub repository, do: ```console -git clone {{ cookiecutter.repository }}.git -cd {{ cookiecutter.directory_name }} +git clone {{ repository }}.git +cd {{ directory_name }} python -m pip install . ``` @@ -42,9 +42,9 @@ Include a link to your project's full documentation here. ## Contributing -If you want to contribute to the development of {{ cookiecutter.package_name }}, +If you want to contribute to the development of {{ package_name }}, have a look at the [contribution guidelines](CONTRIBUTING.md). ## Credits -This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [NLeSC/python-template](https://github.com/NLeSC/python-template). +This package was created with [Copier](https://github.com/copier-org/copier) and the [NLeSC/python-template](https://github.com/NLeSC/python-template). From 39d374cdedec20a2c581bebf9653dc784e649f2c Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Tue, 30 Jul 2024 15:44:11 +0200 Subject: [PATCH 004/285] Update README.md to use copier --- README.md | 123 ++++++++++++++++++++++++++---------------------------- 1 file changed, 60 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index 181db8c8..ff88a784 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,27 @@ # Netherlands eScience Center Python Template -Spend less time setting up and configuring your new Python packages and comply with the -[Netherlands eScience Center Software Development Guide](https://guide.esciencecenter.nl/) -from the start. +Spend less time setting up and configuring your new Python packages and comply with the [Netherlands eScience Center Software Development Guide](https://guide.esciencecenter.nl/) from the start. -Use this [Cookiecutter](https://cookiecutter.readthedocs.io) template to generate -an empty Python package. Features include: +Use this [Copier](https://copier.readthedocs.io) template to generate an empty Python package. Features include: - Boilerplate unit tests and documentation, - [Python static setup configuration]({{directory_name}}/pyproject.toml), - Open source software license, -- Continuous integration with [GitHub action workflows]({{cookiecutter.directory_name}}/.github/workflows) for building, testing, link checking and linting, +- Continuous integration with [GitHub action workflows]({{directory_name}}/.github/workflows) for building, testing, link checking and linting, - Code style checking with [ruff](https://beta.ruff.rs/), -- [Editorconfig]({{cookiecutter.directory_name}}/.editorconfig), +- [Editorconfig]({{directory_name}}/.editorconfig), - Usage and contribution documents: - - [README.md]({{cookiecutter.directory_name}}/README.md) for package users, - - [README.dev.md]({{cookiecutter.directory_name}}/README.dev.md) for package developer, - - [project_setup.md]({{cookiecutter.directory_name}}/project_setup.md) with extensive documentation about project setup, - - [Change log]({{cookiecutter.directory_name}}/CHANGELOG.md), - - [Code of Conduct]({{cookiecutter.directory_name}}/CODE_OF_CONDUCT.md), - - [Contributing guidelines]({{cookiecutter.directory_name}}/CONTRIBUTING.md), + - [README.md]({{directory_name}}/README.md) for package users, + - [README.dev.md]({{directory_name}}/README.dev.md) for package developer, + - [project_setup.md]({{directory_name}}/project_setup.md) with extensive documentation about project setup, + - [Change log]({{directory_name}}/CHANGELOG.md), + - [Code of Conduct]({{directory_name}}/CODE_OF_CONDUCT.md), + - [Contributing guidelines]({{directory_name}}/CONTRIBUTING.md), - Continuous code quality and code coverage reporting using [Sonarcloud](https://sonarcloud.io/), -- Automatic creation of [issues]({{cookiecutter.directory_name}}/.github/next_steps) with instructions how to pass all GitHub action workflows and integrate with services like Zenodo and Read the Docs, -- Instructions how to make package [citable]({{cookiecutter.directory_name}}/.github/next_steps/02_citation.md) +- Automatic creation of [issues]({{directory_name}}/.github/next_steps) with instructions how to pass all GitHub action workflows and integrate with services like Zenodo and Read the Docs, +- Instructions how to make package [citable]({{directory_name}}/.github/next_steps/02_citation.md) - FAIR software recommendation badge, -- Optional [pre commit hook]({{cookiecutter.directory_name}}/README.dev.md#running-linters-locally) to catch lint errors early +- Optional [pre commit hook]({{directory_name}}/README.dev.md#running-linters-locally) to catch lint errors early ## Badges @@ -45,24 +42,21 @@ an empty Python package. Features include: ## How to use -### Step 1/3: Install `cookiecutter` - -We recommend installing `cookiecutter` in user space as per `cookiecutter`'s instructions. This way, you don't have to -install `cookiecutter` for every new project. +### Step 1/3: Install `copier` ```shell -python -m pip install --user --upgrade cookiecutter +pipx install copier ``` ### Step 2/3: Generate the files and directory structure -Run `cookiecutter` with the template: +Run `copier` with the template: ```shell # Notes: # 1. See table below for explanation of each question # 2. The files will be generated in a new directory -cookiecutter https://github.com/nlesc/python-template.git +copier copy https://github.com/nlesc/python-template.git path/to/destination ``` | Name | Default value | Explanation | @@ -81,64 +75,67 @@ cookiecutter https://github.com/nlesc/python-template.git | code_of_conduct_email | yourname@esciencecenter.nl | Email address of the person who should be contacted in case of violations of the Code of Conduct. | Once the project files have been generated, follow the steps outlined in -[{{cookiecutter.directory_name}}/next_steps.md]({{cookiecutter.directory_name}}/next_steps.md). +[{{directory_name}}/next_steps.md]({{directory_name}}/next_steps.md). ### Step 3/3: Read about what was just generated Good job! You have now generated the skeleton for your package: ```text -my-python-project/ -├── .editorconfig -├── .githooks -│ └── pre-commit -├── .github -│ ├── next_steps -│ │ ├── 01_sonarcloud_integration.md -│ │ ├── 02_citation.md -│ │ ├── 03_readthedocs.md -│ │ ├── 04_zenodo_integration.md -│ │ └── 05_linting.md -│ └── workflows -│ ├── build.yml -│ ├── cffconvert.yml -│ ├── documentation.yml -│ ├── markdown-link-check.yml -│ ├── next_steps.yml -│ └── sonarcloud.yml -├── .gitignore -├── .mlc-config.json -├── .readthedocs.yaml +. ├── CHANGELOG.md ├── CITATION.cff ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md -├── LICENSE -├── MANIFEST.in -├── NOTICE -├── README.dev.md -├── README.md +├── .copier-answers.yml ├── docs -│ ├── Makefile -│ ├── _templates -│ │ └── .gitignore -│ ├── conf.py -│ ├── index.rst -│ └── make.bat +│   ├── conf.py +│   ├── index.rst +│   ├── make.bat +│   ├── Makefile +│   └── _templates +│   └── .gitignore +├── .editorconfig +├── .githooks +│   └── pre-commit +├── .github +│   ├── next_steps +│   │   ├── 01_sonarcloud_integration.md +│   │   ├── 02_citation.md +│   │   ├── 03_readthedocs.md +│   │   ├── 04_zenodo_integration.md +│   │   └── 05_linting.md +│   └── workflows +│   ├── build.yml +│   ├── cffconvert.yml +│   ├── documentation.yml +│   ├── markdown-link-check.yml +│   ├── next_steps.yml +│   └── sonarcloud.yml +├── .gitignore +├── MANIFEST.in +├── .mlc-config.json ├── next_steps.md +├── NOTICE ├── project_setup.md ├── pyproject.toml +├── README.dev.md +├── README.md +├── .readthedocs.yaml ├── sonar-project.properties ├── src -│ └── my_python_package -│ ├── __init__.py -│ └── my_module.py -└── tests - ├── __init__.py - └── test_my_module.py +│   └── my_python_package +│   ├── __init__.py +│   └── my_module.py +├── tests +│   ├── __init__.py +│   ├── test_my_module.py +│   ├── test_project.py +│   └── test_values.py +└── .zenodo.json ``` -For an explanation of what's there, read on in the [project_setup.md]({{cookiecutter.directory_name}}/project_setup.md) file. +For an explanation of what's there, read on in the [project_setup.md]({{directory_name}}/project_setup.md) file. There are also instructions on how to [apply the template to an existing Python package](ADD_TO_EXISTING_PACKAGE.md). ## Examples From 7c89fe9834875706e35571c844bdc42d51992c82 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Thu, 1 Aug 2024 11:09:22 +0200 Subject: [PATCH 005/285] Handle directory_name --- README.md | 31 +++++++++---------- copier.yml | 12 +++---- setup.cfg | 2 +- .../01_sonarcloud_integration.md.jinja | 4 +-- .../next_steps/03_readthedocs.md.jinja | 4 +-- template/README.md.jinja | 10 +++--- template/next_steps.md.jinja | 4 +-- template/project_setup.md.jinja | 2 +- template/sonar-project.properties.jinja | 2 +- tests/test_values.py | 18 ----------- 10 files changed, 35 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index ff88a784..ec98a601 100644 --- a/README.md +++ b/README.md @@ -5,23 +5,23 @@ Spend less time setting up and configuring your new Python packages and comply w Use this [Copier](https://copier.readthedocs.io) template to generate an empty Python package. Features include: - Boilerplate unit tests and documentation, -- [Python static setup configuration]({{directory_name}}/pyproject.toml), +- [Python static setup configuration](template/pyproject.toml), - Open source software license, -- Continuous integration with [GitHub action workflows]({{directory_name}}/.github/workflows) for building, testing, link checking and linting, +- Continuous integration with [GitHub action workflows](template/.github/workflows) for building, testing, link checking and linting, - Code style checking with [ruff](https://beta.ruff.rs/), -- [Editorconfig]({{directory_name}}/.editorconfig), +- [Editorconfig](template/.editorconfig), - Usage and contribution documents: - - [README.md]({{directory_name}}/README.md) for package users, - - [README.dev.md]({{directory_name}}/README.dev.md) for package developer, - - [project_setup.md]({{directory_name}}/project_setup.md) with extensive documentation about project setup, - - [Change log]({{directory_name}}/CHANGELOG.md), - - [Code of Conduct]({{directory_name}}/CODE_OF_CONDUCT.md), - - [Contributing guidelines]({{directory_name}}/CONTRIBUTING.md), + - [README.md](template/README.md) for package users, + - [README.dev.md](template/README.dev.md) for package developer, + - [project_setup.md](template/project_setup.md) with extensive documentation about project setup, + - [Change log](template/CHANGELOG.md), + - [Code of Conduct](template/CODE_OF_CONDUCT.md), + - [Contributing guidelines](template/CONTRIBUTING.md), - Continuous code quality and code coverage reporting using [Sonarcloud](https://sonarcloud.io/), -- Automatic creation of [issues]({{directory_name}}/.github/next_steps) with instructions how to pass all GitHub action workflows and integrate with services like Zenodo and Read the Docs, -- Instructions how to make package [citable]({{directory_name}}/.github/next_steps/02_citation.md) +- Automatic creation of [issues](template/.github/next_steps) with instructions how to pass all GitHub action workflows and integrate with services like Zenodo and Read the Docs, +- Instructions how to make package [citable](template/.github/next_steps/02_citation.md) - FAIR software recommendation badge, -- Optional [pre commit hook]({{directory_name}}/README.dev.md#running-linters-locally) to catch lint errors early +- Optional [pre commit hook](template/README.dev.md#running-linters-locally) to catch lint errors early ## Badges @@ -61,8 +61,7 @@ copier copy https://github.com/nlesc/python-template.git path/to/destination | Name | Default value | Explanation | | ------------------------- | ------------- | ----------- | -| directory_name | my-python-project | Name of the directory that contains the package. Avoid using spaces or uppercase letters for the best experience across operating systems. To get an impression of what will be generated, see the directory tree [below](https://github.com/NLeSC/python-template#step-33-read-about-what-was-just-generated) | -| package_name | my_python_package | Name of the package. Avoid using spaces, dashes, or uppercase letters for the best experience across operating systems. | +| package_name | my_python_package | Name of the package. Avoid using spaces, dashes, or uppercase letters for the best experience across operating systems. This also will be used as the github repository name.| | package_short_description | Short description of package | The information that you enter here will end up in the README, documentation, license, and pyproject.toml, so it may be a good idea to prepare something in advance. | | keyword1 | keyword1 | A term that describes your package. | | keyword2 | keyword2 | Another term that describes your package. | @@ -75,7 +74,7 @@ copier copy https://github.com/nlesc/python-template.git path/to/destination | code_of_conduct_email | yourname@esciencecenter.nl | Email address of the person who should be contacted in case of violations of the Code of Conduct. | Once the project files have been generated, follow the steps outlined in -[{{directory_name}}/next_steps.md]({{directory_name}}/next_steps.md). +[template/next_steps.md](template/next_steps.md). ### Step 3/3: Read about what was just generated @@ -135,7 +134,7 @@ Good job! You have now generated the skeleton for your package: └── .zenodo.json ``` -For an explanation of what's there, read on in the [project_setup.md]({{directory_name}}/project_setup.md) file. +For an explanation of what's there, read on in the [project_setup.md](template/project_setup.md) file. There are also instructions on how to [apply the template to an existing Python package](ADD_TO_EXISTING_PACKAGE.md). ## Examples diff --git a/copier.yml b/copier.yml index 77fc3fd3..8359c1f1 100644 --- a/copier.yml +++ b/copier.yml @@ -11,10 +11,10 @@ package_name: package_short_description: type: str default: Short description of package - # validator: >- - # {% if '"' in package_short_description %} - # package_short_description must not contain unescaped double quotes. Use \\" for double quotes. - # {% endif %} + validator: >- + {% if (package_short_description | regex_replace ('"', '\\\\"')|regex_replace ("'", "\\\\'")%} + package_short_description must not contain unescaped double or single quotes. + {% endif %} keyword1: type: str default: keyword1 @@ -59,11 +59,11 @@ code_of_conduct_email: _subdirectory: template repository: - default: git@github.com:{{ github_organization }}/{{ directory_name }} + default: git@github.com:{{ github_organization }}/{{ package_name }} when: false repository_url: - default: https://github.com/{{ github_organization }}/{{ directory_name }} + default: https://github.com/{{ github_organization }}/{{ package_name }} when: false diff --git a/setup.cfg b/setup.cfg index b6b2cb16..d52e15ba 100644 --- a/setup.cfg +++ b/setup.cfg @@ -51,4 +51,4 @@ dev = [tool:pytest] testpaths = tests -norecursedirs = .git .github hooks {{directory_name}} +norecursedirs = .git .github hooks template diff --git a/template/.github/next_steps/01_sonarcloud_integration.md.jinja b/template/.github/next_steps/01_sonarcloud_integration.md.jinja index 152edb6b..bcc69ce0 100644 --- a/template/.github/next_steps/01_sonarcloud_integration.md.jinja +++ b/template/.github/next_steps/01_sonarcloud_integration.md.jinja @@ -10,7 +10,7 @@ In order to configure Sonarcloud analysis [GitHub Action workflow]({{repository_ 1. login with your GitHub account 1. add Sonarcloud organization or reuse existing one 1. set up a repository -1. go to [new code definition administration page](https://sonarcloud.io/project/new_code?id={{github_organization}}_{{directory_name}}) and select `Number of days` option +1. go to [new code definition administration page](https://sonarcloud.io/project/new_code?id={{github_organization}}_{{package_name}}) and select `Number of days` option 1. To be able to run the analysis: 1. a token must be created at [Sonarcloud account](https://sonarcloud.io/account/security/) - 1. the created token must be added as `SONAR_TOKEN` to [secrets on GitHub](https://github.com/{{github_organization}}/{{directory_name}}/settings/secrets/actions) + 1. the created token must be added as `SONAR_TOKEN` to [secrets on GitHub](https://github.com/{{github_organization}}/{{package_name}}/settings/secrets/actions) diff --git a/template/.github/next_steps/03_readthedocs.md.jinja b/template/.github/next_steps/03_readthedocs.md.jinja index 5c7917d0..5648c020 100644 --- a/template/.github/next_steps/03_readthedocs.md.jinja +++ b/template/.github/next_steps/03_readthedocs.md.jinja @@ -9,12 +9,12 @@ To host the documentation of this repository please perform the following instru 1. go to [Read the Docs](https://readthedocs.org/dashboard/import/?) 1. log in with your GitHub account -1. find `{{ github_organization }}/{{ directory_name }}` in list and press `+` button. +1. find `{{ github_organization }}/{{ package_name }}` in list and press `+` button. * If repository is not listed, 1. go to [Read the Docs GitHub app](https://github.com/settings/connections/applications/fae83c942bc1d89609e2) 2. make sure {{ github_organization }} has been granted access. 3. reload repository list on Read the Docs import page -1. wait for the first build to be completed at +1. wait for the first build to be completed at 1. check that the link of the documentation badge in the [README.md]({{ repository_url }}) works See [README.dev.md#]({{repository_url}}/blob/main/README.dev.md#generating-the-api-docs) how to build documentation site locally. diff --git a/template/README.md.jinja b/template/README.md.jinja index 4ffb4ea4..8093442c 100644 --- a/template/README.md.jinja +++ b/template/README.md.jinja @@ -5,15 +5,15 @@ | fair-software.eu recommendations | | | :-- | :-- | | (1/5) code repository | [![github repo badge](https://img.shields.io/badge/github-repo-000.svg?logo=github&labelColor=gray&color=blue)]({{repository_url}}) | -| (2/5) license | [![github license badge](https://img.shields.io/github/license/{{github_organization}}/{{directory_name}})]({{repository_url}}) | +| (2/5) license | [![github license badge](https://img.shields.io/github/license/{{github_organization}}/{{package_name}})]({{repository_url}}) | | (3/5) community registry | [![RSD](https://img.shields.io/badge/rsd-{{package_name}}-00a3e3.svg)](https://www.research-software.nl/software/{{package_name}}) [![workflow pypi badge](https://img.shields.io/pypi/v/{{package_name}}.svg?colorB=blue)](https://pypi.python.org/project/{{package_name}}/) | | (4/5) citation | [![DOI](https://zenodo.org/badge/DOI/.svg)](https://doi.org/) | | (5/5) checklist | [![workflow cii badge](https://bestpractices.coreinfrastructure.org/projects//badge)](https://bestpractices.coreinfrastructure.org/projects/) | | howfairis | [![fair-software badge](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8B-yellow)](https://fair-software.eu) | | **Other best practices** |   | -| Static analysis | [![workflow scq badge](https://sonarcloud.io/api/project_badges/measure?project={{github_organization}}_{{directory_name}}&metric=alert_status)](https://sonarcloud.io/dashboard?id={{github_organization}}_{{directory_name}}) | -| Coverage | [![workflow scc badge](https://sonarcloud.io/api/project_badges/measure?project={{github_organization}}_{{directory_name}}&metric=coverage)](https://sonarcloud.io/dashboard?id={{github_organization}}_{{directory_name}}) | -| Documentation | [![Documentation Status](https://readthedocs.org/projects/{{directory_name}}/badge/?version=latest)](https://{{directory_name}}.readthedocs.io/en/latest/?badge=latest) | +| Static analysis | [![workflow scq badge](https://sonarcloud.io/api/project_badges/measure?project={{github_organization}}_{{package_name}}&metric=alert_status)](https://sonarcloud.io/dashboard?id={{github_organization}}_{{package_name}}) | +| Coverage | [![workflow scc badge](https://sonarcloud.io/api/project_badges/measure?project={{github_organization}}_{{package_name}}&metric=coverage)](https://sonarcloud.io/dashboard?id={{github_organization}}_{{package_name}}) | +| Documentation | [![Documentation Status](https://readthedocs.org/projects/{{package_name}}/badge/?version=latest)](https://{{package_name}}.readthedocs.io/en/latest/?badge=latest) | | **GitHub Actions** |   | | Build | [![build]({{repository_url}}/actions/workflows/build.yml/badge.svg)]({{repository_url}}/actions/workflows/build.yml) | | Citation data consistency | [![cffconvert]({{repository_url}}/actions/workflows/cffconvert.yml/badge.svg)]({{repository_url}}/actions/workflows/cffconvert.yml) | @@ -32,7 +32,7 @@ To install {{ package_name }} from GitHub repository, do: ```console git clone {{ repository }}.git -cd {{ directory_name }} +cd {{ package_name }} python -m pip install . ``` diff --git a/template/next_steps.md.jinja b/template/next_steps.md.jinja index a44875d6..8d0aa499 100644 --- a/template/next_steps.md.jinja +++ b/template/next_steps.md.jinja @@ -13,8 +13,8 @@ Alternatively, you can also use a personal access token, see [Creating a personal access token](https://docs.github.com/en/github-ae@latest/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token). If you choose this option, below you will have to replace `git@github.com:` by `https://github.com/`. +Inside of the generated directory, run the following commands: ```shell -cd {{ directory_name }} git init git add --all git commit -m "first commit" @@ -26,7 +26,7 @@ git remote add origin {{ repository }} Go to [https://github.com/organizations/{{github_organization}}/repositories/new](https://github.com/organizations/{{github_organization}}/repositories/new) -and create a new repository named `{{ directory_name }}` as an empty repository, then push your commits to GitHub: +and create a new repository named `{{ package_name }}` as an empty repository, then push your commits to GitHub: ```shell git push --set-upstream origin main diff --git a/template/project_setup.md.jinja b/template/project_setup.md.jinja index ca065bf2..0f4949f2 100644 --- a/template/project_setup.md.jinja +++ b/template/project_setup.md.jinja @@ -76,7 +76,7 @@ help you decide which tool to use for packaging. ## Package version number - We recommend using [semantic versioning](https://guide.esciencecenter.nl/#/best_practices/releases?id=semantic-versioning). -- For convenience, the package version is stored in a single place: `{{ directory_name }}/pyproject.toml` under the `tool.bumpversion` header. +- For convenience, the package version is stored in a single place: `pyproject.toml` under the `tool.bumpversion` header. - Don't forget to update the version number before [making a release](https://guide.esciencecenter.nl/#/best_practices/releases)! ## Logging diff --git a/template/sonar-project.properties.jinja b/template/sonar-project.properties.jinja index 2455ef43..268e30d7 100644 --- a/template/sonar-project.properties.jinja +++ b/template/sonar-project.properties.jinja @@ -1,5 +1,5 @@ sonar.organization={{ github_organization }} -sonar.projectKey={{ github_organization }}_{{ directory_name }} +sonar.projectKey={{ github_organization }}_{{ package_name }} sonar.host.url=https://sonarcloud.io sonar.sources=src/{{ package_name }}/ sonar.tests=tests/ diff --git a/tests/test_values.py b/tests/test_values.py index 1f240323..f0cafd48 100644 --- a/tests/test_values.py +++ b/tests/test_values.py @@ -16,21 +16,3 @@ def test_single_quotes_in_name_and_description(copie): project = copie.copy(extra_answers=ctx) assert project.exit_code == 0 - - -def test_dash_in_directory_name(copie): - ctx = { - "directory_name": "my-python-project" - } - project = copie.copy(extra_answers=ctx) - - assert project.exit_code == 0 - - -def test_space_in_directory_name(copie): - ctx = { - "directory_name": "my python project" - } - project = copie.copy(extra_answers=ctx) - - assert project.exit_code == 0 From ce6dd062f24cd5654a1d4367bfb7929a8d8850f3 Mon Sep 17 00:00:00 2001 From: "E. G. Patrick Bos" Date: Thu, 1 Aug 2024 15:10:49 +0200 Subject: [PATCH 006/285] fix tests Copier's run_copy on a template, version controlled with git, by default searches for the latest tag conforming to PEP-440 (https://peps.python.org/pep-0440/#public-version-identifiers) and uses that to generate. This meant that it was still using the 0.4.0 version. We now set it to HEAD explicitly in the tests. Note that we didn't see this failure before in the separate repo because there was no history there. --- tests/test_project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_project.py b/tests/test_project.py index a9cbbdcd..10cb0fd5 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -43,7 +43,7 @@ def project_env_bin_dir(tmp_path_factory): @pytest.fixture(scope='session') def baked_with_development_dependencies(tmp_path_factory, project_env_bin_dir): - project = run_copy(src_path=str(here()), dst_path=str(tmp_path_factory.mktemp('projects')), defaults=True) + project = run_copy(src_path=str(here()), dst_path=str(tmp_path_factory.mktemp('projects')), defaults=True, vcs_ref="HEAD") project_dir = project.dst_path bin_dir = project_env_bin_dir From e1163da30e7c6db6f07b2fba676afe9822882322 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Thu, 1 Aug 2024 21:40:06 +0200 Subject: [PATCH 007/285] Escape quotes in name and description --- copier.yml | 8 -------- template/CITATION.cff.jinja | 4 ++-- template/README.md.jinja | 2 +- template/pyproject.toml.jinja | 4 ++-- template/src/{{package_name}}/__init__.py.jinja | 2 +- 5 files changed, 6 insertions(+), 14 deletions(-) diff --git a/copier.yml b/copier.yml index 8359c1f1..4bada3f3 100644 --- a/copier.yml +++ b/copier.yml @@ -11,10 +11,6 @@ package_name: package_short_description: type: str default: Short description of package - validator: >- - {% if (package_short_description | regex_replace ('"', '\\\\"')|regex_replace ("'", "\\\\'")%} - package_short_description must not contain unescaped double or single quotes. - {% endif %} keyword1: type: str default: keyword1 @@ -42,10 +38,6 @@ full_name: type: str default: Jane Smith help: Enter your full name. - # validator: >- - # {% if '"' in full_name %} - # full_name must not contain unescaped double quotes. Use \\" for double quotes. - # {% endif %} email: type: str default: yourname@esciencecenter.nl diff --git a/template/CITATION.cff.jinja b/template/CITATION.cff.jinja index c4facdd5..d8cf8a90 100644 --- a/template/CITATION.cff.jinja +++ b/template/CITATION.cff.jinja @@ -4,8 +4,8 @@ cff-version: "1.2.0" title: "{{ package_name }}" authors: - - family-names: {{ full_name.split(' ')[-1] }} - given-names: {{ full_name.split(' ')[0] }} + family-names: {{ full_name.replace('\"', '\\\"').split(' ')[-1] }} + given-names: {{ full_name.replace('\"', '\\\"').split(' ')[0] }} orcid: "https://orcid.org/0000-0000-0000-0000" date-released: 20??-MM-DD doi: diff --git a/template/README.md.jinja b/template/README.md.jinja index 8093442c..04123ae5 100644 --- a/template/README.md.jinja +++ b/template/README.md.jinja @@ -22,7 +22,7 @@ ## How to use {{ package_name }} -{{ package_short_description }} +{{ package_short_description|replace('\"', '\\\"') }} The project setup is documented in [project_setup.md](project_setup.md). Feel free to remove this document (and/or the link to this document) if you don't need it. diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index 4298f46d..0636ce80 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta" [project] authors = [ - { name = "{{ full_name }}", email = "{{ email }}" } + { name = "{{ full_name|replace('\"', '\\\"') }}", email = "{{ email }}" } ] classifiers = [ "Development Status :: 2 - Pre-Alpha", @@ -31,7 +31,7 @@ classifiers = [ "Programming Language :: Python :: 3.12", ] dependencies = [] -description = "{{ package_short_description }}" +description = "{{ package_short_description|replace('\"', '\\\"') }}" keywords = [ "{{ keyword1 }}", "{{ keyword2 }}", diff --git a/template/src/{{package_name}}/__init__.py.jinja b/template/src/{{package_name}}/__init__.py.jinja index 27c656dd..9d801f51 100644 --- a/template/src/{{package_name}}/__init__.py.jinja +++ b/template/src/{{package_name}}/__init__.py.jinja @@ -3,6 +3,6 @@ import logging logging.getLogger(__name__).addHandler(logging.NullHandler()) -__author__ = "{{ full_name }}" +__author__ = "{{ full_name|replace('\"', '\\\"') }}" __email__ = "{{ email }}" __version__ = "{{ version }}" From 95c293db07b2b86383e2ebce206c0cb1f13dc399 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Thu, 15 Aug 2024 11:59:43 +0200 Subject: [PATCH 008/285] Update readme dev --- README.dev.md | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/README.dev.md b/README.dev.md index 1039a9a9..1bea64e9 100644 --- a/README.dev.md +++ b/README.dev.md @@ -4,15 +4,17 @@ If you're looking for user documentation, go [here](README.md). ## Development install -### Install `cookiecutter` in user space +### Install `copier` in user space -We recommend installing `cookiecutter` in user space as per `cookiecutter`'s instructions. This way, you don't have to -install `cookiecutter` for every new project. +We recommend installing `copier` in user space. This way, you don't have to +install `copier` for every new project. ```shell -python -m pip install --user --upgrade cookiecutter +python -m pip install --user --upgrade copier ``` + + ### Get your own copy of the repository Before you can do development work on the template, you'll need to check out a local copy of the repository: @@ -23,6 +25,13 @@ git clone https://github.com/NLeSC/python-template.git cd python-template ``` +Please note that if you are working from some other branch than `main`, you should switch to that branch. For example, if you are working from the `dev` branch, you should do: + +```shell +git fetch origin +git switch -c dev origin/dev +``` + ### Create a virtual environment Next, make a virtual environment, activate it, and install the development dependencies in it. This will enable you to @@ -53,7 +62,7 @@ pytest pytest tests/ ``` -## Using `cookiecutter` to generate a new package from the command line +## Using `copier` to generate a new package from the command line While making changes to the template, you'll regularly want to verify that the packages generated with the template still work. Any easy way to do this is to generate new packages in a temporary directory (which will get removed @@ -61,10 +70,10 @@ everytime you reboot), for example like so: ```shell # change directory to a new temporary directory -cd $(mktemp -d --tmpdir cookiecutter-generated.XXXXXX) +cd $(mktemp -d --tmpdir copier-generated.XXXXXX) -# run cookiecutter with the template to generate a new package -cookiecutter +# run copier with the template to generate a new package +copier copy --vcs-ref HEAD # when it asks you for the GitHub organization, put in your own name; # for the other questions, just accept the default @@ -72,8 +81,9 @@ cookiecutter # 'ls' should return just the one directory called 'my-python-project' ls ``` +Notice, that the `--vcs-ref HEAD` flag is used to make sure that the current checked out version of a local template are used. -If your Python package was created successfully, `cookiecutter` will point you to a file +If your Python package was created successfully, `copier` will point you to a file (`my-python-project/next_steps.md`) that contains information on next steps. In addition to the information in `my-python-project/project_setup.md`, the developer documentation @@ -95,7 +105,7 @@ Follow the instructions from `my-python-project/README.dev.md` and make sure tha 2. Verify that the information in `CITATION.cff` is correct. 3. Make sure that `version` in [setup.cfg](setup.cfg) and `version` in [CITATION.cff](CITATION.cff) have been bumped to the to-be-released version of the template 4. Run the unit tests with `pytest tests/` -5. Go through the steps outlined above for [generating a new package from the command line](#using-cookiecutter-to-generate-a-new-package-from-the-command-line), and verify that the generated package works as it should. +5. Go through the steps outlined above for [generating a new package from the command line](#using-copier-to-generate-a-new-package-from-the-command-line), and verify that the generated package works as it should. ### GitHub From 755e96176706f875deb523272e14860db5cab12d Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Thu, 15 Aug 2024 14:07:32 +0200 Subject: [PATCH 009/285] Update README.dev.md Co-authored-by: Abel Soares Siqueira --- README.dev.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.dev.md b/README.dev.md index 1bea64e9..8caf3756 100644 --- a/README.dev.md +++ b/README.dev.md @@ -73,7 +73,7 @@ everytime you reboot), for example like so: cd $(mktemp -d --tmpdir copier-generated.XXXXXX) # run copier with the template to generate a new package -copier copy --vcs-ref HEAD +copier copy --vcs-ref HEAD my-python-project # when it asks you for the GitHub organization, put in your own name; # for the other questions, just accept the default From d7d5dfbd0e92a1e484facb140f2ef16186986b9f Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Thu, 15 Aug 2024 14:07:48 +0200 Subject: [PATCH 010/285] Update README.dev.md Co-authored-by: Abel Soares Siqueira --- README.dev.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.dev.md b/README.dev.md index 8caf3756..c269eee8 100644 --- a/README.dev.md +++ b/README.dev.md @@ -81,7 +81,7 @@ copier copy --vcs-ref HEAD my-python-project # 'ls' should return just the one directory called 'my-python-project' ls ``` -Notice, that the `--vcs-ref HEAD` flag is used to make sure that the current checked out version of a local template are used. +Notice, that the `--vcs-ref HEAD` flag is used to make sure that the current checked out version of the local template is used. If your Python package was created successfully, `copier` will point you to a file (`my-python-project/next_steps.md`) that contains information on next steps. From c7db00f7af25d783e9c1af11094103d3442353b1 Mon Sep 17 00:00:00 2001 From: Sander van Rijn Date: Mon, 19 Aug 2024 12:21:54 +0200 Subject: [PATCH 011/285] switch PR template instructions to copier --- .github/PULL_REQUEST_TEMPLATE.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 72624dc3..d3e00774 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -16,10 +16,9 @@ Create a `python-template-test` repo on GitHub (will be overwritten if existing) ``` -cd $(mktemp -d --tmpdir py-tmpl-XXXXXX) -cookiecutter -c https://github.com//python-template +copier copy --vcs-ref https://github.com//python-template py-tmpl-XXXXXX # Fill with python-template-test info -cd python-template-test +cd py-tmpl-XXXXXX git init git add --all git commit -m "First commit" From 41177d8d8d145fb13f93af5be6d675376b82193b Mon Sep 17 00:00:00 2001 From: Sander van Rijn Date: Mon, 19 Aug 2024 13:53:27 +0200 Subject: [PATCH 012/285] restore mktemp instruction; add explanatory comments --- .github/PULL_REQUEST_TEMPLATE.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index d3e00774..eae558d8 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -16,14 +16,18 @@ Create a `python-template-test` repo on GitHub (will be overwritten if existing) ``` -copier copy --vcs-ref https://github.com//python-template py-tmpl-XXXXXX +# Create a temporary directory in /tmp, keep the XXXXXX in the directory name +cd $(mktemp -d --tmpdir py-tmpl-XXXXXX) +# Use --vcs-ref to point to the branch to you want to test +copier copy --vcs-ref https://github.com//python-template . # Fill with python-template-test info -cd py-tmpl-XXXXXX +# Create a local git repo to push to GitHub to trigger CI actions git init git add --all git commit -m "First commit" -git remote add origin https://github.com//python-template-test +git remote add origin git@github.com:/python-template-test.git git push -u origin main -f +# Create a local environment to test your generated package locally python -m venv env source env/bin/activate python -m pip install --upgrade pip setuptools From 98074b7de15df1ab6b2bb1bb8ec0d3edbd6f10fe Mon Sep 17 00:00:00 2001 From: Sander van Rijn Date: Mon, 19 Aug 2024 14:05:37 +0200 Subject: [PATCH 013/285] Update .github/PULL_REQUEST_TEMPLATE.md Co-authored-by: Olga Lyashevska --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index eae558d8..0145f12d 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -16,7 +16,7 @@ Create a `python-template-test` repo on GitHub (will be overwritten if existing) ``` -# Create a temporary directory in /tmp, keep the XXXXXX in the directory name +# Create a temporary directory by running the following command. Keep the XXXXXX in the directory name. cd $(mktemp -d --tmpdir py-tmpl-XXXXXX) # Use --vcs-ref to point to the branch to you want to test copier copy --vcs-ref https://github.com//python-template . From 1401b8edd5b23e6ccd1b30883235be07e26bfab8 Mon Sep 17 00:00:00 2001 From: Sander van Rijn Date: Mon, 19 Aug 2024 15:01:59 +0200 Subject: [PATCH 014/285] replace cookiecutter with copier in final files --- NOTICE | 2 +- setup.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NOTICE b/NOTICE index c1991889..b17007cf 100644 --- a/NOTICE +++ b/NOTICE @@ -1,2 +1,2 @@ -NLeSC Cookiecutter template for Python +NLeSC Copier template for Python Copyright 2021, Netherlands eScience Center diff --git a/setup.cfg b/setup.cfg index d52e15ba..67b1efdd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,7 +17,7 @@ classifiers = Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 Programming Language :: Python :: 3.12 -description = Cookiecutter template to initialize Python projects in accordance with Netherlands eScience Center best practices +description = Copier template to initialize Python projects in accordance with Netherlands eScience Center best practices long_description = file: README.md long_description_content_type = text/markdown name = Netherlands eScience Center Python Template From 89168be3d8560170e9ad09f22521f69d47c3f368 Mon Sep 17 00:00:00 2001 From: Faruk Date: Mon, 19 Aug 2024 15:47:14 +0200 Subject: [PATCH 015/285] add messages when creating and copying files --- copier.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/copier.yml b/copier.yml index 4bada3f3..f01d8374 100644 --- a/copier.yml +++ b/copier.yml @@ -60,3 +60,34 @@ repository_url: # Optional questions + + +# user messages + +_message_after_copy: | + Your project "{{ package_name }}" has been created successfully! + + Next steps: + + 1. Change directory to the project root: + + $ cd {{ _copier_conf.dst_path }} + + 2. Read ("{{ package_name }}"/next_steps.md) which contains information on next steps. + +_message_after_update: | + Your project "{{ package_name }}" has been updated successfully! + In case there are any conflicts, please resolve them. Then, + you're done. + +_message_before_copy: | + Thanks for generating a project using our template. + + You'll be asked a series of questions whose answers will be used to + generate a tailored project for you. + +_message_before_update: | + Thanks for updating your project using our template. + + You'll be asked a series of questions whose answers are pre-populated + with previously entered values. Feel free to change them as needed. From a4218b5be5e1804418c7a44ece80195b658a8296 Mon Sep 17 00:00:00 2001 From: Faruk Date: Mon, 19 Aug 2024 15:47:44 +0200 Subject: [PATCH 016/285] add messages when creating and copying files --- copier.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/copier.yml b/copier.yml index f01d8374..086e1b4d 100644 --- a/copier.yml +++ b/copier.yml @@ -64,6 +64,12 @@ repository_url: # user messages +_message_before_copy: | + Thanks for generating a project using our template. + + You'll be asked a series of questions whose answers will be used to + generate a tailored project for you. + _message_after_copy: | Your project "{{ package_name }}" has been created successfully! @@ -75,19 +81,13 @@ _message_after_copy: | 2. Read ("{{ package_name }}"/next_steps.md) which contains information on next steps. -_message_after_update: | - Your project "{{ package_name }}" has been updated successfully! - In case there are any conflicts, please resolve them. Then, - you're done. - -_message_before_copy: | - Thanks for generating a project using our template. - - You'll be asked a series of questions whose answers will be used to - generate a tailored project for you. - _message_before_update: | Thanks for updating your project using our template. You'll be asked a series of questions whose answers are pre-populated with previously entered values. Feel free to change them as needed. + +_message_after_update: | + Your project "{{ package_name }}" has been updated successfully! + In case there are any conflicts, please resolve them. Then, + you're done. From f31c6eb9c18c95be302fefabb26007c1a16b12f0 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 19 Aug 2024 16:24:27 +0200 Subject: [PATCH 017/285] remove double quotes --- copier.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier.yml b/copier.yml index 086e1b4d..c8e10a97 100644 --- a/copier.yml +++ b/copier.yml @@ -79,7 +79,7 @@ _message_after_copy: | $ cd {{ _copier_conf.dst_path }} - 2. Read ("{{ package_name }}"/next_steps.md) which contains information on next steps. + 2. Read ({{ package_name }}/next_steps.md) which contains information on next steps. _message_before_update: | Thanks for updating your project using our template. From 03bb88704d748b46328214137f095052d3993579 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 19 Aug 2024 16:30:37 +0200 Subject: [PATCH 018/285] update the patch in before copy message --- copier.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier.yml b/copier.yml index c8e10a97..23b2ebf8 100644 --- a/copier.yml +++ b/copier.yml @@ -79,7 +79,7 @@ _message_after_copy: | $ cd {{ _copier_conf.dst_path }} - 2. Read ({{ package_name }}/next_steps.md) which contains information on next steps. + 2. Read ({{ _copier_conf.dst_path }}/next_steps.md) which contains information on next steps. _message_before_update: | Thanks for updating your project using our template. From d711d6a16c3c3e4c4ac38e06959e4882996da072 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 19 Aug 2024 16:32:53 +0200 Subject: [PATCH 019/285] update the patch in before copy message --- copier.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier.yml b/copier.yml index 23b2ebf8..7deaed02 100644 --- a/copier.yml +++ b/copier.yml @@ -79,7 +79,7 @@ _message_after_copy: | $ cd {{ _copier_conf.dst_path }} - 2. Read ({{ _copier_conf.dst_path }}/next_steps.md) which contains information on next steps. + 2. Read next_steps.md which contains information on next steps. _message_before_update: | Thanks for updating your project using our template. From 344ca0f9b816ef2324ab84d5a26ce8ce82615786 Mon Sep 17 00:00:00 2001 From: Sander van Rijn Date: Mon, 19 Aug 2024 14:38:10 +0200 Subject: [PATCH 020/285] fix typo --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 0145f12d..e70f32de 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -18,7 +18,7 @@ Create a `python-template-test` repo on GitHub (will be overwritten if existing) ``` # Create a temporary directory by running the following command. Keep the XXXXXX in the directory name. cd $(mktemp -d --tmpdir py-tmpl-XXXXXX) -# Use --vcs-ref to point to the branch to you want to test +# Use --vcs-ref to point to the branch you want to test copier copy --vcs-ref https://github.com//python-template . # Fill with python-template-test info # Create a local git repo to push to GitHub to trigger CI actions From b805491170a31bcc6bfcf64a4872ae45eb8844b7 Mon Sep 17 00:00:00 2001 From: Sander van Rijn Date: Mon, 19 Aug 2024 17:28:29 +0200 Subject: [PATCH 021/285] remove ADD_TO_EXISTING_PACKAGE file --- ADD_TO_EXISTING_PACKAGE.md | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 ADD_TO_EXISTING_PACKAGE.md diff --git a/ADD_TO_EXISTING_PACKAGE.md b/ADD_TO_EXISTING_PACKAGE.md deleted file mode 100644 index 9edfca2b..00000000 --- a/ADD_TO_EXISTING_PACKAGE.md +++ /dev/null @@ -1,29 +0,0 @@ -# Add your existing code to directory generated by the NLeSC Python template - -The following steps requires that your existing code is in a GitHub repository. - -1. Follow the [instructions to create a new package](https://github.com/NLeSC/python-template#how-to-use) with the Python template, while answering the questions like you would for the existing package. - -2. Create a Git structure for the new directory: (replace `` with directory name you used during coopier questionnaire) -```shell -$ cd -$ git init -$ git add --all -$ git commit -m "Added code generated by copier" -$ git branch -M main -``` - -3. Import the existing repository from GitHub (Replace `` with your GitHub organization name , `` with your GitHub repository name and `` with your default branch for example `main` or `master`): -```shell -$ git remote add -f existing_code https://github.com// -$ git fetch existing_code -$ git merge existing_code/ --allow-unrelated-histories -``` - -4. The previous step will likely result in several merge conflicts. Solve the conflicts by editing the files. -5. Once all conflicts have been resolved then add all the files to GitHub: -```shell -$ git add --all -$ git commit -m "Merged existing code with code generated by copier" -$ git push -``` From 79cea70a640bd3175766277b624080bb618eb9a7 Mon Sep 17 00:00:00 2001 From: Sander van Rijn Date: Mon, 19 Aug 2024 17:29:40 +0200 Subject: [PATCH 022/285] update usage instruction to explain 3 ways to use copier --- README.md | 63 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ec98a601..01e51892 100644 --- a/README.md +++ b/README.md @@ -42,20 +42,29 @@ Use this [Copier](https://copier.readthedocs.io) template to generate an empty P ## How to use -### Step 1/3: Install `copier` +There are multiple ways to use this template: +1. Creating a new package based on the template +2. Applying the template's best practices to some pre-existing code +3. Updating a package made with the template based on the latest template updates + +In all three cases, you will need to install copier first: ```shell pipx install copier ``` -### Step 2/3: Generate the files and directory structure +### Option 1: Create a new package + + +#### Step 1/2: Generate the files and directory structure Run `copier` with the template: ```shell # Notes: -# 1. See table below for explanation of each question -# 2. The files will be generated in a new directory +# 1. Make sure that `path/to/destination` is an empty directory +# 2. See table below for explanation of each question +# 3. The files will be generated in the specified destination directory copier copy https://github.com/nlesc/python-template.git path/to/destination ``` @@ -76,7 +85,7 @@ copier copy https://github.com/nlesc/python-template.git path/to/destination Once the project files have been generated, follow the steps outlined in [template/next_steps.md](template/next_steps.md). -### Step 3/3: Read about what was just generated +#### Step 2/2: Read about what was just generated Good job! You have now generated the skeleton for your package: @@ -135,7 +144,49 @@ Good job! You have now generated the skeleton for your package: ``` For an explanation of what's there, read on in the [project_setup.md](template/project_setup.md) file. -There are also instructions on how to [apply the template to an existing Python package](ADD_TO_EXISTING_PACKAGE.md). + +### Option 2: Apply to pre-existing code + +To apply the template to pre-existing code, you can use the same `copier copy` +command as when creating a new package, except that you point to the folder +containing your existing code rather than a new one: + +```shell +copier copy https://github.com/nlesc/python-template.git path/to/existing/code +``` + +This works because if `path/to/destination` already exists, `copier` will +update what is already there by either adding new files or updating +existing files. Copier will ask to overwrite any files that resulted in +conflicts. Especially if your files are already under version control, it is +recommended to answer 'yes' for all files, you will still be able to review +the changes suggested by the template. + +### Option 3. Updating a template-made package + +Copier provides the functionality for re-applying the template to a previously +created project using the `copier update` command. This has two effects: + +1. Your project will be updated according to the latest version of the template +2. You can change any of your previous answers to apply these changes + throughout your entire project. + +```shell +cd path/to/project +copier update +``` + +If you don't want to change any of your answers, but only want to update your +project according to the latest template updates, you can provide the +`--skip-answered` option. This tells copier to reuse all of your previous +answers, and simply bring in all updates from the template into +your current project, such as updating which Python versions are supported. +You will still be asked to answer any new questions that have been added to +the template since you last applied it. + +```shell +copier update --skip-answered +``` ## Examples From 6e09142857e3623b71ea2a22b8110ab0bd583da8 Mon Sep 17 00:00:00 2001 From: Sander van Rijn Date: Tue, 20 Aug 2024 11:16:30 +0200 Subject: [PATCH 023/285] Update README.md Co-authored-by: fdiblen <144492+fdiblen@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 01e51892..5752f684 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ Use this [Copier](https://copier.readthedocs.io) template to generate an empty P There are multiple ways to use this template: 1. Creating a new package based on the template -2. Applying the template's best practices to some pre-existing code +2. Applying the template to some pre-existing code 3. Updating a package made with the template based on the latest template updates In all three cases, you will need to install copier first: From 5f369e7e9308e01b7bfef86aaa6a2c1a2b12be61 Mon Sep 17 00:00:00 2001 From: Sander van Rijn Date: Tue, 20 Aug 2024 11:16:52 +0200 Subject: [PATCH 024/285] Update README.md Co-authored-by: Olga Lyashevska --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5752f684..ae8366c5 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Use this [Copier](https://copier.readthedocs.io) template to generate an empty P ## How to use -There are multiple ways to use this template: +There are multiple scenarios to use this template: 1. Creating a new package based on the template 2. Applying the template to some pre-existing code From fc07bfe35eb258dc37e747a13bb0a5e11147c87c Mon Sep 17 00:00:00 2001 From: Sander van Rijn Date: Tue, 20 Aug 2024 11:21:27 +0200 Subject: [PATCH 025/285] Update README.md Co-authored-by: Olga Lyashevska --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ae8366c5..740838f2 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ There are multiple scenarios to use this template: 1. Creating a new package based on the template 2. Applying the template to some pre-existing code -3. Updating a package made with the template based on the latest template updates +3. Updating a package made with the template In all three cases, you will need to install copier first: ```shell From 5aa33ded8c61da1990315eee833d2a7ecc9c0244 Mon Sep 17 00:00:00 2001 From: Sander van Rijn Date: Tue, 20 Aug 2024 11:21:51 +0200 Subject: [PATCH 026/285] Update README.md Co-authored-by: Olga Lyashevska --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 740838f2..9221dbf7 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Use this [Copier](https://copier.readthedocs.io) template to generate an empty P There are multiple scenarios to use this template: -1. Creating a new package based on the template +1. Generating a new package using template 2. Applying the template to some pre-existing code 3. Updating a package made with the template From 227f82beeb1f83cc4a45937f92d1d0e9b69d2ab0 Mon Sep 17 00:00:00 2001 From: Sander van Rijn Date: Tue, 20 Aug 2024 11:32:11 +0200 Subject: [PATCH 027/285] rename options/cases to scenarios --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 9221dbf7..e0fba446 100644 --- a/README.md +++ b/README.md @@ -44,19 +44,19 @@ Use this [Copier](https://copier.readthedocs.io) template to generate an empty P There are multiple scenarios to use this template: -1. Generating a new package using template -2. Applying the template to some pre-existing code -3. Updating a package made with the template +[Scenario 1](#scenario-1-create-a-new-package): Generating a new package using template +[Scenario 2](#scenario-2-apply-to-pre-existing-code): Applying the template to some pre-existing code +[Scenario 3](#scenario-3-updating-a-template-made-package): Updating a package made with the template -In all three cases, you will need to install copier first: +In all three scenarios, you will need to install copier first: ```shell pipx install copier ``` -### Option 1: Create a new package +### Scenario 1: Create a new package -#### Step 1/2: Generate the files and directory structure +#### Step 1/2: Create the files and directory structure Run `copier` with the template: @@ -83,7 +83,7 @@ copier copy https://github.com/nlesc/python-template.git path/to/destination | code_of_conduct_email | yourname@esciencecenter.nl | Email address of the person who should be contacted in case of violations of the Code of Conduct. | Once the project files have been generated, follow the steps outlined in -[template/next_steps.md](template/next_steps.md). +[next_steps.md](template/next_steps.md). #### Step 2/2: Read about what was just generated @@ -145,7 +145,7 @@ Good job! You have now generated the skeleton for your package: For an explanation of what's there, read on in the [project_setup.md](template/project_setup.md) file. -### Option 2: Apply to pre-existing code +### Scenario 2: Apply to pre-existing code To apply the template to pre-existing code, you can use the same `copier copy` command as when creating a new package, except that you point to the folder @@ -162,7 +162,7 @@ conflicts. Especially if your files are already under version control, it is recommended to answer 'yes' for all files, you will still be able to review the changes suggested by the template. -### Option 3. Updating a template-made package +### Scenario 3. Updating a template-made package Copier provides the functionality for re-applying the template to a previously created project using the `copier update` command. This has two effects: From 4debab7de1f2942f4b4dbb5bebbfa51ab1a1fba4 Mon Sep 17 00:00:00 2001 From: Sander van Rijn Date: Tue, 20 Aug 2024 11:50:26 +0200 Subject: [PATCH 028/285] Add pipx install instructions + explanation --- README.md | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e0fba446..afc8a257 100644 --- a/README.md +++ b/README.md @@ -48,17 +48,26 @@ There are multiple scenarios to use this template: [Scenario 2](#scenario-2-apply-to-pre-existing-code): Applying the template to some pre-existing code [Scenario 3](#scenario-3-updating-a-template-made-package): Updating a package made with the template -In all three scenarios, you will need to install copier first: +In all three scenarios, you will need to install Copier first, which we +recommend doing with [`pipx`](https://github.com/pypa/pipx): ```shell +python3 -m pip install --user pipx +python3 -m pipx ensurepath pipx install copier ``` +> [!NOTE] +> Note that it is also possible to install Copier with regular `pip`, but that +> Copier will then be installed in your common environment and may cause +> conflicts with its dependencies, while `pipx` will install Copier in a +> separate and dedicated environment. + ### Scenario 1: Create a new package #### Step 1/2: Create the files and directory structure -Run `copier` with the template: +Run `copier copy` with the template: ```shell # Notes: @@ -155,7 +164,7 @@ containing your existing code rather than a new one: copier copy https://github.com/nlesc/python-template.git path/to/existing/code ``` -This works because if `path/to/destination` already exists, `copier` will +This works because if `path/to/destination` already exists, Copier will update what is already there by either adding new files or updating existing files. Copier will ask to overwrite any files that resulted in conflicts. Especially if your files are already under version control, it is @@ -171,6 +180,10 @@ created project using the `copier update` command. This has two effects: 2. You can change any of your previous answers to apply these changes throughout your entire project. +> [!CAUTION] +> Do not manually update answers in `.copier-answers.yml`, +> as it will result in unexpected behavior. + ```shell cd path/to/project copier update @@ -178,7 +191,7 @@ copier update If you don't want to change any of your answers, but only want to update your project according to the latest template updates, you can provide the -`--skip-answered` option. This tells copier to reuse all of your previous +`--skip-answered` option. This tells Copier to reuse all of your previous answers, and simply bring in all updates from the template into your current project, such as updating which Python versions are supported. You will still be asked to answer any new questions that have been added to From 399a7a11d336bd48a1326580517b5aeb6d9db590 Mon Sep 17 00:00:00 2001 From: Sander van Rijn Date: Tue, 20 Aug 2024 12:03:54 +0200 Subject: [PATCH 029/285] scenarios as list --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index afc8a257..d7951f13 100644 --- a/README.md +++ b/README.md @@ -44,9 +44,9 @@ Use this [Copier](https://copier.readthedocs.io) template to generate an empty P There are multiple scenarios to use this template: -[Scenario 1](#scenario-1-create-a-new-package): Generating a new package using template -[Scenario 2](#scenario-2-apply-to-pre-existing-code): Applying the template to some pre-existing code -[Scenario 3](#scenario-3-updating-a-template-made-package): Updating a package made with the template +- [Scenario 1](#scenario-1-create-a-new-package): Generating a new package using template +- [Scenario 2](#scenario-2-apply-to-pre-existing-code): Applying the template to some pre-existing code +- [Scenario 3](#scenario-3-updating-a-template-made-package): Updating a package made with the template In all three scenarios, you will need to install Copier first, which we recommend doing with [`pipx`](https://github.com/pypa/pipx): From 39bcbc4dcc2b945ba69329506d553d0d461f739b Mon Sep 17 00:00:00 2001 From: Sander van Rijn Date: Tue, 20 Aug 2024 12:25:56 +0200 Subject: [PATCH 030/285] fix broken readme links: add missing .jinja extension --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d7951f13..bb18c563 100644 --- a/README.md +++ b/README.md @@ -5,23 +5,23 @@ Spend less time setting up and configuring your new Python packages and comply w Use this [Copier](https://copier.readthedocs.io) template to generate an empty Python package. Features include: - Boilerplate unit tests and documentation, -- [Python static setup configuration](template/pyproject.toml), +- [Python static setup configuration](template/pyproject.toml.jinja), - Open source software license, - Continuous integration with [GitHub action workflows](template/.github/workflows) for building, testing, link checking and linting, - Code style checking with [ruff](https://beta.ruff.rs/), - [Editorconfig](template/.editorconfig), - Usage and contribution documents: - - [README.md](template/README.md) for package users, - - [README.dev.md](template/README.dev.md) for package developer, - - [project_setup.md](template/project_setup.md) with extensive documentation about project setup, + - [README.md](template/README.md.jinja) for package users, + - [README.dev.md](template/README.dev.md.jinja) for package developer, + - [project_setup.md](template/project_setup.md.jinja) with extensive documentation about project setup, - [Change log](template/CHANGELOG.md), - - [Code of Conduct](template/CODE_OF_CONDUCT.md), - - [Contributing guidelines](template/CONTRIBUTING.md), + - [Code of Conduct](template/CODE_OF_CONDUCT.md.jinja), + - [Contributing guidelines](template/CONTRIBUTING.md.jinja), - Continuous code quality and code coverage reporting using [Sonarcloud](https://sonarcloud.io/), - Automatic creation of [issues](template/.github/next_steps) with instructions how to pass all GitHub action workflows and integrate with services like Zenodo and Read the Docs, -- Instructions how to make package [citable](template/.github/next_steps/02_citation.md) +- Instructions how to make package [citable](template/.github/next_steps/02_citation.md.jinja) - FAIR software recommendation badge, -- Optional [pre commit hook](template/README.dev.md#running-linters-locally) to catch lint errors early +- Optional [pre commit hook](template/README.dev.md.jinja#running-linters-locally) to catch lint errors early ## Badges @@ -92,7 +92,7 @@ copier copy https://github.com/nlesc/python-template.git path/to/destination | code_of_conduct_email | yourname@esciencecenter.nl | Email address of the person who should be contacted in case of violations of the Code of Conduct. | Once the project files have been generated, follow the steps outlined in -[next_steps.md](template/next_steps.md). +[next_steps.md](template/next_steps.md.jinja). #### Step 2/2: Read about what was just generated @@ -152,7 +152,7 @@ Good job! You have now generated the skeleton for your package: └── .zenodo.json ``` -For an explanation of what's there, read on in the [project_setup.md](template/project_setup.md) file. +For an explanation of what's there, read on in the [project_setup.md](template/project_setup.md.jinja) file. ### Scenario 2: Apply to pre-existing code From e70a4e6d6acaa24097475f7b40f14cc3aa8e0cf2 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Tue, 20 Aug 2024 13:40:47 +0200 Subject: [PATCH 031/285] Add lichee markdown link checker --- .github/workflows/markdown-link-check.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/markdown-link-check.yml b/.github/workflows/markdown-link-check.yml index e27e10b3..49f8778f 100644 --- a/.github/workflows/markdown-link-check.yml +++ b/.github/workflows/markdown-link-check.yml @@ -9,13 +9,11 @@ on: - main jobs: - - markdown-link-check: - name: Check markdown links + linkChecker: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: gaurav-nelson/github-action-markdown-link-check@v1 - with: - use-quiet-mode: 'yes' - config-file: '.mlc-config.json' + - uses: actions/checkout@v4 + + - name: Link Checker + id: lychee + uses: lycheeverse/lychee-action@v1 From d1965f61ba6371add9ce07b94a99da376cc37402 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Tue, 20 Aug 2024 13:44:05 +0200 Subject: [PATCH 032/285] Remove config file --- .mlc-config.json | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 .mlc-config.json diff --git a/.mlc-config.json b/.mlc-config.json deleted file mode 100644 index 95443f7b..00000000 --- a/.mlc-config.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "_comment": "Markdown Link Checker configuration, see https://github.com/gaurav-nelson/github-action-markdown-link-check and https://github.com/tcort/markdown-link-check", - "ignorePatterns": [ - { - "pattern": "^http://localhost" - }, - { - "pattern": "\\{\\{" - }, - { - "pattern": "^https://doi.org/" - }, - { - "pattern": "^https://bestpractices.coreinfrastructure.org/projects/" - }, - { - "pattern": "^.github/workflows/sonarcloud.yml$" - }, - { - "pattern": "^https://readthedocs.org/dashboard/import.*" - } - ], - "replacementPatterns": [ - ], - "retryOn429": true, - "timeout": "20s" -} From fcbfa65c2d9f259e36755c35f0e783ea7d1e0efd Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 13:59:32 +0200 Subject: [PATCH 033/285] add the profile selection and GitHubAction question --- copier.yml | 26 ++++++++++++++++--- ...f AddGitHubActions %}build{% endif %}.yml} | 0 ...HubActions %}documentation{% endif %}.yml} | 0 3 files changed, 22 insertions(+), 4 deletions(-) rename template/.github/workflows/{build.yml => {% if AddGitHubActions %}build{% endif %}.yml} (100%) rename template/.github/workflows/{documentation.yml => {% if AddGitHubActions %}documentation{% endif %}.yml} (100%) diff --git a/copier.yml b/copier.yml index 7deaed02..8a589899 100644 --- a/copier.yml +++ b/copier.yml @@ -48,8 +48,7 @@ code_of_conduct_email: type: str default: "{{ email }}" -_subdirectory: template - +# calculated fields repository: default: git@github.com:{{ github_organization }}/{{ package_name }} when: false @@ -59,11 +58,30 @@ repository_url: when: false +# profile selection +template_profile: + type: str + default: recommended + help: Optional questions (You can use our defaults, or the bare minimum, or decide everything) + choices: + Recommended (our defaults for research software): "recommended" + Minimum (Answer no to any addition): "minimum" + Ask me (Ask all questions): "ask" + + # Optional questions +AddGitHubActions: + when: "{{ AnswerStrategy == 'ask' }}" + type: bool + default: "{{ AnswerStrategy != 'minimum' }}" + help: GitHub actions to test build, documentation -# user messages +# internal fields +_subdirectory: template + +# user messages _message_before_copy: | Thanks for generating a project using our template. @@ -77,7 +95,7 @@ _message_after_copy: | 1. Change directory to the project root: - $ cd {{ _copier_conf.dst_path }} + $ cd {{ _copier_conf.dst_path }} 2. Read next_steps.md which contains information on next steps. diff --git a/template/.github/workflows/build.yml b/template/.github/workflows/{% if AddGitHubActions %}build{% endif %}.yml similarity index 100% rename from template/.github/workflows/build.yml rename to template/.github/workflows/{% if AddGitHubActions %}build{% endif %}.yml diff --git a/template/.github/workflows/documentation.yml b/template/.github/workflows/{% if AddGitHubActions %}documentation{% endif %}.yml similarity index 100% rename from template/.github/workflows/documentation.yml rename to template/.github/workflows/{% if AddGitHubActions %}documentation{% endif %}.yml From 53b9959961a4b09ab4554ad8d8c352e185d8e622 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 14:07:02 +0200 Subject: [PATCH 034/285] rename the workflow files --- ...endif %}.yml => {% if AddGitHubActions %}build.yml{% endif %}} | 0 ....yml => {% if AddGitHubActions %}documentation.yml{% endif %}} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename template/.github/workflows/{{% if AddGitHubActions %}build{% endif %}.yml => {% if AddGitHubActions %}build.yml{% endif %}} (100%) rename template/.github/workflows/{{% if AddGitHubActions %}documentation{% endif %}.yml => {% if AddGitHubActions %}documentation.yml{% endif %}} (100%) diff --git a/template/.github/workflows/{% if AddGitHubActions %}build{% endif %}.yml b/template/.github/workflows/{% if AddGitHubActions %}build.yml{% endif %} similarity index 100% rename from template/.github/workflows/{% if AddGitHubActions %}build{% endif %}.yml rename to template/.github/workflows/{% if AddGitHubActions %}build.yml{% endif %} diff --git a/template/.github/workflows/{% if AddGitHubActions %}documentation{% endif %}.yml b/template/.github/workflows/{% if AddGitHubActions %}documentation.yml{% endif %} similarity index 100% rename from template/.github/workflows/{% if AddGitHubActions %}documentation{% endif %}.yml rename to template/.github/workflows/{% if AddGitHubActions %}documentation.yml{% endif %} From 1d8c6e3a1e50a863a9ba27b27843b09ccc304aed Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Tue, 20 Aug 2024 14:14:43 +0200 Subject: [PATCH 035/285] Add cron and issue creation --- .github/dependabot.yml | 6 ++++++ .github/workflows/markdown-link-check.yml | 14 ++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..8a6c1559 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: ".github/workflows" + schedule: + interval: "daily" diff --git a/.github/workflows/markdown-link-check.yml b/.github/workflows/markdown-link-check.yml index 49f8778f..55d96930 100644 --- a/.github/workflows/markdown-link-check.yml +++ b/.github/workflows/markdown-link-check.yml @@ -7,6 +7,8 @@ on: pull_request: branches: - main + schedule: + - cron: '0 0 * * 0' # every Sunday at 00:00 jobs: linkChecker: @@ -17,3 +19,15 @@ jobs: - name: Link Checker id: lychee uses: lycheeverse/lychee-action@v1 + with: + # fail action if there are broken links + fail: true + + - name: Create Issue From File + # create issues only when triggered by schedule + if: github.event_name == 'schedule' && env.lychee_exit_code != 0 + uses: peter-evans/create-issue-from-file@v4 + with: + title: Link Checker Report + content-filepath: ./lychee/out.md + labels: report, automated issue From ca3d02bceaea0727820842759999625712a6c791 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 12:18:42 +0000 Subject: [PATCH 036/285] Bump peter-evans/create-issue-from-file in /.github/workflows Bumps [peter-evans/create-issue-from-file](https://github.com/peter-evans/create-issue-from-file) from 4 to 5. - [Release notes](https://github.com/peter-evans/create-issue-from-file/releases) - [Commits](https://github.com/peter-evans/create-issue-from-file/compare/v4...v5) --- updated-dependencies: - dependency-name: peter-evans/create-issue-from-file dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/markdown-link-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/markdown-link-check.yml b/.github/workflows/markdown-link-check.yml index 55d96930..6322bb7f 100644 --- a/.github/workflows/markdown-link-check.yml +++ b/.github/workflows/markdown-link-check.yml @@ -26,7 +26,7 @@ jobs: - name: Create Issue From File # create issues only when triggered by schedule if: github.event_name == 'schedule' && env.lychee_exit_code != 0 - uses: peter-evans/create-issue-from-file@v4 + uses: peter-evans/create-issue-from-file@v5 with: title: Link Checker Report content-filepath: ./lychee/out.md From df0831ef6a2d0d4c80281d068f3a2a10cb1daa69 Mon Sep 17 00:00:00 2001 From: Sander van Rijn Date: Tue, 20 Aug 2024 14:20:09 +0200 Subject: [PATCH 037/285] fix ruff test: ignore some rules, fix some code for others --- template/pyproject.toml.jinja | 11 ++++++++++- template/src/{{package_name}}/my_module.py.jinja | 3 ++- template/tests/test_my_module.py.jinja | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index 78f37fd1..10a0481f 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -102,6 +102,7 @@ extras = dev [tool.ruff] line-length = 120 output-format = "concise" +extend-exclude = ["docs"] [tool.ruff.lint] # Allow unused variables when underscore-prefixed. @@ -126,7 +127,15 @@ ignore = [ ] pydocstyle.convention = "google" -[tool.ruff.isort] +[tool.ruff.lint.per-file-ignores] +# Tests can ignore a few extra rules +"tests/**.py" = [ + "ANN201", # Missing return type annotation for public function + "PT011", # Missing `match` parameter in `pytest.raises()` + "S101", # Use of assert is detected +] + +[tool.ruff.lint.isort] known-first-party = ["{{ package_name }}"] force-single-line = true no-lines-before = ["future","standard-library","third-party","first-party","local-folder"] diff --git a/template/src/{{package_name}}/my_module.py.jinja b/template/src/{{package_name}}/my_module.py.jinja index f2b30f24..eda4d695 100644 --- a/template/src/{{package_name}}/my_module.py.jinja +++ b/template/src/{{package_name}}/my_module.py.jinja @@ -25,5 +25,6 @@ def hello(name: str) -> str: """ if name == 'nobody': - raise ValueError('Can not say hello to nobody') + msg = 'Can not say hello to nobody' + raise ValueError(msg) return f'Hello {name}!' diff --git a/template/tests/test_my_module.py.jinja b/template/tests/test_my_module.py.jinja index e9047790..67e60785 100644 --- a/template/tests/test_my_module.py.jinja +++ b/template/tests/test_my_module.py.jinja @@ -21,6 +21,6 @@ def some_name(): return 'Jane Smith' -def test_hello_with_fixture(some_name): +def test_hello_with_fixture(some_name: str): """Example using a fixture.""" assert hello(some_name) == 'Hello Jane Smith!' From 1fe938b3ef8918911499f253298d75a6d2589c2d Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 14:24:36 +0200 Subject: [PATCH 038/285] update the condition for github action question --- copier.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/copier.yml b/copier.yml index 8a589899..c3fdfe3e 100644 --- a/copier.yml +++ b/copier.yml @@ -71,9 +71,9 @@ template_profile: # Optional questions AddGitHubActions: - when: "{{ AnswerStrategy == 'ask' }}" + when: "{{ template_profile == 'ask' }}" type: bool - default: "{{ AnswerStrategy != 'minimum' }}" + default: "{{ template_profile != 'minimum' }}" help: GitHub actions to test build, documentation From 707d452ec220248a19bbb894a858b6ead74b010b Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 14:35:08 +0200 Subject: [PATCH 039/285] update profile descriptions --- copier.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/copier.yml b/copier.yml index c3fdfe3e..13448af5 100644 --- a/copier.yml +++ b/copier.yml @@ -65,8 +65,8 @@ template_profile: help: Optional questions (You can use our defaults, or the bare minimum, or decide everything) choices: Recommended (our defaults for research software): "recommended" - Minimum (Answer no to any addition): "minimum" - Ask me (Ask all questions): "ask" + Minimum (no extra features): "minimum" + Let me choose (decide each feature yourself): "ask" # Optional questions From ddd68caa87f85975c9753bde9a4c4c9ee5c81c88 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 14:43:34 +0200 Subject: [PATCH 040/285] add profile descriptions --- profiles.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 profiles.md diff --git a/profiles.md b/profiles.md new file mode 100644 index 00000000..2bbf0dfe --- /dev/null +++ b/profiles.md @@ -0,0 +1,11 @@ +# Template Profiles + +## Minimum +src/ +docs/ + +## Recommended + +.github/workflows/build.yml +.github/workflows/documentation.yml + From 3bf26405149bfba43c24a166f61ebc38ac2fbc00 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Tue, 20 Aug 2024 14:55:16 +0200 Subject: [PATCH 041/285] Update profiles.md --- profiles.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/profiles.md b/profiles.md index 2bbf0dfe..3702c437 100644 --- a/profiles.md +++ b/profiles.md @@ -3,6 +3,12 @@ ## Minimum src/ docs/ +test/ +pyproject.toml +README.md +.gitignore +.editorconfig + ## Recommended From 0654a54edfcb65f416061c084166ed787f0d2de9 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 14:58:42 +0200 Subject: [PATCH 042/285] update description of github action question --- copier.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier.yml b/copier.yml index 13448af5..4d9ab5e5 100644 --- a/copier.yml +++ b/copier.yml @@ -74,7 +74,7 @@ AddGitHubActions: when: "{{ template_profile == 'ask' }}" type: bool default: "{{ template_profile != 'minimum' }}" - help: GitHub actions to test build, documentation + help: GitHub actions to test the package and the documentation # internal fields From 2b68797d4f9749e42e02504dd25b45ae63459cdf Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 15:04:05 +0200 Subject: [PATCH 043/285] update the file list in profiles.md --- profiles.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/profiles.md b/profiles.md index 3702c437..1edd52f5 100644 --- a/profiles.md +++ b/profiles.md @@ -1,17 +1,18 @@ # Template Profiles ## Minimum -src/ -docs/ -test/ -pyproject.toml -README.md -.gitignore -.editorconfig +- src/ +- docs/ +- test/ +- pyproject.toml +- README.md +- .gitignore +- .editorconfig ## Recommended -.github/workflows/build.yml -.github/workflows/documentation.yml +- GitHub Actions + - .github/workflows/build.yml + - .github/workflows/documentation.yml From 2cecd60a62e2474402e2d42b1cd39273eb079e89 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 15:08:36 +0200 Subject: [PATCH 044/285] add a list of questions to profiles.md --- profiles.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/profiles.md b/profiles.md index 1edd52f5..a3578309 100644 --- a/profiles.md +++ b/profiles.md @@ -16,3 +16,17 @@ - .github/workflows/build.yml - .github/workflows/documentation.yml + +## Questions +- Pre-commit +- cffconvert +- markdown link checker workflow +- static analysis +- next steps workflow +- changelog +- citation file +- code of conduct +- contributing guidelines +- notice and manifest file +- developer documentation +- online documentation (read the docs) From ead72ca1cbba607d694984d90bee445c488c94c6 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Tue, 20 Aug 2024 15:23:51 +0200 Subject: [PATCH 045/285] Update profiles.md --- profiles.md | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/profiles.md b/profiles.md index a3578309..7972fd53 100644 --- a/profiles.md +++ b/profiles.md @@ -1,5 +1,6 @@ # Template Profiles + ## Minimum - src/ @@ -9,24 +10,19 @@ - README.md - .gitignore - .editorconfig - -## Recommended - -- GitHub Actions - - .github/workflows/build.yml - - .github/workflows/documentation.yml - +- licence ## Questions - Pre-commit -- cffconvert +- cffconvert workflow and citation file - markdown link checker workflow - static analysis - next steps workflow - changelog -- citation file - code of conduct - contributing guidelines - notice and manifest file - developer documentation - online documentation (read the docs) +- github action +- From a5efb46e97ce7cd6033bc4e16c3dd178bc440fe3 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 15:27:59 +0200 Subject: [PATCH 046/285] reorganize the questions --- copier.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/copier.yml b/copier.yml index 4d9ab5e5..04123c2c 100644 --- a/copier.yml +++ b/copier.yml @@ -23,17 +23,6 @@ version: github_organization: type: str default: "" -license: - type: str - choices: - - "Apache Software License 2.0" - - "MIT license" - - "BSD license" - - "ISC license" - - "GNU General Public License v3 or later" - - "GNU Lesser General Public License v3 or later" - - "Not open source" - default: "MIT license" full_name: type: str default: Jane Smith @@ -69,7 +58,19 @@ template_profile: Let me choose (decide each feature yourself): "ask" -# Optional questions +# extra questions +license: + type: str + choices: + - "Apache Software License 2.0" + - "MIT license" + - "BSD license" + - "ISC license" + - "GNU General Public License v3 or later" + - "GNU Lesser General Public License v3 or later" + - "Not open source" + default: "MIT license" + AddGitHubActions: when: "{{ template_profile == 'ask' }}" type: bool From 81fb9523b4b2755f0173218f4c8800570a85f2b9 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 15:28:15 +0200 Subject: [PATCH 047/285] update the file list in profiles.md --- profiles.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/profiles.md b/profiles.md index 7972fd53..6bd0d72a 100644 --- a/profiles.md +++ b/profiles.md @@ -10,9 +10,11 @@ - README.md - .gitignore - .editorconfig -- licence + ## Questions +- licence (exist) +- github action (exist) #451 - Pre-commit - cffconvert workflow and citation file - markdown link checker workflow @@ -24,5 +26,4 @@ - notice and manifest file - developer documentation - online documentation (read the docs) -- github action -- + From f728bd2b52167ab725aaf6bb8f73146b3d6faf5f Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 16:05:09 +0200 Subject: [PATCH 048/285] update the file list in profiles.md --- profiles.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/profiles.md b/profiles.md index 6bd0d72a..718d0278 100644 --- a/profiles.md +++ b/profiles.md @@ -14,9 +14,9 @@ ## Questions - licence (exist) -- github action (exist) #451 +- github action (added by #451) - Pre-commit -- cffconvert workflow and citation file +- cffconvert workflow and citation file (added by #458) - markdown link checker workflow - static analysis - next steps workflow From 9e2ea38ca92413f72b7ac2d2b7e6b8f96f6024ac Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 16:05:35 +0200 Subject: [PATCH 049/285] add citation question --- copier.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/copier.yml b/copier.yml index 04123c2c..f21335cb 100644 --- a/copier.yml +++ b/copier.yml @@ -77,6 +77,11 @@ AddGitHubActions: default: "{{ template_profile != 'minimum' }}" help: GitHub actions to test the package and the documentation +AddCitation: + when: "{{ template_profile == 'ask' }}" + type: bool + default: "{{ template_profile != 'minimum' }}" + help: Citation file and cffconvert workflow which validates the citation file # internal fields _subdirectory: template From e4195c3bfe49e8379a976984323d5f449b7f6883 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 16:06:52 +0200 Subject: [PATCH 050/285] create CITATION.cff conditionally --- ...ff.jinja => {% if AddCitation %}CITATION.cff.jinja{% endif %}} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename template/{CITATION.cff.jinja => {% if AddCitation %}CITATION.cff.jinja{% endif %}} (100%) diff --git a/template/CITATION.cff.jinja b/template/{% if AddCitation %}CITATION.cff.jinja{% endif %} similarity index 100% rename from template/CITATION.cff.jinja rename to template/{% if AddCitation %}CITATION.cff.jinja{% endif %} From 08e3d958db5983fb65ff91816ef3cfa4ac0b8e3a Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 16:07:51 +0200 Subject: [PATCH 051/285] create cffconvert.yml workflow conditionally --- ...fconvert.yml => {% if AddCitation %}cffconvert.yml{% endif %}} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename template/.github/workflows/{cffconvert.yml => {% if AddCitation %}cffconvert.yml{% endif %}} (100%) diff --git a/template/.github/workflows/cffconvert.yml b/template/.github/workflows/{% if AddCitation %}cffconvert.yml{% endif %} similarity index 100% rename from template/.github/workflows/cffconvert.yml rename to template/.github/workflows/{% if AddCitation %}cffconvert.yml{% endif %} From aaf7cc8eb61dda2a6171050655b28ecef411613a Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 16:10:15 +0200 Subject: [PATCH 052/285] add a next steps workflow that creates an issue only about citation --- ...ation %}next_steps_citation.yml{% endif %} | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} diff --git a/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} b/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} new file mode 100644 index 00000000..2e919e5e --- /dev/null +++ b/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} @@ -0,0 +1,29 @@ +on: [push] +permissions: + contents: write + issues: write +name: Create issues for next steps +jobs: + next_steps: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Create citation data issue + uses: JasonEtco/create-an-issue@v2 + env: + GITHUB_TOKEN: ${{ '{{ ' -}} secrets.GITHUB_TOKEN }} + with: + filename: .github/next_steps/02_citation.md + id: citation + - name: List created issues + run: | + echo 'Created issues that must be completed to have fully working Python package: + * Citation data ${{ '{{ ' -}} steps.citation.outputs.url }} + - name: Cleanup files needed to create next steps issues + run: | + git config --global user.name 'NLeSC Python template' + git config --global user.email 'nlesc-python-template@users.noreply.github.com' + git rm .github/workflows/next_steps_citation.yml + git rm -r .github/next_steps + git commit -am "Cleanup automated next steps issue generator" + git push From 94640d6a0fbb1a5af1dc696e904713ff2162c543 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 16:10:53 +0200 Subject: [PATCH 053/285] remove citation job from the next steps workflow --- template/.github/workflows/next_steps.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/template/.github/workflows/next_steps.yml b/template/.github/workflows/next_steps.yml index e759c491..04da514e 100644 --- a/template/.github/workflows/next_steps.yml +++ b/template/.github/workflows/next_steps.yml @@ -15,14 +15,6 @@ jobs: with: filename: .github/next_steps/01_sonarcloud_integration.md id: sonarcloud - - - name: Create citation data issue - uses: JasonEtco/create-an-issue@v2 - env: - GITHUB_TOKEN: ${{ '{{ ' -}} secrets.GITHUB_TOKEN }} - with: - filename: .github/next_steps/02_citation.md - id: citation - name: Create readthedocs issue uses: JasonEtco/create-an-issue@v2 env: @@ -50,7 +42,6 @@ jobs: * Sonarcloud integration ${{ '{{ ' -}} steps.sonarcloud.outputs.url }} * Zenodo integration ${{ '{{ ' -}} steps.zenodo.outputs.url }} * Read the Docs instructions ${{ '{{ ' -}} steps.readthedocs.outputs.url }} - * Citation data ${{ '{{ ' -}} steps.citation.outputs.url }} * Linting fixes ${{ '{{ ' -}} steps.linting.outputs.url }}' - name: Cleanup files needed to create next steps issues run: | From b2c6ff94cbeef7ce508d571abe98f89e2ea692a1 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Tue, 20 Aug 2024 16:11:43 +0200 Subject: [PATCH 054/285] Add markdown link checker question --- copier.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/copier.yml b/copier.yml index 04123c2c..c655dcb2 100644 --- a/copier.yml +++ b/copier.yml @@ -71,6 +71,12 @@ license: - "Not open source" default: "MIT license" +AddMarkdownLinkCheck: + when: "{{ template_profile == 'ask' }}" + type: bool + default: "{{ template_profile != 'minimum' }}" + help: Do you want to add a GitHub action to check links in markdown files? + AddGitHubActions: when: "{{ template_profile == 'ask' }}" type: bool From 8f3a13f878e8697a76b6c34ee2b38a766bf65e0c Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Tue, 20 Aug 2024 16:24:05 +0200 Subject: [PATCH 055/285] Rename markdown-link-check --- ... if AddMarkdownLinkCheck %}markdown-link-check.yml{% endif %}} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename template/.github/workflows/{markdown-link-check.yml => {% if AddMarkdownLinkCheck %}markdown-link-check.yml{% endif %}} (100%) diff --git a/template/.github/workflows/markdown-link-check.yml b/template/.github/workflows/{% if AddMarkdownLinkCheck %}markdown-link-check.yml{% endif %} similarity index 100% rename from template/.github/workflows/markdown-link-check.yml rename to template/.github/workflows/{% if AddMarkdownLinkCheck %}markdown-link-check.yml{% endif %} From 92ac5ae157c5b919a9cf2e5ca6261adc9322d7d6 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Tue, 20 Aug 2024 16:30:02 +0200 Subject: [PATCH 056/285] Remove word markdown from the file name --- copier.yml | 4 ++-- ...ndif %} => {% if AddLinkCheck %}link-check.yml{% endif %}} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename template/.github/workflows/{{% if AddMarkdownLinkCheck %}markdown-link-check.yml{% endif %} => {% if AddLinkCheck %}link-check.yml{% endif %}} (100%) diff --git a/copier.yml b/copier.yml index c655dcb2..25681229 100644 --- a/copier.yml +++ b/copier.yml @@ -71,11 +71,11 @@ license: - "Not open source" default: "MIT license" -AddMarkdownLinkCheck: +AddLinkCheck: when: "{{ template_profile == 'ask' }}" type: bool default: "{{ template_profile != 'minimum' }}" - help: Do you want to add a GitHub action to check links in markdown files? + help: Do you want to add a GitHub action to check broken links? AddGitHubActions: when: "{{ template_profile == 'ask' }}" diff --git a/template/.github/workflows/{% if AddMarkdownLinkCheck %}markdown-link-check.yml{% endif %} b/template/.github/workflows/{% if AddLinkCheck %}link-check.yml{% endif %} similarity index 100% rename from template/.github/workflows/{% if AddMarkdownLinkCheck %}markdown-link-check.yml{% endif %} rename to template/.github/workflows/{% if AddLinkCheck %}link-check.yml{% endif %} From 3d6128572ccbc84b620ee2befc51b07f75bb681f Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 16:31:39 +0200 Subject: [PATCH 057/285] fix the name of CITATION.cff file --- ...endif %} => {% if AddCitation %}CITATION.cff{% endif %}.jinja} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename template/{{% if AddCitation %}CITATION.cff.jinja{% endif %} => {% if AddCitation %}CITATION.cff{% endif %}.jinja} (100%) diff --git a/template/{% if AddCitation %}CITATION.cff.jinja{% endif %} b/template/{% if AddCitation %}CITATION.cff{% endif %}.jinja similarity index 100% rename from template/{% if AddCitation %}CITATION.cff.jinja{% endif %} rename to template/{% if AddCitation %}CITATION.cff{% endif %}.jinja From b1b6a8777ac41426f58b8f884bd15f2c6029aba8 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Tue, 20 Aug 2024 16:42:33 +0200 Subject: [PATCH 058/285] Use lychee to test links --- ...f AddLinkCheck %}link-check.yml{% endif %} | 33 +++++++++++++++++++ template/.mlc-config.json | 30 ----------------- 2 files changed, 33 insertions(+), 30 deletions(-) create mode 100644 template/.github/workflows/{% if AddLinkCheck %}link-check.yml{% endif %} delete mode 100644 template/.mlc-config.json diff --git a/template/.github/workflows/{% if AddLinkCheck %}link-check.yml{% endif %} b/template/.github/workflows/{% if AddLinkCheck %}link-check.yml{% endif %} new file mode 100644 index 00000000..66ca87c7 --- /dev/null +++ b/template/.github/workflows/{% if AddLinkCheck %}link-check.yml{% endif %} @@ -0,0 +1,33 @@ +name: link-check + +on: + push: + branches: + - main + pull_request: + branches: + - main + schedule: + - cron: '0 0 * * 0' # every Sunday at 00:00 + +jobs: + linkChecker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Link Checker + id: lychee + uses: lycheeverse/lychee-action@v1 + with: + # fail action if there are broken links + fail: true + + - name: Create Issue From File + # create issues only when triggered by schedule + if: github.event_name == 'schedule' && env.lychee_exit_code != 0 + uses: peter-evans/create-issue-from-file@v5 + with: + title: Link Checker Report + content-filepath: ./lychee/out.md + labels: report, automated issue diff --git a/template/.mlc-config.json b/template/.mlc-config.json deleted file mode 100644 index 1d388679..00000000 --- a/template/.mlc-config.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "_comment": "Markdown Link Checker configuration, see https://github.com/gaurav-nelson/github-action-markdown-link-check and https://github.com/tcort/markdown-link-check", - "ignorePatterns": [ - { - "pattern": "^http://localhost" - }, - { - "pattern": "^https://doi.org/" - }, - { - "pattern": "^https://github.com/.*/settings/secrets/actions$" - }, - { - "pattern": "^https://github.com/organizations/.*/repositories/new" - }, - { - "pattern": "^https://test.pypi.org" - }, - { - "pattern": "^https://bestpractices.coreinfrastructure.org/projects/" - }, - { - "pattern": "^https://readthedocs.org/dashboard/import.*" - } - ], - "replacementPatterns": [ - ], - "retryOn429": true, - "timeout": "20s" -} From 1fc88bccd3de616e8eead5b2ccdf49792e946f6b Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 16:43:57 +0200 Subject: [PATCH 059/285] update the changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8978bd94..70796883 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Added +* Added a question about citation file [#471](https://github.com/NLeSC/python-template/pull/471) * Added Python 3.12 support [#356](https://github.com/NLeSC/python-template/issues/356) * Template unit tests for documentation generation, linting and version bumping * Docstring for function From 008596a868404fedfbd07227eb9bc92c6054b465 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 17:16:34 +0200 Subject: [PATCH 060/285] fix escape character issues in next_steps*.yml files --- template/.github/workflows/next_steps.yml | 16 ++++++++-------- ...Citation %}next_steps_citation.yml{% endif %} | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/template/.github/workflows/next_steps.yml b/template/.github/workflows/next_steps.yml index 04da514e..3d9adc8a 100644 --- a/template/.github/workflows/next_steps.yml +++ b/template/.github/workflows/next_steps.yml @@ -11,38 +11,38 @@ jobs: - name: Create Sonarcloud integration issue uses: JasonEtco/create-an-issue@v2 env: - GITHUB_TOKEN: ${{ '{{ ' -}} secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: filename: .github/next_steps/01_sonarcloud_integration.md id: sonarcloud - name: Create readthedocs issue uses: JasonEtco/create-an-issue@v2 env: - GITHUB_TOKEN: ${{ '{{ ' -}} secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: filename: .github/next_steps/03_readthedocs.md id: readthedocs - name: Create Zenodo integration issue uses: JasonEtco/create-an-issue@v2 env: - GITHUB_TOKEN: ${{ '{{ ' -}} secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: filename: .github/next_steps/04_zenodo_integration.md id: zenodo - name: Create linting issue uses: JasonEtco/create-an-issue@v2 env: - GITHUB_TOKEN: ${{ '{{ ' -}} secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: filename: .github/next_steps/05_linting.md id: linting - name: List created issues run: | echo 'Created issues that must be completed to have fully working Python package: - * Sonarcloud integration ${{ '{{ ' -}} steps.sonarcloud.outputs.url }} - * Zenodo integration ${{ '{{ ' -}} steps.zenodo.outputs.url }} - * Read the Docs instructions ${{ '{{ ' -}} steps.readthedocs.outputs.url }} - * Linting fixes ${{ '{{ ' -}} steps.linting.outputs.url }}' + * Sonarcloud integration ${{ steps.sonarcloud.outputs.url }} + * Zenodo integration ${{ steps.zenodo.outputs.url }} + * Read the Docs instructions ${{ steps.readthedocs.outputs.url }} + * Linting fixes ${{ steps.linting.outputs.url }}' - name: Cleanup files needed to create next steps issues run: | git config --global user.name 'NLeSC Python template' diff --git a/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} b/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} index 2e919e5e..a45f011d 100644 --- a/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} +++ b/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} @@ -2,7 +2,7 @@ on: [push] permissions: contents: write issues: write -name: Create issues for next steps +name: Create issue for citation jobs: next_steps: runs-on: ubuntu-latest @@ -11,14 +11,14 @@ jobs: - name: Create citation data issue uses: JasonEtco/create-an-issue@v2 env: - GITHUB_TOKEN: ${{ '{{ ' -}} secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: filename: .github/next_steps/02_citation.md id: citation - name: List created issues run: | echo 'Created issues that must be completed to have fully working Python package: - * Citation data ${{ '{{ ' -}} steps.citation.outputs.url }} + * Citation data ${{ steps.citation.outputs.url }} - name: Cleanup files needed to create next steps issues run: | git config --global user.name 'NLeSC Python template' From 37ce238d2fe260e3e945525157bc1025e9786e2c Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 17:47:53 +0200 Subject: [PATCH 061/285] add online documentation question --- copier.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/copier.yml b/copier.yml index 04123c2c..fa1d28aa 100644 --- a/copier.yml +++ b/copier.yml @@ -77,6 +77,12 @@ AddGitHubActions: default: "{{ template_profile != 'minimum' }}" help: GitHub actions to test the package and the documentation +AddOnlineDocumentation: + when: "{{ template_profile == 'ask' }}" + type: bool + default: "{{ template_profile != 'minimum' }}" + help: Online documentation using Read the Docs + # internal fields _subdirectory: template From 97cbfeb3228ac4c0233a9d1b39c9206c3def4bb7 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 17:49:59 +0200 Subject: [PATCH 062/285] update the changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8978bd94..dc22b61b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Added +* Make online documentation optional [#476](https://github.com/NLeSC/python-template/pull/476) * Added Python 3.12 support [#356](https://github.com/NLeSC/python-template/issues/356) * Template unit tests for documentation generation, linting and version bumping * Docstring for function From 08563601b0f7476c2d86a166c05f540f12ea010c Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 17:50:39 +0200 Subject: [PATCH 063/285] create the online documentation configration conditionally --- ...> {% if AddOnlineDocumentation %}.readthedocs.yaml{% endif %}} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename template/{.readthedocs.yaml => {% if AddOnlineDocumentation %}.readthedocs.yaml{% endif %}} (100%) diff --git a/template/.readthedocs.yaml b/template/{% if AddOnlineDocumentation %}.readthedocs.yaml{% endif %} similarity index 100% rename from template/.readthedocs.yaml rename to template/{% if AddOnlineDocumentation %}.readthedocs.yaml{% endif %} From 894a856abae8259202eb1ded3dd6ce9dcd0c23ab Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 20 Aug 2024 17:51:43 +0200 Subject: [PATCH 064/285] add next steps workflow for online documentation --- ..._steps_online_documentation.yml{% endif %} | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 template/.github/workflows/{% if AddOnlineDocumentation %}next_steps_online_documentation.yml{% endif %} diff --git a/template/.github/workflows/{% if AddOnlineDocumentation %}next_steps_online_documentation.yml{% endif %} b/template/.github/workflows/{% if AddOnlineDocumentation %}next_steps_online_documentation.yml{% endif %} new file mode 100644 index 00000000..7ff3b740 --- /dev/null +++ b/template/.github/workflows/{% if AddOnlineDocumentation %}next_steps_online_documentation.yml{% endif %} @@ -0,0 +1,29 @@ +on: [push] +permissions: + contents: write + issues: write +name: Create issues for next steps +jobs: + next_steps: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Create readthedocs issue + uses: JasonEtco/create-an-issue@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + filename: .github/next_steps/03_readthedocs.md + id: readthedocs + - name: List created issues + run: | + echo 'Created issues that must be completed to have fully working Python package: + * Read the Docs instructions ${{ steps.readthedocs.outputs.url }}' + - name: Cleanup files needed to create next steps issues + run: | + git config --global user.name 'NLeSC Python template' + git config --global user.email 'nlesc-python-template@users.noreply.github.com' + git rm .github/workflows/next_steps_online_documentation.yml + git rm -r .github/next_steps + git commit -am "Cleanup automated next steps issue generator" + git push From bc0cc8a35e76c679bbf9eeef73aee991c48e7c1e Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 21 Aug 2024 10:13:27 +0200 Subject: [PATCH 065/285] Update template/.github/workflows/{% if AddLinkCheck %}link-check.yml{% endif %} Co-authored-by: Stefan Verhoeven --- .../workflows/{% if AddLinkCheck %}link-check.yml{% endif %} | 1 + 1 file changed, 1 insertion(+) diff --git a/template/.github/workflows/{% if AddLinkCheck %}link-check.yml{% endif %} b/template/.github/workflows/{% if AddLinkCheck %}link-check.yml{% endif %} index 66ca87c7..8471c2e0 100644 --- a/template/.github/workflows/{% if AddLinkCheck %}link-check.yml{% endif %} +++ b/template/.github/workflows/{% if AddLinkCheck %}link-check.yml{% endif %} @@ -22,6 +22,7 @@ jobs: with: # fail action if there are broken links fail: true + args: "--exclude-all-private" - name: Create Issue From File # create issues only when triggered by schedule From b5c84a27ccb16c659d535308ce45443c07064b34 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 10:48:52 +0200 Subject: [PATCH 066/285] add missing single quote to citation workflow --- .../{% if AddCitation %}next_steps_citation.yml{% endif %} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} b/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} index a45f011d..15b34013 100644 --- a/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} +++ b/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} @@ -18,7 +18,7 @@ jobs: - name: List created issues run: | echo 'Created issues that must be completed to have fully working Python package: - * Citation data ${{ steps.citation.outputs.url }} + * Citation data ${{ steps.citation.outputs.url }}' - name: Cleanup files needed to create next steps issues run: | git config --global user.name 'NLeSC Python template' From 64159598b5c2c91aed0e2f340ffaf65aa188a81f Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 10:51:30 +0200 Subject: [PATCH 067/285] add missing single quote to citation workflow --- .../{% if AddCitation %}next_steps_citation.yml{% endif %} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} b/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} index 15b34013..48269288 100644 --- a/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} +++ b/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} @@ -2,7 +2,7 @@ on: [push] permissions: contents: write issues: write -name: Create issue for citation +name: Create an issue for citation jobs: next_steps: runs-on: ubuntu-latest From 41e1fc1ad166736dbd32fa1fcb53954f6122be01 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 10:56:21 +0200 Subject: [PATCH 068/285] add missing single quote to documentation workflow --- ...cumentation %}next_steps_online_documentation.yml{% endif %} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/.github/workflows/{% if AddOnlineDocumentation %}next_steps_online_documentation.yml{% endif %} b/template/.github/workflows/{% if AddOnlineDocumentation %}next_steps_online_documentation.yml{% endif %} index 7ff3b740..1bc71b38 100644 --- a/template/.github/workflows/{% if AddOnlineDocumentation %}next_steps_online_documentation.yml{% endif %} +++ b/template/.github/workflows/{% if AddOnlineDocumentation %}next_steps_online_documentation.yml{% endif %} @@ -2,7 +2,7 @@ on: [push] permissions: contents: write issues: write -name: Create issues for next steps +name: Create an issue for online documentation jobs: next_steps: runs-on: ubuntu-latest From 2400f3055b74e8957eb46ba01047cc5bc7b409f6 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 11:00:05 +0200 Subject: [PATCH 069/285] create 03_readthedocs.md conditionally --- ...f AddOnlineDocumentation %}03_readthedocs.md{% endif %}.jinja} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename template/.github/next_steps/{03_readthedocs.md.jinja => {% if AddOnlineDocumentation %}03_readthedocs.md{% endif %}.jinja} (100%) diff --git a/template/.github/next_steps/03_readthedocs.md.jinja b/template/.github/next_steps/{% if AddOnlineDocumentation %}03_readthedocs.md{% endif %}.jinja similarity index 100% rename from template/.github/next_steps/03_readthedocs.md.jinja rename to template/.github/next_steps/{% if AddOnlineDocumentation %}03_readthedocs.md{% endif %}.jinja From 6934f227ac8cb434fea9e0c1c6d6413bd9b636b8 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 11:02:33 +0200 Subject: [PATCH 070/285] remove read the docs from next_steps.yml --- template/.github/workflows/next_steps.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/template/.github/workflows/next_steps.yml b/template/.github/workflows/next_steps.yml index e759c491..81f1855c 100644 --- a/template/.github/workflows/next_steps.yml +++ b/template/.github/workflows/next_steps.yml @@ -23,13 +23,6 @@ jobs: with: filename: .github/next_steps/02_citation.md id: citation - - name: Create readthedocs issue - uses: JasonEtco/create-an-issue@v2 - env: - GITHUB_TOKEN: ${{ '{{ ' -}} secrets.GITHUB_TOKEN }} - with: - filename: .github/next_steps/03_readthedocs.md - id: readthedocs - name: Create Zenodo integration issue uses: JasonEtco/create-an-issue@v2 env: @@ -49,7 +42,6 @@ jobs: echo 'Created issues that must be completed to have fully working Python package: * Sonarcloud integration ${{ '{{ ' -}} steps.sonarcloud.outputs.url }} * Zenodo integration ${{ '{{ ' -}} steps.zenodo.outputs.url }} - * Read the Docs instructions ${{ '{{ ' -}} steps.readthedocs.outputs.url }} * Citation data ${{ '{{ ' -}} steps.citation.outputs.url }} * Linting fixes ${{ '{{ ' -}} steps.linting.outputs.url }}' - name: Cleanup files needed to create next steps issues From 7a9acfaec0a8e05b195c52d1cb441a9447925e6e Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 21 Aug 2024 11:16:51 +0200 Subject: [PATCH 071/285] Remove extra args --- .../workflows/{% if AddLinkCheck %}link-check.yml{% endif %} | 1 - 1 file changed, 1 deletion(-) diff --git a/template/.github/workflows/{% if AddLinkCheck %}link-check.yml{% endif %} b/template/.github/workflows/{% if AddLinkCheck %}link-check.yml{% endif %} index 8471c2e0..66ca87c7 100644 --- a/template/.github/workflows/{% if AddLinkCheck %}link-check.yml{% endif %} +++ b/template/.github/workflows/{% if AddLinkCheck %}link-check.yml{% endif %} @@ -22,7 +22,6 @@ jobs: with: # fail action if there are broken links fail: true - args: "--exclude-all-private" - name: Create Issue From File # create issues only when triggered by schedule From 92db4bd9f682c05939a62d3e1038620392875f08 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 11:20:08 +0200 Subject: [PATCH 072/285] create read the docs badge conditionally --- template/README.md.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/README.md.jinja b/template/README.md.jinja index 04123ae5..fa8d8fb5 100644 --- a/template/README.md.jinja +++ b/template/README.md.jinja @@ -13,7 +13,7 @@ | **Other best practices** |   | | Static analysis | [![workflow scq badge](https://sonarcloud.io/api/project_badges/measure?project={{github_organization}}_{{package_name}}&metric=alert_status)](https://sonarcloud.io/dashboard?id={{github_organization}}_{{package_name}}) | | Coverage | [![workflow scc badge](https://sonarcloud.io/api/project_badges/measure?project={{github_organization}}_{{package_name}}&metric=coverage)](https://sonarcloud.io/dashboard?id={{github_organization}}_{{package_name}}) | -| Documentation | [![Documentation Status](https://readthedocs.org/projects/{{package_name}}/badge/?version=latest)](https://{{package_name}}.readthedocs.io/en/latest/?badge=latest) | +{% if AddOnlineDocumentation %}| Documentation | [![Documentation Status](https://readthedocs.org/projects/{{package_name}}/badge/?version=latest)](https://{{package_name}}.readthedocs.io/en/latest/?badge=latest) |{% endif %} | **GitHub Actions** |   | | Build | [![build]({{repository_url}}/actions/workflows/build.yml/badge.svg)]({{repository_url}}/actions/workflows/build.yml) | | Citation data consistency | [![cffconvert]({{repository_url}}/actions/workflows/cffconvert.yml/badge.svg)]({{repository_url}}/actions/workflows/cffconvert.yml) | From cbe034e45d490d1528de393edf29924b2b90fbb0 Mon Sep 17 00:00:00 2001 From: sverhoeven Date: Wed, 21 Aug 2024 11:07:08 +0200 Subject: [PATCH 073/285] Make changelog optional Fixes #462 --- copier.yml | 6 +++++- template/CONTRIBUTING.md.jinja | 4 ++++ template/README.dev.md.jinja | 8 +++++--- template/project_setup.md.jinja | 2 ++ template/pyproject.toml.jinja | 2 ++ ...OG.md => {% if AddChangeLog %}CHANGELOG.md{% endif %}} | 0 6 files changed, 18 insertions(+), 4 deletions(-) rename template/{CHANGELOG.md => {% if AddChangeLog %}CHANGELOG.md{% endif %}} (100%) diff --git a/copier.yml b/copier.yml index 04123c2c..b9b8793f 100644 --- a/copier.yml +++ b/copier.yml @@ -77,11 +77,15 @@ AddGitHubActions: default: "{{ template_profile != 'minimum' }}" help: GitHub actions to test the package and the documentation +AddChangeLog: + when: "{{ template_profile == 'ask' }}" + type: bool + default: "{{ template_profile != 'minimum' }}" + help: Add a change log to keep track of changes in the package # internal fields _subdirectory: template - # user messages _message_before_copy: | Thanks for generating a project using our template. diff --git a/template/CONTRIBUTING.md.jinja b/template/CONTRIBUTING.md.jinja index fe1b7e11..d95b39cc 100644 --- a/template/CONTRIBUTING.md.jinja +++ b/template/CONTRIBUTING.md.jinja @@ -35,7 +35,9 @@ The sections below outline the steps in each case. 1. make sure the existing tests still work by running ``pytest``; 1. add your own tests (if necessary); 1. update or expand the documentation; +{% if AddChangeLog -%} 1. update the `CHANGELOG.md` file with your change; +{%- endif %} 1. [push](http://rogerdudler.github.io/git-guide/) your feature branch to (your fork of) the {{ package_name }} repository on GitHub; 1. create the pull request, e.g. following the instructions [here](https://help.github.com/articles/creating-a-pull-request/). @@ -47,7 +49,9 @@ To create a release you need write permission on the repository. 1. Check the author list in [`CITATION.cff`](CITATION.cff) 1. Bump the version using `bump-my-version bump `. For example, `bump-my-version bump major` will increase major version numbers everywhere it's needed (code, meta, etc.) in the repo. Alternatively the version can be manually changed in {{ package_name }}/__init__.py, pyproject.toml, CITATION.cff and docs/conf.py (and other places it was possibly added). +{% if AddChangeLog -%} 1. Update the `CHANGELOG.md` to include changes made +{%- endif %} 1. Go to the [GitHub release page]({{ repository_url }}/releases) 1. Press draft a new release button 1. Fill version, title and description field diff --git a/template/README.dev.md.jinja b/template/README.dev.md.jinja index b108be81..74abbe85 100644 --- a/template/README.dev.md.jinja +++ b/template/README.dev.md.jinja @@ -133,10 +133,12 @@ This section describes how to make a release in 3 parts: ### (1/3) Preparation +{% if AddChangeLog -%} 1. Update the (don't forget to update links at bottom of page) -2. Verify that the information in [`CITATION.cff`](CITATION.cff) is correct. -3. Make sure the [version has been updated](#versioning). -4. Run the unit tests with `pytest -v` +{%- endif %} +1. Verify that the information in [`CITATION.cff`](CITATION.cff) is correct. +1. Make sure the [version has been updated](#versioning). +1. Run the unit tests with `pytest -v` ### (2/3) PyPI diff --git a/template/project_setup.md.jinja b/template/project_setup.md.jinja index 0f4949f2..4cad9373 100644 --- a/template/project_setup.md.jinja +++ b/template/project_setup.md.jinja @@ -85,10 +85,12 @@ help you decide which tool to use for packaging. - The project is set up with a logging example. - [Relevant section in the guide](https://guide.esciencecenter.nl/#/best_practices/language_guides/python?id=logging) +{% if AddChangeLog -%} ## CHANGELOG.md - Document changes to your software package - [Relevant section in the guide](https://guide.esciencecenter.nl/#/best_practices/releases?id=changelogmd) +{%- endif %} ## CITATION.cff diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index 10a0481f..964e5185 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -71,7 +71,9 @@ publishing = [ [project.urls] Repository = "{{ repository_url }}" Issues = "{{ repository_url }}/issues" +{% if AddChangeLog -%} Changelog = "{{ repository_url }}/CHANGELOG.md" +{%- endif %} [tool.pytest.ini_options] testpaths = ["tests"] diff --git a/template/CHANGELOG.md b/template/{% if AddChangeLog %}CHANGELOG.md{% endif %} similarity index 100% rename from template/CHANGELOG.md rename to template/{% if AddChangeLog %}CHANGELOG.md{% endif %} From 0b80ef5a4b011f51540342844e0a3bacd8f530bd Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 11:21:19 +0200 Subject: [PATCH 074/285] mention read the docs configuration conditionally in project_setup.md --- template/project_setup.md.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/project_setup.md.jinja b/template/project_setup.md.jinja index 0f4949f2..43661564 100644 --- a/template/project_setup.md.jinja +++ b/template/project_setup.md.jinja @@ -59,7 +59,7 @@ help you decide which tool to use for packaging. - The documentation is set up with the ReadTheDocs Sphinx theme. - Check out its [configuration options](https://sphinx-rtd-theme.readthedocs.io/en/latest/). - [AutoAPI](https://sphinx-autoapi.readthedocs.io/) is used to generate documentation for the package Python objects. -- `.readthedocs.yaml` is the ReadTheDocs configuration file. When ReadTheDocs is building the documentation this package and its development dependencies are installed so the API reference can be rendered. +{% if AddOnlineDocumentation %}- `.readthedocs.yaml` is the ReadTheDocs configuration file. When ReadTheDocs is building the documentation this package and its development dependencies are installed so the API reference can be rendered.{% endif %} - [Relevant section in the guide](https://guide.esciencecenter.nl/#/best_practices/language_guides/python?id=writingdocumentation) ## Coding style conventions and code quality From 4070729bb9281f422a44f4ae996b643dd7d56f1b Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 11:45:56 +0200 Subject: [PATCH 075/285] create .github/next_steps/02_citation.md conditionally --- ....jinja => {% if AddCitation %}02_citation.md{% endif %}.jinja} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename template/.github/next_steps/{02_citation.md.jinja => {% if AddCitation %}02_citation.md{% endif %}.jinja} (100%) diff --git a/template/.github/next_steps/02_citation.md.jinja b/template/.github/next_steps/{% if AddCitation %}02_citation.md{% endif %}.jinja similarity index 100% rename from template/.github/next_steps/02_citation.md.jinja rename to template/.github/next_steps/{% if AddCitation %}02_citation.md{% endif %}.jinja From 0d96a245d3389563b352950b56e2a3a8956f9e64 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 11:47:00 +0200 Subject: [PATCH 076/285] include CITATION.cff in MANIFEST.in conditionally --- template/MANIFEST.in | 4 ---- template/MANIFEST.in.jinja | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 template/MANIFEST.in create mode 100644 template/MANIFEST.in.jinja diff --git a/template/MANIFEST.in b/template/MANIFEST.in deleted file mode 100644 index f128825e..00000000 --- a/template/MANIFEST.in +++ /dev/null @@ -1,4 +0,0 @@ -include CITATION.cff -include LICENSE -include NOTICE -include README.md diff --git a/template/MANIFEST.in.jinja b/template/MANIFEST.in.jinja new file mode 100644 index 00000000..df1df893 --- /dev/null +++ b/template/MANIFEST.in.jinja @@ -0,0 +1,4 @@ +{% if AddCitation %}include CITATION.cff{% endif %} +include LICENSE +include NOTICE +include README.md From 1fc396981e9d6861d412debd090b3019eae559a1 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 11:48:06 +0200 Subject: [PATCH 077/285] include CITATION.cff in bumversion conditionally --- template/pyproject.toml.jinja | 2 ++ 1 file changed, 2 insertions(+) diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index 10a0481f..b1e40781 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -149,8 +149,10 @@ filename = "src/{{ package_name }}/__init__.py" [[tool.bumpversion.files]] filename = "pyproject.toml" +{% if AddCitation %} [[tool.bumpversion.files]] filename = "CITATION.cff" +{% endif %} [[tool.bumpversion.files]] filename = "docs/conf.py" From 3e9f2caf2f84ed695dc193dd1c50b8d03a3973ff Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 11:48:54 +0200 Subject: [PATCH 078/285] show cffconvert badge conditionally --- template/README.md.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/README.md.jinja b/template/README.md.jinja index 04123ae5..258b8340 100644 --- a/template/README.md.jinja +++ b/template/README.md.jinja @@ -16,7 +16,7 @@ | Documentation | [![Documentation Status](https://readthedocs.org/projects/{{package_name}}/badge/?version=latest)](https://{{package_name}}.readthedocs.io/en/latest/?badge=latest) | | **GitHub Actions** |   | | Build | [![build]({{repository_url}}/actions/workflows/build.yml/badge.svg)]({{repository_url}}/actions/workflows/build.yml) | -| Citation data consistency | [![cffconvert]({{repository_url}}/actions/workflows/cffconvert.yml/badge.svg)]({{repository_url}}/actions/workflows/cffconvert.yml) | +{% if AddCitation %}| Citation data consistency | [![cffconvert]({{repository_url}}/actions/workflows/cffconvert.yml/badge.svg)]({{repository_url}}/actions/workflows/cffconvert.yml) |{% endif %} | SonarCloud | [![sonarcloud]({{repository_url}}/actions/workflows/sonarcloud.yml/badge.svg)]({{repository_url}}/actions/workflows/sonarcloud.yml) | | MarkDown link checker | [![markdown-link-check]({{repository_url}}/actions/workflows/markdown-link-check.yml/badge.svg)]({{repository_url}}/actions/workflows/markdown-link-check.yml) | From 1b68ffbf93881d0e7e477c962586d50787f4358c Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 11:50:24 +0200 Subject: [PATCH 079/285] show citation-related text conditionally --- template/CONTRIBUTING.md.jinja | 4 ++-- template/README.dev.md.jinja | 6 +++--- template/project_setup.md.jinja | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/template/CONTRIBUTING.md.jinja b/template/CONTRIBUTING.md.jinja index fe1b7e11..05fd8cee 100644 --- a/template/CONTRIBUTING.md.jinja +++ b/template/CONTRIBUTING.md.jinja @@ -45,8 +45,8 @@ In case you feel like you've made a valuable contribution, but you don't know ho To create a release you need write permission on the repository. -1. Check the author list in [`CITATION.cff`](CITATION.cff) -1. Bump the version using `bump-my-version bump `. For example, `bump-my-version bump major` will increase major version numbers everywhere it's needed (code, meta, etc.) in the repo. Alternatively the version can be manually changed in {{ package_name }}/__init__.py, pyproject.toml, CITATION.cff and docs/conf.py (and other places it was possibly added). +{% if AddCitation %}1. Check the author list in [`CITATION.cff`](CITATION.cff){% endif %} +1. Bump the version using `bump-my-version bump `. For example, `bump-my-version bump major` will increase major version numbers everywhere it's needed (code, meta, etc.) in the repo. Alternatively the version can be manually changed in {{ package_name }}/__init__.py, pyproject.toml, {% if AddCitation %}CITATION.cff{% endif %} and docs/conf.py (and other places it was possibly added). 1. Update the `CHANGELOG.md` to include changes made 1. Go to the [GitHub release page]({{ repository_url }}/releases) 1. Press draft a new release button diff --git a/template/README.dev.md.jinja b/template/README.dev.md.jinja index b108be81..636723c8 100644 --- a/template/README.dev.md.jinja +++ b/template/README.dev.md.jinja @@ -134,9 +134,9 @@ This section describes how to make a release in 3 parts: ### (1/3) Preparation 1. Update the (don't forget to update links at bottom of page) -2. Verify that the information in [`CITATION.cff`](CITATION.cff) is correct. -3. Make sure the [version has been updated](#versioning). -4. Run the unit tests with `pytest -v` +{% if AddCitation %}1. Verify that the information in [`CITATION.cff`](CITATION.cff) is correct.{% endif %} +1. Make sure the [version has been updated](#versioning). +1. Run the unit tests with `pytest -v` ### (2/3) PyPI diff --git a/template/project_setup.md.jinja b/template/project_setup.md.jinja index 0f4949f2..e0929bc8 100644 --- a/template/project_setup.md.jinja +++ b/template/project_setup.md.jinja @@ -90,11 +90,13 @@ help you decide which tool to use for packaging. - Document changes to your software package - [Relevant section in the guide](https://guide.esciencecenter.nl/#/best_practices/releases?id=changelogmd) +{% if AddCitation %} ## CITATION.cff - To allow others to cite your software, add a `CITATION.cff` file - It only makes sense to do this once there is something to cite (e.g., a software release with a DOI). - Follow the [making software citable](https://guide.esciencecenter.nl/#/citable_software/making_software_citable) section in the guide. +{% endif %} ## CODE_OF_CONDUCT.md From 7e2ea4739a646280f04e779fea7fd263aa3af4f0 Mon Sep 17 00:00:00 2001 From: sverhoeven Date: Wed, 21 Aug 2024 11:49:40 +0200 Subject: [PATCH 080/285] No newline when online docs == no --- template/README.md.jinja | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/template/README.md.jinja b/template/README.md.jinja index fa8d8fb5..be608685 100644 --- a/template/README.md.jinja +++ b/template/README.md.jinja @@ -13,7 +13,9 @@ | **Other best practices** |   | | Static analysis | [![workflow scq badge](https://sonarcloud.io/api/project_badges/measure?project={{github_organization}}_{{package_name}}&metric=alert_status)](https://sonarcloud.io/dashboard?id={{github_organization}}_{{package_name}}) | | Coverage | [![workflow scc badge](https://sonarcloud.io/api/project_badges/measure?project={{github_organization}}_{{package_name}}&metric=coverage)](https://sonarcloud.io/dashboard?id={{github_organization}}_{{package_name}}) | -{% if AddOnlineDocumentation %}| Documentation | [![Documentation Status](https://readthedocs.org/projects/{{package_name}}/badge/?version=latest)](https://{{package_name}}.readthedocs.io/en/latest/?badge=latest) |{% endif %} +{% if AddOnlineDocumentation -%} +| Documentation | [![Documentation Status](https://readthedocs.org/projects/{{package_name}}/badge/?version=latest)](https://{{package_name}}.readthedocs.io/en/latest/?badge=latest) | +{%- endif -%} | **GitHub Actions** |   | | Build | [![build]({{repository_url}}/actions/workflows/build.yml/badge.svg)]({{repository_url}}/actions/workflows/build.yml) | | Citation data consistency | [![cffconvert]({{repository_url}}/actions/workflows/cffconvert.yml/badge.svg)]({{repository_url}}/actions/workflows/cffconvert.yml) | From c25eea62132665385abf550adbc06e6de09a3d9b Mon Sep 17 00:00:00 2001 From: sverhoeven Date: Wed, 21 Aug 2024 11:57:02 +0200 Subject: [PATCH 081/285] When nodoc then do not insert empty lines --- template/project_setup.md.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/project_setup.md.jinja b/template/project_setup.md.jinja index 43661564..43e09901 100644 --- a/template/project_setup.md.jinja +++ b/template/project_setup.md.jinja @@ -59,7 +59,7 @@ help you decide which tool to use for packaging. - The documentation is set up with the ReadTheDocs Sphinx theme. - Check out its [configuration options](https://sphinx-rtd-theme.readthedocs.io/en/latest/). - [AutoAPI](https://sphinx-autoapi.readthedocs.io/) is used to generate documentation for the package Python objects. -{% if AddOnlineDocumentation %}- `.readthedocs.yaml` is the ReadTheDocs configuration file. When ReadTheDocs is building the documentation this package and its development dependencies are installed so the API reference can be rendered.{% endif %} +{% if AddOnlineDocumentation %}- `.readthedocs.yaml` is the ReadTheDocs configuration file. When ReadTheDocs is building the documentation this package and its development dependencies are installed so the API reference can be rendered.{% endif -%} - [Relevant section in the guide](https://guide.esciencecenter.nl/#/best_practices/language_guides/python?id=writingdocumentation) ## Coding style conventions and code quality From 017e2966da2a5544d3cd01b5746324ed11b99fee Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 21 Aug 2024 11:57:18 +0200 Subject: [PATCH 082/285] Fix issue creation and add date --- ...f AddLinkCheck %}link-check.yml{% endif %} | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/template/.github/workflows/{% if AddLinkCheck %}link-check.yml{% endif %} b/template/.github/workflows/{% if AddLinkCheck %}link-check.yml{% endif %} index 66ca87c7..34781c39 100644 --- a/template/.github/workflows/{% if AddLinkCheck %}link-check.yml{% endif %} +++ b/template/.github/workflows/{% if AddLinkCheck %}link-check.yml{% endif %} @@ -1,6 +1,7 @@ name: link-check on: + workflow_dispatch: push: branches: - main @@ -8,7 +9,11 @@ on: branches: - main schedule: - - cron: '0 0 * * 0' # every Sunday at 00:00 + - cron: '0 0 1 * *' # first day of every month at midnight + +permissions: + contents: read + issues: write jobs: linkChecker: @@ -19,15 +24,15 @@ jobs: - name: Link Checker id: lychee uses: lycheeverse/lychee-action@v1 - with: - # fail action if there are broken links - fail: true + + - name: Set Issue Title + id: set_title + run: echo "ISSUE_TITLE=Link Checker Report - $(date '+%Y-%m-%d')" >> $GITHUB_ENV - name: Create Issue From File - # create issues only when triggered by schedule - if: github.event_name == 'schedule' && env.lychee_exit_code != 0 + if: env.lychee_exit_code != 0 uses: peter-evans/create-issue-from-file@v5 with: - title: Link Checker Report + title: ${{ env.ISSUE_TITLE }} content-filepath: ./lychee/out.md labels: report, automated issue From 408324d50f8466fac9611a4807c7477f8a64119a Mon Sep 17 00:00:00 2001 From: sverhoeven Date: Wed, 21 Aug 2024 12:11:09 +0200 Subject: [PATCH 083/285] Fix link to changelog --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bb18c563..3127f093 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Use this [Copier](https://copier.readthedocs.io) template to generate an empty P - [README.md](template/README.md.jinja) for package users, - [README.dev.md](template/README.dev.md.jinja) for package developer, - [project_setup.md](template/project_setup.md.jinja) with extensive documentation about project setup, - - [Change log](template/CHANGELOG.md), + - [Change log](template/%7B%25%20if%20AddChangeLog%20%25%7DCHANGELOG.md%7B%25%20endif%20%25%7D), - [Code of Conduct](template/CODE_OF_CONDUCT.md.jinja), - [Contributing guidelines](template/CONTRIBUTING.md.jinja), - Continuous code quality and code coverage reporting using [Sonarcloud](https://sonarcloud.io/), From aae7b0ef1fd7204acd8a00b1a9647db5c4a3d477 Mon Sep 17 00:00:00 2001 From: sverhoeven Date: Wed, 21 Aug 2024 12:14:00 +0200 Subject: [PATCH 084/285] Add optional template changelog to root changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8978bd94..2d5ddf59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ ### Changed +* CHANGELOG.md is now optional ([#462](https://github.com/NLeSC/python-template/issues/462)) * Moved to src/ based layout for generated packages * Moved from setup.cfg/.py to pyproject.toml [#351](https://github.com/NLeSC/python-template/issues/351) * Moved from prospector to ruff [#336](https://github.com/NLeSC/python-template/issues/336) From e36a968522a6c6ca74209e6d12d6df329c5fab6e Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 21 Aug 2024 13:29:14 +0200 Subject: [PATCH 085/285] Create issue when links are broken. Also add workflow_dispatch to be able to trigger workflow nanually. Decrease frequency of cron scheduler to once a month. Add date to the title of the issue. --- ...markdown-link-check.yml => link-check.yml} | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) rename .github/workflows/{markdown-link-check.yml => link-check.yml} (55%) diff --git a/.github/workflows/markdown-link-check.yml b/.github/workflows/link-check.yml similarity index 55% rename from .github/workflows/markdown-link-check.yml rename to .github/workflows/link-check.yml index 6322bb7f..4f6292a5 100644 --- a/.github/workflows/markdown-link-check.yml +++ b/.github/workflows/link-check.yml @@ -1,6 +1,7 @@ -name: markdown-link-check +name: link-check on: + workflow_dispatch: push: branches: - main @@ -8,7 +9,11 @@ on: branches: - main schedule: - - cron: '0 0 * * 0' # every Sunday at 00:00 + - cron: '0 0 1 * *' # first day of every month at midnight + +permissions: + contents: read + issues: write jobs: linkChecker: @@ -19,15 +24,15 @@ jobs: - name: Link Checker id: lychee uses: lycheeverse/lychee-action@v1 - with: - # fail action if there are broken links - fail: true + + - name: Set Issue Title + id: set_title + run: echo "ISSUE_TITLE=Link Checker Report - $(date '+%Y-%m-%d')" >> $GITHUB_ENV - name: Create Issue From File - # create issues only when triggered by schedule - if: github.event_name == 'schedule' && env.lychee_exit_code != 0 + if: env.lychee_exit_code != 0 uses: peter-evans/create-issue-from-file@v5 with: - title: Link Checker Report + title: ${{ env.ISSUE_TITLE }} content-filepath: ./lychee/out.md labels: report, automated issue From 63077d7de62eda5ae190afaa5a81c101bb31343d Mon Sep 17 00:00:00 2001 From: sverhoeven Date: Wed, 21 Aug 2024 13:45:52 +0200 Subject: [PATCH 086/285] Make pre-commit optional Fixes #457 --- copier.yml | 5 +++++ template/README.dev.md.jinja | 2 ++ .../pre-commit | 0 3 files changed, 7 insertions(+) rename template/{.githooks => {% if AddPreCommit %}.githhooks{% endif %}}/pre-commit (100%) diff --git a/copier.yml b/copier.yml index 5fc0bfb3..d9b5a02f 100644 --- a/copier.yml +++ b/copier.yml @@ -89,6 +89,11 @@ AddOnlineDocumentation: default: "{{ template_profile != 'minimum' }}" help: Online documentation using Read the Docs +AddPreCommit: + when: "{{ template_profile == 'ask' }}" + type: bool + default: "{{ template_profile != 'minimum' }}" + help: Add Pre-commit hooks to check code style and quality # internal fields _subdirectory: template diff --git a/template/README.dev.md.jinja b/template/README.dev.md.jinja index b108be81..fd49cc32 100644 --- a/template/README.dev.md.jinja +++ b/template/README.dev.md.jinja @@ -77,11 +77,13 @@ ruff . --fix To fix readability of your code style you can use [yapf](https://github.com/google/yapf). +{% if AddPreCommit -%} You can enable automatic linting with `ruff` on commit by enabling the git hook from `.githooks/pre-commit`, like so: ```shell git config --local core.hooksPath .githooks ``` +{%- endif %} ## Generating the API docs diff --git a/template/.githooks/pre-commit b/template/{% if AddPreCommit %}.githhooks{% endif %}/pre-commit similarity index 100% rename from template/.githooks/pre-commit rename to template/{% if AddPreCommit %}.githhooks{% endif %}/pre-commit From 7f8fa8ab982c42fd40991e1c30fe8d09533f37ea Mon Sep 17 00:00:00 2001 From: sverhoeven Date: Wed, 21 Aug 2024 13:54:43 +0200 Subject: [PATCH 087/285] Use question form --- copier.yml | 2 +- template/README.dev.md.jinja | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/copier.yml b/copier.yml index d9b5a02f..13618d78 100644 --- a/copier.yml +++ b/copier.yml @@ -93,7 +93,7 @@ AddPreCommit: when: "{{ template_profile == 'ask' }}" type: bool default: "{{ template_profile != 'minimum' }}" - help: Add Pre-commit hooks to check code style and quality + help: Add pre-commit hook to check code style and format on every commit? # internal fields _subdirectory: template diff --git a/template/README.dev.md.jinja b/template/README.dev.md.jinja index fd49cc32..dcd28295 100644 --- a/template/README.dev.md.jinja +++ b/template/README.dev.md.jinja @@ -77,13 +77,13 @@ ruff . --fix To fix readability of your code style you can use [yapf](https://github.com/google/yapf). -{% if AddPreCommit -%} +{%- if AddPreCommit -%} You can enable automatic linting with `ruff` on commit by enabling the git hook from `.githooks/pre-commit`, like so: ```shell git config --local core.hooksPath .githooks ``` -{%- endif %} +{%- endif -%} ## Generating the API docs From 43a6ccfe8a8ef9555cf79ea6e8a40044b15b3036 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 13:59:10 +0200 Subject: [PATCH 088/285] update jinja conditions to fix whitespace and new lines for citation text --- template/CONTRIBUTING.md.jinja | 4 ++-- template/MANIFEST.in.jinja | 2 +- template/README.dev.md.jinja | 2 +- template/README.md.jinja | 4 +++- template/project_setup.md.jinja | 4 ++-- template/pyproject.toml.jinja | 4 ++-- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/template/CONTRIBUTING.md.jinja b/template/CONTRIBUTING.md.jinja index 05fd8cee..4da233cc 100644 --- a/template/CONTRIBUTING.md.jinja +++ b/template/CONTRIBUTING.md.jinja @@ -45,8 +45,8 @@ In case you feel like you've made a valuable contribution, but you don't know ho To create a release you need write permission on the repository. -{% if AddCitation %}1. Check the author list in [`CITATION.cff`](CITATION.cff){% endif %} -1. Bump the version using `bump-my-version bump `. For example, `bump-my-version bump major` will increase major version numbers everywhere it's needed (code, meta, etc.) in the repo. Alternatively the version can be manually changed in {{ package_name }}/__init__.py, pyproject.toml, {% if AddCitation %}CITATION.cff{% endif %} and docs/conf.py (and other places it was possibly added). +{% if AddCitation -%}1. Check the author list in [`CITATION.cff`](CITATION.cff){%- endif %} +1. Bump the version using `bump-my-version bump `. For example, `bump-my-version bump major` will increase major version numbers everywhere it's needed (code, meta, etc.) in the repo. Alternatively the version can be manually changed in {{ package_name }}/__init__.py, pyproject.toml, {% if AddCitation %}CITATION.cff{%- endif -%} and docs/conf.py (and other places it was possibly added). 1. Update the `CHANGELOG.md` to include changes made 1. Go to the [GitHub release page]({{ repository_url }}/releases) 1. Press draft a new release button diff --git a/template/MANIFEST.in.jinja b/template/MANIFEST.in.jinja index df1df893..67ee1713 100644 --- a/template/MANIFEST.in.jinja +++ b/template/MANIFEST.in.jinja @@ -1,4 +1,4 @@ -{% if AddCitation %}include CITATION.cff{% endif %} +{% if AddCitation -%}include CITATION.cff{%- endif %} include LICENSE include NOTICE include README.md diff --git a/template/README.dev.md.jinja b/template/README.dev.md.jinja index 636723c8..b2757efa 100644 --- a/template/README.dev.md.jinja +++ b/template/README.dev.md.jinja @@ -134,7 +134,7 @@ This section describes how to make a release in 3 parts: ### (1/3) Preparation 1. Update the (don't forget to update links at bottom of page) -{% if AddCitation %}1. Verify that the information in [`CITATION.cff`](CITATION.cff) is correct.{% endif %} +{% if AddCitation -%}1. Verify that the information in [`CITATION.cff`](CITATION.cff) is correct.{%- endif %} 1. Make sure the [version has been updated](#versioning). 1. Run the unit tests with `pytest -v` diff --git a/template/README.md.jinja b/template/README.md.jinja index 258b8340..89cbd161 100644 --- a/template/README.md.jinja +++ b/template/README.md.jinja @@ -16,7 +16,9 @@ | Documentation | [![Documentation Status](https://readthedocs.org/projects/{{package_name}}/badge/?version=latest)](https://{{package_name}}.readthedocs.io/en/latest/?badge=latest) | | **GitHub Actions** |   | | Build | [![build]({{repository_url}}/actions/workflows/build.yml/badge.svg)]({{repository_url}}/actions/workflows/build.yml) | -{% if AddCitation %}| Citation data consistency | [![cffconvert]({{repository_url}}/actions/workflows/cffconvert.yml/badge.svg)]({{repository_url}}/actions/workflows/cffconvert.yml) |{% endif %} +{% if AddCitation -%} +| Citation data consistency | [![cffconvert]({{repository_url}}/actions/workflows/cffconvert.yml/badge.svg)]({{repository_url}}/actions/workflows/cffconvert.yml) | +{%- endif -%} | SonarCloud | [![sonarcloud]({{repository_url}}/actions/workflows/sonarcloud.yml/badge.svg)]({{repository_url}}/actions/workflows/sonarcloud.yml) | | MarkDown link checker | [![markdown-link-check]({{repository_url}}/actions/workflows/markdown-link-check.yml/badge.svg)]({{repository_url}}/actions/workflows/markdown-link-check.yml) | diff --git a/template/project_setup.md.jinja b/template/project_setup.md.jinja index e0929bc8..f6541ece 100644 --- a/template/project_setup.md.jinja +++ b/template/project_setup.md.jinja @@ -90,13 +90,13 @@ help you decide which tool to use for packaging. - Document changes to your software package - [Relevant section in the guide](https://guide.esciencecenter.nl/#/best_practices/releases?id=changelogmd) -{% if AddCitation %} +{% if AddCitation -%} ## CITATION.cff - To allow others to cite your software, add a `CITATION.cff` file - It only makes sense to do this once there is something to cite (e.g., a software release with a DOI). - Follow the [making software citable](https://guide.esciencecenter.nl/#/citable_software/making_software_citable) section in the guide. -{% endif %} +{%- endif -%} ## CODE_OF_CONDUCT.md diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index b1e40781..58e52282 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -149,10 +149,10 @@ filename = "src/{{ package_name }}/__init__.py" [[tool.bumpversion.files]] filename = "pyproject.toml" -{% if AddCitation %} +{% if AddCitation -%} [[tool.bumpversion.files]] filename = "CITATION.cff" -{% endif %} +{%- endif %} [[tool.bumpversion.files]] filename = "docs/conf.py" From 9e213158f9abf7c69a6178902b9e66f92e33c4d5 Mon Sep 17 00:00:00 2001 From: sverhoeven Date: Wed, 21 Aug 2024 14:02:50 +0200 Subject: [PATCH 089/285] Add to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc22b61b..b3371556 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ ### Changed +* pre-commit script is optional ([#457](https://github.com/NLeSC/python-template/issues/457)) * Moved to src/ based layout for generated packages * Moved from setup.cfg/.py to pyproject.toml [#351](https://github.com/NLeSC/python-template/issues/351) * Moved from prospector to ruff [#336](https://github.com/NLeSC/python-template/issues/336) From 566fe843e249637cff6f49d293800fe32173343a Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 14:13:02 +0200 Subject: [PATCH 090/285] update the changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 694d7868..b2b399d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ### Added -* Added a question about citation file [#471](https://github.com/NLeSC/python-template/pull/471) +* Make citation optional [#471](https://github.com/NLeSC/python-template/pull/471) * Make online documentation optional [#476](https://github.com/NLeSC/python-template/pull/476) * Added Python 3.12 support [#356](https://github.com/NLeSC/python-template/issues/356) * Template unit tests for documentation generation, linting and version bumping From 63800fe377bb2a52ae8f6b58d8dd03a79546ffdd Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 14:35:23 +0200 Subject: [PATCH 091/285] update the citation link to make linter happy --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3127f093..344f45dc 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Use this [Copier](https://copier.readthedocs.io) template to generate an empty P - [Contributing guidelines](template/CONTRIBUTING.md.jinja), - Continuous code quality and code coverage reporting using [Sonarcloud](https://sonarcloud.io/), - Automatic creation of [issues](template/.github/next_steps) with instructions how to pass all GitHub action workflows and integrate with services like Zenodo and Read the Docs, -- Instructions how to make package [citable](template/.github/next_steps/02_citation.md.jinja) +- Instructions how to make package [citable](.github/next_steps/%7B%25%20if%20AddCitation%20%25%7D02_citation.md%7B%25%20endif%20%25%7D.jinja) - FAIR software recommendation badge, - Optional [pre commit hook](template/README.dev.md.jinja#running-linters-locally) to catch lint errors early From 080cbcff9f3e25c9c9676805a7dce181f0c71f8f Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 21 Aug 2024 14:57:04 +0200 Subject: [PATCH 092/285] Update profiles.md --- profiles.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/profiles.md b/profiles.md index 6bd0d72a..1a6b1f41 100644 --- a/profiles.md +++ b/profiles.md @@ -9,7 +9,7 @@ - pyproject.toml - README.md - .gitignore -- .editorconfig +- MANIFEST.in ## Questions @@ -26,4 +26,7 @@ - notice and manifest file - developer documentation - online documentation (read the docs) - +- .editorconfig +- project_setup.md +- keywords + From 5363423f2ed62fd5d6ea490717f4af42a2b4c014 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 21 Aug 2024 14:58:51 +0200 Subject: [PATCH 093/285] Update profiles.md --- profiles.md | 1 + 1 file changed, 1 insertion(+) diff --git a/profiles.md b/profiles.md index 1a6b1f41..055ffb57 100644 --- a/profiles.md +++ b/profiles.md @@ -10,6 +10,7 @@ - README.md - .gitignore - MANIFEST.in +- LICENCE ## Questions From ff3d9f601ef49b4f385e4b1c67c21df1d0700994 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 21 Aug 2024 15:08:26 +0200 Subject: [PATCH 094/285] Update profiles.md --- profiles.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/profiles.md b/profiles.md index 055ffb57..f43b53ff 100644 --- a/profiles.md +++ b/profiles.md @@ -12,6 +12,11 @@ - MANIFEST.in - LICENCE +## Questions to exclude from recommended +- Link checker +- pre-commit +- changelog.md +- project_setup.md ## Questions - licence (exist) @@ -21,10 +26,9 @@ - markdown link checker workflow - static analysis - next steps workflow -- changelog +- changelog.md - code of conduct - contributing guidelines -- notice and manifest file - developer documentation - online documentation (read the docs) - .editorconfig From 48bb4b0221ba1f6e36998e2acb0768d501a7cb80 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 21 Aug 2024 15:15:37 +0200 Subject: [PATCH 095/285] Update profiles.md --- profiles.md | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/profiles.md b/profiles.md index f43b53ff..5f95ddc1 100644 --- a/profiles.md +++ b/profiles.md @@ -20,18 +20,25 @@ ## Questions - licence (exist) -- github action (exist) #451 -- Pre-commit + - cffconvert workflow and citation file - markdown link checker workflow -- static analysis -- next steps workflow + - changelog.md -- code of conduct -- contributing guidelines -- developer documentation -- online documentation (read the docs) -- .editorconfig -- project_setup.md +- community: + - code of conduct + - contributing guidelines +- documentation + - developer documentation + - online documentation (read the docs) + - project_setup.md +- code quality: + - static analysis + - github action (exist) #451 + - pre-commit + - .editorconfig +- next steps workflow + + - keywords From 5cade9ae4804199134a1a6e2c35b8643987f4f2a Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 21 Aug 2024 15:30:43 +0200 Subject: [PATCH 096/285] Update profiles.md --- profiles.md | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/profiles.md b/profiles.md index 5f95ddc1..7b4115ed 100644 --- a/profiles.md +++ b/profiles.md @@ -20,25 +20,30 @@ ## Questions - licence (exist) - -- cffconvert workflow and citation file -- markdown link checker workflow - -- changelog.md + - community: - code of conduct - contributing guidelines + - documentation - developer documentation - online documentation (read the docs) - project_setup.md + - code quality: - - static analysis - - github action (exist) #451 + - sonarcloud + - ruff and lint workflow + - github action to build (exist) #451 - pre-commit - .editorconfig -- next steps workflow + +- publishing and release + - zenodo + - keywords + - changelog.md + - cffconvert workflow and citation file + +- markdown link checker workflow -- keywords From 60e9794e6268622cf7e1d5f4b2c802ac5d7a9316 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 21 Aug 2024 15:40:04 +0200 Subject: [PATCH 097/285] Update profiles.md --- profiles.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/profiles.md b/profiles.md index 7b4115ed..63f7d595 100644 --- a/profiles.md +++ b/profiles.md @@ -1,4 +1,16 @@ # Template Profiles +package_name: +version: +template_profile: + minumum --> DONE + recommeded --> all questions - excluded with the defaults + optional --> all questions with answers off + +github_organization: +full_name: +email: +copyright_holder: + ## Minimum From 3ed9c6fb7456b9388ab3acc552bdcb3f41a3fc7e Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 21 Aug 2024 15:46:10 +0200 Subject: [PATCH 098/285] Update profiles.md --- profiles.md | 63 ++++++++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 35 deletions(-) diff --git a/profiles.md b/profiles.md index 63f7d595..52a36cdd 100644 --- a/profiles.md +++ b/profiles.md @@ -1,40 +1,19 @@ # Template Profiles -package_name: -version: -template_profile: - minumum --> DONE - recommeded --> all questions - excluded with the defaults - optional --> all questions with answers off - -github_organization: -full_name: -email: -copyright_holder: - - - -## Minimum - -- src/ -- docs/ -- test/ -- pyproject.toml -- README.md -- .gitignore -- MANIFEST.in -- LICENCE - -## Questions to exclude from recommended -- Link checker -- pre-commit -- changelog.md -- project_setup.md - -## Questions +- package_name: +- version: +- template_profile: + - minumum --> DONE + - recommeded --> all questions - excluded with the defaults + - optional --> all questions with answers off + +- github_organization: +- full_name: +- email: +- copyright_holder: - licence (exist) - community: - - code of conduct + - code of conduct --> if TRUE ask for email - contributing guidelines - documentation @@ -51,11 +30,25 @@ copyright_holder: - publishing and release - zenodo - - keywords + - keywords - changelog.md - cffconvert workflow and citation file - markdown link checker workflow +## Minimum - +- src/ +- docs/ +- test/ +- pyproject.toml +- README.md +- .gitignore +- MANIFEST.in +- LICENCE + +## Questions to exclude from recommended +- Link checker +- pre-commit +- changelog.md +- project_setup.md From 16ca317c00386223c7d18959b261e7b80dd1a1a8 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 16:45:37 +0200 Subject: [PATCH 099/285] next_steps_citation workflow cleans up the artifacts --- .../{% if AddCitation %}next_steps_citation.yml{% endif %} | 4 ++-- ...dCitation %}next_steps_citation_issue.md{% endif %}.jinja} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename template/.github/{next_steps/{% if AddCitation %}02_citation.md{% endif %}.jinja => workflows/{% if AddCitation %}next_steps_citation_issue.md{% endif %}.jinja} (100%) diff --git a/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} b/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} index 48269288..17c28abe 100644 --- a/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} +++ b/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} @@ -13,7 +13,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - filename: .github/next_steps/02_citation.md + filename: .github/workflows/next_steps_citation_issue.md id: citation - name: List created issues run: | @@ -24,6 +24,6 @@ jobs: git config --global user.name 'NLeSC Python template' git config --global user.email 'nlesc-python-template@users.noreply.github.com' git rm .github/workflows/next_steps_citation.yml - git rm -r .github/next_steps + git rm .github/workflows/next_steps_citation_issue.md git commit -am "Cleanup automated next steps issue generator" git push diff --git a/template/.github/next_steps/{% if AddCitation %}02_citation.md{% endif %}.jinja b/template/.github/workflows/{% if AddCitation %}next_steps_citation_issue.md{% endif %}.jinja similarity index 100% rename from template/.github/next_steps/{% if AddCitation %}02_citation.md{% endif %}.jinja rename to template/.github/workflows/{% if AddCitation %}next_steps_citation_issue.md{% endif %}.jinja From f79b6615c1a2916897933c1f34c48d66afb5ef16 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 16:45:57 +0200 Subject: [PATCH 100/285] next_steps_citation workflow cleans up the artifacts --- .../{% if AddCitation %}next_steps_citation.yml{% endif %} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} b/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} index 17c28abe..28f369b5 100644 --- a/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} +++ b/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} @@ -25,5 +25,5 @@ jobs: git config --global user.email 'nlesc-python-template@users.noreply.github.com' git rm .github/workflows/next_steps_citation.yml git rm .github/workflows/next_steps_citation_issue.md - git commit -am "Cleanup automated next steps issue generator" + git commit -am "Cleanup automated next steps issue generator for citation" git push From 8064e90107dd6a5aaccbc34b52db31bb83ecbdb7 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 16:51:02 +0200 Subject: [PATCH 101/285] next_steps_online_documentation workflow cleans up the artifacts --- ...ation %}next_steps_online_documentation.yml{% endif %} | 8 ++++---- ..._steps_online_documentation_issue.md{% endif %}.jinja} | 0 2 files changed, 4 insertions(+), 4 deletions(-) rename template/.github/{next_steps/{% if AddOnlineDocumentation %}03_readthedocs.md{% endif %}.jinja => workflows/{% if AddOnlineDocumentation %}next_steps_online_documentation_issue.md{% endif %}.jinja} (100%) diff --git a/template/.github/workflows/{% if AddOnlineDocumentation %}next_steps_online_documentation.yml{% endif %} b/template/.github/workflows/{% if AddOnlineDocumentation %}next_steps_online_documentation.yml{% endif %} index 1bc71b38..8aa9452a 100644 --- a/template/.github/workflows/{% if AddOnlineDocumentation %}next_steps_online_documentation.yml{% endif %} +++ b/template/.github/workflows/{% if AddOnlineDocumentation %}next_steps_online_documentation.yml{% endif %} @@ -8,12 +8,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Create readthedocs issue + - name: Create online documentation issue uses: JasonEtco/create-an-issue@v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - filename: .github/next_steps/03_readthedocs.md + filename: .github/workflows/next_steps_online_documentation_issue.md id: readthedocs - name: List created issues run: | @@ -24,6 +24,6 @@ jobs: git config --global user.name 'NLeSC Python template' git config --global user.email 'nlesc-python-template@users.noreply.github.com' git rm .github/workflows/next_steps_online_documentation.yml - git rm -r .github/next_steps - git commit -am "Cleanup automated next steps issue generator" + git rm .github/workflows/next_steps_online_documentation_issue.md + git commit -am "Cleanup automated next steps issue generator for online documentation" git push diff --git a/template/.github/next_steps/{% if AddOnlineDocumentation %}03_readthedocs.md{% endif %}.jinja b/template/.github/workflows/{% if AddOnlineDocumentation %}next_steps_online_documentation_issue.md{% endif %}.jinja similarity index 100% rename from template/.github/next_steps/{% if AddOnlineDocumentation %}03_readthedocs.md{% endif %}.jinja rename to template/.github/workflows/{% if AddOnlineDocumentation %}next_steps_online_documentation_issue.md{% endif %}.jinja From a0d7b16b6e7398606a9f6785f7c15ddc9639becb Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 16:53:50 +0200 Subject: [PATCH 102/285] remove the duplicate line in README.dev.md.jinja --- template/README.dev.md.jinja | 1 - 1 file changed, 1 deletion(-) diff --git a/template/README.dev.md.jinja b/template/README.dev.md.jinja index b53107c1..cc00e400 100644 --- a/template/README.dev.md.jinja +++ b/template/README.dev.md.jinja @@ -135,7 +135,6 @@ This section describes how to make a release in 3 parts: {% if AddChangeLog -%}1. Update the (don't forget to update links at bottom of page).{%- endif %} {% if AddCitation -%}1. Verify that the information in [`CITATION.cff`](CITATION.cff) is correct.{%- endif %} -1. Verify that the information in [`CITATION.cff`](CITATION.cff) is correct. 1. Make sure the [version has been updated](#versioning). 1. Run the unit tests with `pytest -v` From 1b9021a70a366bc1ff1e1f712f8d5b9b9a624bde Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 17:33:35 +0200 Subject: [PATCH 103/285] add solarcloud question --- copier.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/copier.yml b/copier.yml index 04222e9b..5b1d9e72 100644 --- a/copier.yml +++ b/copier.yml @@ -107,6 +107,12 @@ AddPreCommit: default: "{{ template_profile != 'minimum' }}" help: Add pre-commit hook to check code style and format on every commit? +AddSonarCloud: + when: "{{ template_profile == 'ask' }}" + type: bool + default: "{{ template_profile != 'minimum' }}" + help: Add SonarCloud (code analysis service) integration? + # internal fields _subdirectory: template From 8f34e71c2d0f9b63ef67fce08357e487ab21316b Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 17:35:27 +0200 Subject: [PATCH 104/285] add a separate workflow for sonarcloud next steps --- template/.github/workflows/next_steps.yml | 8 ----- ...oud %}next_steps_sonarcloud.yml{% endif %} | 29 +++++++++++++++++++ ...teps_sonarcloud_issue.md{% endif %}.jinja} | 0 3 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 template/.github/workflows/{% if AddSonarCloud %}next_steps_sonarcloud.yml{% endif %} rename template/.github/{next_steps/01_sonarcloud_integration.md.jinja => workflows/{% if AddSonarCloud %}next_steps_sonarcloud_issue.md{% endif %}.jinja} (100%) diff --git a/template/.github/workflows/next_steps.yml b/template/.github/workflows/next_steps.yml index dc8ba159..4b0c1d22 100644 --- a/template/.github/workflows/next_steps.yml +++ b/template/.github/workflows/next_steps.yml @@ -8,13 +8,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Create Sonarcloud integration issue - uses: JasonEtco/create-an-issue@v2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - filename: .github/next_steps/01_sonarcloud_integration.md - id: sonarcloud - name: Create Zenodo integration issue uses: JasonEtco/create-an-issue@v2 env: @@ -32,7 +25,6 @@ jobs: - name: List created issues run: | echo 'Created issues that must be completed to have fully working Python package: - * Sonarcloud integration ${{ steps.sonarcloud.outputs.url }} * Zenodo integration ${{ steps.zenodo.outputs.url }} * Linting fixes ${{ steps.linting.outputs.url }}' - name: Cleanup files needed to create next steps issues diff --git a/template/.github/workflows/{% if AddSonarCloud %}next_steps_sonarcloud.yml{% endif %} b/template/.github/workflows/{% if AddSonarCloud %}next_steps_sonarcloud.yml{% endif %} new file mode 100644 index 00000000..0a0c676a --- /dev/null +++ b/template/.github/workflows/{% if AddSonarCloud %}next_steps_sonarcloud.yml{% endif %} @@ -0,0 +1,29 @@ +on: [push] +permissions: + contents: write + issues: write +name: Create an issue for Sonarcloud +jobs: + next_steps: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Create Sonarcloud issue + uses: JasonEtco/create-an-issue@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + filename: .github/workflows/next_steps_sonarcloud_issue.md + id: sonarcloud + - name: List created issues + run: | + echo 'Created issues that must be completed to have fully working Python package: + * Sonarcloud integration ${{ steps.sonarcloud.outputs.url }}' + - name: Cleanup files needed to create next steps issues + run: | + git config --global user.name 'NLeSC Python template' + git config --global user.email 'nlesc-python-template@users.noreply.github.com' + git rm .github/workflows/next_steps_sonarcloud.yml + git rm .github/workflows/next_steps_sonarcloud_issue.md + git commit -am "Cleanup automated next steps issue generator for sonarcloud" + git push diff --git a/template/.github/next_steps/01_sonarcloud_integration.md.jinja b/template/.github/workflows/{% if AddSonarCloud %}next_steps_sonarcloud_issue.md{% endif %}.jinja similarity index 100% rename from template/.github/next_steps/01_sonarcloud_integration.md.jinja rename to template/.github/workflows/{% if AddSonarCloud %}next_steps_sonarcloud_issue.md{% endif %}.jinja From 3fab344336db253148efa530ca01c3bcf1a194ca Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 17:36:40 +0200 Subject: [PATCH 105/285] update sonarcloud workflow to fix secrets field --- template/.github/workflows/sonarcloud.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/template/.github/workflows/sonarcloud.yml b/template/.github/workflows/sonarcloud.yml index 1c7ec8b3..e8ca8152 100644 --- a/template/.github/workflows/sonarcloud.yml +++ b/template/.github/workflows/sonarcloud.yml @@ -36,5 +36,5 @@ jobs: - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master env: - GITHUB_TOKEN: ${{ '{{' -}} secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ '{{' -}} secrets.SONAR_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From 59f14b5dc2db4d4ce5ae21640ca73c5fc64c9caa Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 17:38:42 +0200 Subject: [PATCH 106/285] create sonarcloud workflow conditionally --- ...rcloud.yml => {% if AddSonarCloud %}sonarcloud.yml{% endif %}} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename template/.github/workflows/{sonarcloud.yml => {% if AddSonarCloud %}sonarcloud.yml{% endif %}} (100%) diff --git a/template/.github/workflows/sonarcloud.yml b/template/.github/workflows/{% if AddSonarCloud %}sonarcloud.yml{% endif %} similarity index 100% rename from template/.github/workflows/sonarcloud.yml rename to template/.github/workflows/{% if AddSonarCloud %}sonarcloud.yml{% endif %} From fd8adf3950d2bb053ef1b863f90555ff0ca7b943 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 17:39:47 +0200 Subject: [PATCH 107/285] create sonarcloud configuration conditionally --- ... if AddSonarCloud %}sonar-project.properties.jinja{% endif %}} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename template/{sonar-project.properties.jinja => {% if AddSonarCloud %}sonar-project.properties.jinja{% endif %}} (100%) diff --git a/template/sonar-project.properties.jinja b/template/{% if AddSonarCloud %}sonar-project.properties.jinja{% endif %} similarity index 100% rename from template/sonar-project.properties.jinja rename to template/{% if AddSonarCloud %}sonar-project.properties.jinja{% endif %} From 7ee2fc65a50edef8aeb39f0dd6f3f4fd9f9225db Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 17:42:27 +0200 Subject: [PATCH 108/285] update the changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index da19350b..cc68ae25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Added +* Make SonarCloud optional [#515](https://github.com/NLeSC/python-template/pull/515) * Make citation optional [#471](https://github.com/NLeSC/python-template/pull/471) * Make online documentation optional [#476](https://github.com/NLeSC/python-template/pull/476) * Added Python 3.12 support [#356](https://github.com/NLeSC/python-template/issues/356) From c8ac5eac4b40e384ce2e40b9987b73601a4ad6aa Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 17:54:00 +0200 Subject: [PATCH 109/285] render sonarcloud-related text conditionally --- profiles.md | 2 +- template/README.md.jinja | 4 ++++ template/project_setup.md.jinja | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/profiles.md b/profiles.md index 1544f7d3..44be9878 100644 --- a/profiles.md +++ b/profiles.md @@ -22,7 +22,7 @@ - project_setup.md - code quality: - - sonarcloud + - sonarcloud #515 - ruff and lint workflow - github action to build (exist) #451 - pre-commit diff --git a/template/README.md.jinja b/template/README.md.jinja index d8792190..6a791fa0 100644 --- a/template/README.md.jinja +++ b/template/README.md.jinja @@ -11,8 +11,10 @@ | (5/5) checklist | [![workflow cii badge](https://bestpractices.coreinfrastructure.org/projects//badge)](https://bestpractices.coreinfrastructure.org/projects/) | | howfairis | [![fair-software badge](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8B-yellow)](https://fair-software.eu) | | **Other best practices** |   | +{% if AddSonarCloud -%} | Static analysis | [![workflow scq badge](https://sonarcloud.io/api/project_badges/measure?project={{github_organization}}_{{package_name}}&metric=alert_status)](https://sonarcloud.io/dashboard?id={{github_organization}}_{{package_name}}) | | Coverage | [![workflow scc badge](https://sonarcloud.io/api/project_badges/measure?project={{github_organization}}_{{package_name}}&metric=coverage)](https://sonarcloud.io/dashboard?id={{github_organization}}_{{package_name}}) | +{%- endif -%} {% if AddOnlineDocumentation -%} | Documentation | [![Documentation Status](https://readthedocs.org/projects/{{package_name}}/badge/?version=latest)](https://{{package_name}}.readthedocs.io/en/latest/?badge=latest) | {%- endif -%} @@ -21,7 +23,9 @@ {% if AddCitation -%} | Citation data consistency | [![cffconvert]({{repository_url}}/actions/workflows/cffconvert.yml/badge.svg)]({{repository_url}}/actions/workflows/cffconvert.yml) | {%- endif -%} +{% if AddSonarCloud -%} | SonarCloud | [![sonarcloud]({{repository_url}}/actions/workflows/sonarcloud.yml/badge.svg)]({{repository_url}}/actions/workflows/sonarcloud.yml) | +{%- endif -%} | MarkDown link checker | [![markdown-link-check]({{repository_url}}/actions/workflows/markdown-link-check.yml/badge.svg)]({{repository_url}}/actions/workflows/markdown-link-check.yml) | ## How to use {{ package_name }} diff --git a/template/project_setup.md.jinja b/template/project_setup.md.jinja index ba015fc9..72e4be95 100644 --- a/template/project_setup.md.jinja +++ b/template/project_setup.md.jinja @@ -66,12 +66,14 @@ help you decide which tool to use for packaging. - [Relevant section in the NLeSC guide](https://guide.esciencecenter.nl/#/best_practices/language_guides/python?id=coding-style-conventions) and [README.dev.md](README.dev.md). +{% if AddSonarCloud -%} ## Continuous code quality [Sonarcloud](https://sonarcloud.io/) is used to perform quality analysis and code coverage report - `sonar-project.properties` is the SonarCloud [configuration](https://docs.sonarqube.org/latest/analysis/analysis-parameters/) file - `.github/workflows/sonarcloud.yml` is the GitHub action workflow which performs the SonarCloud analysis +{%- endif -%} ## Package version number From 1bddfa32b4fbe915d907813979e53da729267e9a Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 21 Aug 2024 18:05:06 +0200 Subject: [PATCH 110/285] Make zenodo optional --- copier.yml | 6 ++++++ ...Citation %}02_citation.md{% endif %}.jinja | 6 ++++-- ...04_zenodo_integration.md{% endif %}.jinja} | 0 template/.github/workflows/next_steps.yml | 8 -------- ...dZenodo %}next_steps_zenodo.yml{% endif %} | 20 +++++++++++++++++++ template/CONTRIBUTING.md.jinja | 2 ++ template/README.dev.md.jinja | 6 +++++- template/README.md.jinja | 2 ++ 8 files changed, 39 insertions(+), 11 deletions(-) rename template/.github/next_steps/{04_zenodo_integration.md.jinja => {% if AddZenodo %}04_zenodo_integration.md{% endif %}.jinja} (100%) create mode 100644 template/.github/workflows/{% if AddZenodo %}next_steps_zenodo.yml{% endif %} diff --git a/copier.yml b/copier.yml index 04222e9b..24ba3e0b 100644 --- a/copier.yml +++ b/copier.yml @@ -107,6 +107,12 @@ AddPreCommit: default: "{{ template_profile != 'minimum' }}" help: Add pre-commit hook to check code style and format on every commit? +AddZenodo: + when: "{{ template_profile == 'ask' }}" + type: bool + default: "{{ template_profile != 'minimum' }}" + help: Add zenodo integration? + # internal fields _subdirectory: template diff --git a/template/.github/next_steps/{% if AddCitation %}02_citation.md{% endif %}.jinja b/template/.github/next_steps/{% if AddCitation %}02_citation.md{% endif %}.jinja index 90ffd88f..b725b437 100644 --- a/template/.github/next_steps/{% if AddCitation %}02_citation.md{% endif %}.jinja +++ b/template/.github/next_steps/{% if AddCitation %}02_citation.md{% endif %}.jinja @@ -8,13 +8,15 @@ It is likely that your `CITATION.cff` currently doesn't pass validation. The err - [ ] Update the value of the `orcid` key. If you do not have an orcid yet, you can get one here [https://orcid.org/](https://orcid.org/). - [ ] Add more authors if needed - [ ] Update `date-released` using the YYYY-MM-DD format. + +{% if AddZenodo -%} - [ ] Update the `doi` key with the conceptDOI for your repository (see [https://help.zenodo.org](https://help.zenodo.org/) for more information on what a conceptDOI is). If your project doesn't have a DOI yet, you can use the string `10.0000/FIXME` to pass validation. +{%- endif -%} - [ ] Verify that the `keywords` array accurately describes your project. Afterwards, the `cffconvert` GitHub Action should be green. -To make sure services like [Zenodo](https://zenodo.org) and the [Research Software Directory](https://research-software-directory.org/) can keep your citation data up to date, the [`cffconvert`]({{repository_url}}/actions/workflows/cffconvert.yml) GitHub Action checks the following: - +To make sure services like {% if AddZenodo -%} [Zenodo](https://zenodo.org) and {%- endif -%} the [Research Software Directory](https://research-software-directory.org/) can keep your citation data up to date, the [`cffconvert`]({{repository_url}}/actions/workflows/cffconvert.yml) GitHub Action checks the following: 1. Whether your repository includes a `CITATION.cff` file. _By including this file, authors of the software can receive credit for the work they put in._ diff --git a/template/.github/next_steps/04_zenodo_integration.md.jinja b/template/.github/next_steps/{% if AddZenodo %}04_zenodo_integration.md{% endif %}.jinja similarity index 100% rename from template/.github/next_steps/04_zenodo_integration.md.jinja rename to template/.github/next_steps/{% if AddZenodo %}04_zenodo_integration.md{% endif %}.jinja diff --git a/template/.github/workflows/next_steps.yml b/template/.github/workflows/next_steps.yml index dc8ba159..a6af8a42 100644 --- a/template/.github/workflows/next_steps.yml +++ b/template/.github/workflows/next_steps.yml @@ -15,13 +15,6 @@ jobs: with: filename: .github/next_steps/01_sonarcloud_integration.md id: sonarcloud - - name: Create Zenodo integration issue - uses: JasonEtco/create-an-issue@v2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - filename: .github/next_steps/04_zenodo_integration.md - id: zenodo - name: Create linting issue uses: JasonEtco/create-an-issue@v2 env: @@ -33,7 +26,6 @@ jobs: run: | echo 'Created issues that must be completed to have fully working Python package: * Sonarcloud integration ${{ steps.sonarcloud.outputs.url }} - * Zenodo integration ${{ steps.zenodo.outputs.url }} * Linting fixes ${{ steps.linting.outputs.url }}' - name: Cleanup files needed to create next steps issues run: | diff --git a/template/.github/workflows/{% if AddZenodo %}next_steps_zenodo.yml{% endif %} b/template/.github/workflows/{% if AddZenodo %}next_steps_zenodo.yml{% endif %} new file mode 100644 index 00000000..9f37cf97 --- /dev/null +++ b/template/.github/workflows/{% if AddZenodo %}next_steps_zenodo.yml{% endif %} @@ -0,0 +1,20 @@ +on: [push] +permissions: + contents: write + issues: write +name: Create an issue for Zenodo +jobs: + next_steps: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Create Zenodo integration issue + uses: JasonEtco/create-an-issue@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + filename: .github/next_steps/04_zenodo_integration.md + id: zenodo + - name: List created issues + run: | + echo 'Created issues that must be completed to have fully working Python package: diff --git a/template/CONTRIBUTING.md.jinja b/template/CONTRIBUTING.md.jinja index cc1a1787..51a953b8 100644 --- a/template/CONTRIBUTING.md.jinja +++ b/template/CONTRIBUTING.md.jinja @@ -69,4 +69,6 @@ For projects that also build conda packages, e.g. on conda-forge or Bioconda, so 1. Test {{ package_name }} from bioconda by manually running [Conda verify]({{ repository_url }}/actions/workflows/conda_verify.yml) workflow --> +{% if AddZenodo -%} Also a Zenodo entry will be made for the release with its own DOI. +{%- endif %} diff --git a/template/README.dev.md.jinja b/template/README.dev.md.jinja index f192b3a4..11bd3b04 100644 --- a/template/README.dev.md.jinja +++ b/template/README.dev.md.jinja @@ -195,4 +195,8 @@ python -m twine upload dist/* ### (3/3) GitHub -Don't forget to also make a [release on GitHub]({{repository_url}}/releases/new). If your repository uses the GitHub-Zenodo integration this will also trigger Zenodo into making a snapshot of your repository and sticking a DOI on it. +Don't forget to also make a [release on GitHub]({{repository_url}}/releases/new). + +{%- if AddZenodod -%} +GitHub-Zenodo integration will also trigger Zenodo into making a snapshot of your repository and sticking a DOI on it. +{%- endif -%} diff --git a/template/README.md.jinja b/template/README.md.jinja index d8792190..10b64b44 100644 --- a/template/README.md.jinja +++ b/template/README.md.jinja @@ -7,7 +7,9 @@ | (1/5) code repository | [![github repo badge](https://img.shields.io/badge/github-repo-000.svg?logo=github&labelColor=gray&color=blue)]({{repository_url}}) | | (2/5) license | [![github license badge](https://img.shields.io/github/license/{{github_organization}}/{{package_name}})]({{repository_url}}) | | (3/5) community registry | [![RSD](https://img.shields.io/badge/rsd-{{package_name}}-00a3e3.svg)](https://www.research-software.nl/software/{{package_name}}) [![workflow pypi badge](https://img.shields.io/pypi/v/{{package_name}}.svg?colorB=blue)](https://pypi.python.org/project/{{package_name}}/) | +{% if AddOnlineDocumentation -%} | (4/5) citation | [![DOI](https://zenodo.org/badge/DOI/.svg)](https://doi.org/) | +{%- endif -%} | (5/5) checklist | [![workflow cii badge](https://bestpractices.coreinfrastructure.org/projects//badge)](https://bestpractices.coreinfrastructure.org/projects/) | | howfairis | [![fair-software badge](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8B-yellow)](https://fair-software.eu) | | **Other best practices** |   | From 763da56b18f48fa8aa4ffabf828a321b03d2432d Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 21 Aug 2024 18:11:32 +0200 Subject: [PATCH 111/285] Add changelog and profiles --- CHANGELOG.md | 2 +- profiles.md | 2 +- template/README.md.jinja | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da19350b..3283fc7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## Unreleased ### Added - +* Make zenodo integration optional [#520](https://github.com/NLeSC/python-template/pull/520) * Make citation optional [#471](https://github.com/NLeSC/python-template/pull/471) * Make online documentation optional [#476](https://github.com/NLeSC/python-template/pull/476) * Added Python 3.12 support [#356](https://github.com/NLeSC/python-template/issues/356) diff --git a/profiles.md b/profiles.md index 1544f7d3..c0a287a0 100644 --- a/profiles.md +++ b/profiles.md @@ -29,7 +29,7 @@ - .editorconfig - publishing and release - - zenodo + - zenodo #469 - keywords - changelog.md - cffconvert workflow and citation file diff --git a/template/README.md.jinja b/template/README.md.jinja index 10b64b44..64e4acc3 100644 --- a/template/README.md.jinja +++ b/template/README.md.jinja @@ -7,7 +7,7 @@ | (1/5) code repository | [![github repo badge](https://img.shields.io/badge/github-repo-000.svg?logo=github&labelColor=gray&color=blue)]({{repository_url}}) | | (2/5) license | [![github license badge](https://img.shields.io/github/license/{{github_organization}}/{{package_name}})]({{repository_url}}) | | (3/5) community registry | [![RSD](https://img.shields.io/badge/rsd-{{package_name}}-00a3e3.svg)](https://www.research-software.nl/software/{{package_name}}) [![workflow pypi badge](https://img.shields.io/pypi/v/{{package_name}}.svg?colorB=blue)](https://pypi.python.org/project/{{package_name}}/) | -{% if AddOnlineDocumentation -%} +{% if AddZenodo -%} | (4/5) citation | [![DOI](https://zenodo.org/badge/DOI/.svg)](https://doi.org/) | {%- endif -%} | (5/5) checklist | [![workflow cii badge](https://bestpractices.coreinfrastructure.org/projects//badge)](https://bestpractices.coreinfrastructure.org/projects/) | From 1a6c0017356750b7bed90c9572c03ad95b83790d Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 20:31:12 +0200 Subject: [PATCH 112/285] update the github organization question --- copier.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/copier.yml b/copier.yml index 04222e9b..22570db5 100644 --- a/copier.yml +++ b/copier.yml @@ -22,7 +22,8 @@ version: default: 0.1.0 github_organization: type: str - default: "" + placeholder: "" + help: Enter the name of your GitHub username or organization full_name: type: str default: Jane Smith From 1b9694ddcffdad5e2725cf35df4e6967ba0e8e5a Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 21 Aug 2024 20:41:02 +0200 Subject: [PATCH 113/285] remove the placeholder from github organization question --- copier.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier.yml b/copier.yml index 22570db5..6264672e 100644 --- a/copier.yml +++ b/copier.yml @@ -22,7 +22,7 @@ version: default: 0.1.0 github_organization: type: str - placeholder: "" + default: "" help: Enter the name of your GitHub username or organization full_name: type: str From 64d5aa69cbc4319abb4255f95737e40aacef48a6 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Thu, 22 Aug 2024 10:19:09 +0200 Subject: [PATCH 114/285] Rename and move next_steps_zenodo_issue --- ...% if AddZenodo %}next_steps_zenodo.yml{% endif %} | 12 +++++++++++- ...do %}next_steps_zenodo_issue.md{% endif %}.jinja} | 0 2 files changed, 11 insertions(+), 1 deletion(-) rename template/.github/{next_steps/{% if AddZenodo %}04_zenodo_integration.md{% endif %}.jinja => workflows/{% if AddZenodo %}next_steps_zenodo_issue.md{% endif %}.jinja} (100%) diff --git a/template/.github/workflows/{% if AddZenodo %}next_steps_zenodo.yml{% endif %} b/template/.github/workflows/{% if AddZenodo %}next_steps_zenodo.yml{% endif %} index 9f37cf97..e290da57 100644 --- a/template/.github/workflows/{% if AddZenodo %}next_steps_zenodo.yml{% endif %} +++ b/template/.github/workflows/{% if AddZenodo %}next_steps_zenodo.yml{% endif %} @@ -13,8 +13,18 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - filename: .github/next_steps/04_zenodo_integration.md + filename: .github/workflows/next_steps_zenodo_issue.md id: zenodo - name: List created issues run: | echo 'Created issues that must be completed to have fully working Python package: + * Sonarcloud integration ${{ steps.sonarcloud.outputs.url }} + - name: Cleanup files needed to create next steps issues + run: | + git config --global user.name 'NLeSC Python template' + git config --global user.email 'nlesc-python-template@users.noreply.github.com' + git rm .github/workflows/next_steps_zenodo.yml + git rm .github/workflows/next_steps_zenodo_issue.md + git commit -am "Cleanup automated next steps issue generator for zenodo" + git push + diff --git a/template/.github/next_steps/{% if AddZenodo %}04_zenodo_integration.md{% endif %}.jinja b/template/.github/workflows/{% if AddZenodo %}next_steps_zenodo_issue.md{% endif %}.jinja similarity index 100% rename from template/.github/next_steps/{% if AddZenodo %}04_zenodo_integration.md{% endif %}.jinja rename to template/.github/workflows/{% if AddZenodo %}next_steps_zenodo_issue.md{% endif %}.jinja From fb934b2b0bac6b3432403af543bd54020a9b2e8c Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Thu, 22 Aug 2024 10:40:16 +0200 Subject: [PATCH 115/285] Change zenodo question --- copier.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier.yml b/copier.yml index 24ba3e0b..ee17c2ac 100644 --- a/copier.yml +++ b/copier.yml @@ -111,7 +111,7 @@ AddZenodo: when: "{{ template_profile == 'ask' }}" type: bool default: "{{ template_profile != 'minimum' }}" - help: Add zenodo integration? + help: Add instructions about zenodo integration? # internal fields _subdirectory: template From 8691371907a5aa5bd92fbc3e1f06c3ae531ccc78 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 10:44:52 +0200 Subject: [PATCH 116/285] use placeholder instead of default values --- copier.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/copier.yml b/copier.yml index 04222e9b..1295c229 100644 --- a/copier.yml +++ b/copier.yml @@ -2,7 +2,7 @@ package_name: type: str - default: my_python_package + placeholder: my_python_package help: Enter the name of the Python package. validator: >- {% if not (package_name | regex_search('^[a-z][a-z0-9\_]+$')) %} @@ -10,32 +10,32 @@ package_name: {% endif %} package_short_description: type: str - default: Short description of package + placeholder: Short description of package keyword1: type: str - default: keyword1 + placeholder: keyword1 keyword2: type: str - default: keyword2 + placeholder: keyword2 version: type: str - default: 0.1.0 + placeholder: 0.1.0 github_organization: type: str - default: "" + placeholder: "" full_name: type: str - default: Jane Smith + placeholder: Jane Smith help: Enter your full name. email: type: str - default: yourname@esciencecenter.nl + placeholder: yourname@esciencecenter.nl copyright_holder: type: str - default: Netherlands eScience Center + placeholder: Netherlands eScience Center code_of_conduct_email: type: str - default: "{{ email }}" + placeholder: "{{ email }}" # calculated fields repository: From 65761d9a34bf91193598d0b0e448b924c05a582a Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 10:45:58 +0200 Subject: [PATCH 117/285] update package_name validator message --- copier.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier.yml b/copier.yml index 1295c229..385ebda2 100644 --- a/copier.yml +++ b/copier.yml @@ -6,7 +6,7 @@ package_name: help: Enter the name of the Python package. validator: >- {% if not (package_name | regex_search('^[a-z][a-z0-9\_]+$')) %} - package_name must start with a letter, followed one or more letters, digits or underscores all lowercase. + Package name must start with a letter, followed one or more letters, digits or underscores all lowercase {% endif %} package_short_description: type: str From 1dc991bcdd8024b7a3c00ffb18220c1904ebff6c Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 10:48:51 +0200 Subject: [PATCH 118/285] add help text to version question and update question order --- copier.yml | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/copier.yml b/copier.yml index 385ebda2..4fa01aa7 100644 --- a/copier.yml +++ b/copier.yml @@ -8,6 +8,20 @@ package_name: {% if not (package_name | regex_search('^[a-z][a-z0-9\_]+$')) %} Package name must start with a letter, followed one or more letters, digits or underscores all lowercase {% endif %} +version: + type: str + placeholder: 0.1.0 + help: Enter the version of the Python package +template_profile: + type: str + default: recommended + help: Optional questions (You can use our defaults, or the bare minimum, or decide everything) + choices: + Recommended (our defaults for research software): "recommended" + Minimum (no extra features): "minimum" + Let me choose (decide each feature yourself): "ask" + + package_short_description: type: str placeholder: Short description of package @@ -17,9 +31,6 @@ keyword1: keyword2: type: str placeholder: keyword2 -version: - type: str - placeholder: 0.1.0 github_organization: type: str placeholder: "" @@ -37,6 +48,7 @@ code_of_conduct_email: type: str placeholder: "{{ email }}" + # calculated fields repository: default: git@github.com:{{ github_organization }}/{{ package_name }} @@ -47,15 +59,6 @@ repository_url: when: false -# profile selection -template_profile: - type: str - default: recommended - help: Optional questions (You can use our defaults, or the bare minimum, or decide everything) - choices: - Recommended (our defaults for research software): "recommended" - Minimum (no extra features): "minimum" - Let me choose (decide each feature yourself): "ask" # extra questions From 136c07b7357f68b2ac2504ec45cefff94a7fcccb Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 10:49:36 +0200 Subject: [PATCH 119/285] set ask option as default --- copier.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier.yml b/copier.yml index 4fa01aa7..af7c1ca0 100644 --- a/copier.yml +++ b/copier.yml @@ -14,7 +14,7 @@ version: help: Enter the version of the Python package template_profile: type: str - default: recommended + default: ask help: Optional questions (You can use our defaults, or the bare minimum, or decide everything) choices: Recommended (our defaults for research software): "recommended" From d04dcbdcb4ed38d66879ff736f99a70d5fd7e2f3 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 10:53:39 +0200 Subject: [PATCH 120/285] do not ask package details for minimum profile --- copier.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/copier.yml b/copier.yml index af7c1ca0..7da6aed0 100644 --- a/copier.yml +++ b/copier.yml @@ -21,32 +21,38 @@ template_profile: Minimum (no extra features): "minimum" Let me choose (decide each feature yourself): "ask" - package_short_description: type: str placeholder: Short description of package + when: "{{ template_profile != 'minimum' }}" keyword1: type: str placeholder: keyword1 + when: "{{ template_profile != 'minimum' }}" keyword2: type: str placeholder: keyword2 + when: "{{ template_profile != 'minimum' }}" github_organization: type: str placeholder: "" + when: "{{ template_profile != 'minimum' }}" full_name: type: str placeholder: Jane Smith help: Enter your full name. + when: "{{ template_profile != 'minimum' }}" email: type: str placeholder: yourname@esciencecenter.nl + when: "{{ template_profile != 'minimum' }}" copyright_holder: type: str placeholder: Netherlands eScience Center code_of_conduct_email: type: str placeholder: "{{ email }}" + when: "{{ template_profile != 'minimum' }}" # calculated fields From b649b5f16b5460723801ebea2ebae1cba9b03263 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 10:57:40 +0200 Subject: [PATCH 121/285] update organization question helper --- copier.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/copier.yml b/copier.yml index 7da6aed0..bafbb143 100644 --- a/copier.yml +++ b/copier.yml @@ -1,3 +1,4 @@ +--- # Essential questions package_name: @@ -12,6 +13,8 @@ version: type: str placeholder: 0.1.0 help: Enter the version of the Python package + +# profile selection template_profile: type: str default: ask @@ -21,6 +24,7 @@ template_profile: Minimum (no extra features): "minimum" Let me choose (decide each feature yourself): "ask" +# package details package_short_description: type: str placeholder: Short description of package @@ -36,11 +40,12 @@ keyword2: github_organization: type: str placeholder: "" + help: Enter the name of your GitHub username or organization when: "{{ template_profile != 'minimum' }}" full_name: type: str placeholder: Jane Smith - help: Enter your full name. + help: Enter your full name when: "{{ template_profile != 'minimum' }}" email: type: str @@ -54,8 +59,7 @@ code_of_conduct_email: placeholder: "{{ email }}" when: "{{ template_profile != 'minimum' }}" - -# calculated fields +# calculated fields for GitHub repository: default: git@github.com:{{ github_organization }}/{{ package_name }} when: false From 5992506f2c19d023cdf0642f967c10394c9ba943 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 10:58:14 +0200 Subject: [PATCH 122/285] order questions --- copier.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/copier.yml b/copier.yml index bafbb143..0b8d4802 100644 --- a/copier.yml +++ b/copier.yml @@ -51,13 +51,13 @@ email: type: str placeholder: yourname@esciencecenter.nl when: "{{ template_profile != 'minimum' }}" -copyright_holder: - type: str - placeholder: Netherlands eScience Center code_of_conduct_email: type: str placeholder: "{{ email }}" when: "{{ template_profile != 'minimum' }}" +copyright_holder: + type: str + placeholder: Netherlands eScience Center # calculated fields for GitHub repository: From 42ec98fe6c1f02b45c2339c56071c102b643a70d Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 10:58:56 +0200 Subject: [PATCH 123/285] change the default license to Apache 2.0 --- copier.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier.yml b/copier.yml index 0b8d4802..c27c0524 100644 --- a/copier.yml +++ b/copier.yml @@ -82,7 +82,7 @@ license: - "GNU General Public License v3 or later" - "GNU Lesser General Public License v3 or later" - "Not open source" - default: "MIT license" + default: "Apache Software License 2.0" AddLinkCheck: when: "{{ template_profile == 'ask' }}" From 00f358278246c414b0f23e6825eaef17cdba2ead Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 11:04:54 +0200 Subject: [PATCH 124/285] move copier settings and user messages to separate yml files and keep under copier/ folder --- copier.yml | 41 +++++++---------------------------------- copier/messages.yml | 28 ++++++++++++++++++++++++++++ copier/settings.yml | 8 ++++++++ 3 files changed, 43 insertions(+), 34 deletions(-) create mode 100644 copier/messages.yml create mode 100644 copier/settings.yml diff --git a/copier.yml b/copier.yml index c27c0524..b7f78105 100644 --- a/copier.yml +++ b/copier.yml @@ -1,3 +1,7 @@ +--- +# General settings for copier +!include copier/settings.yml + --- # Essential questions @@ -68,9 +72,6 @@ repository_url: default: https://github.com/{{ github_organization }}/{{ package_name }} when: false - - - # extra questions license: type: str @@ -120,34 +121,6 @@ AddPreCommit: default: "{{ template_profile != 'minimum' }}" help: Add pre-commit hook to check code style and format on every commit? -# internal fields -_subdirectory: template - -# user messages -_message_before_copy: | - Thanks for generating a project using our template. - - You'll be asked a series of questions whose answers will be used to - generate a tailored project for you. - -_message_after_copy: | - Your project "{{ package_name }}" has been created successfully! - - Next steps: - - 1. Change directory to the project root: - - $ cd {{ _copier_conf.dst_path }} - - 2. Read next_steps.md which contains information on next steps. - -_message_before_update: | - Thanks for updating your project using our template. - - You'll be asked a series of questions whose answers are pre-populated - with previously entered values. Feel free to change them as needed. - -_message_after_update: | - Your project "{{ package_name }}" has been updated successfully! - In case there are any conflicts, please resolve them. Then, - you're done. +--- +# User messages +!include copier/messages.yml diff --git a/copier/messages.yml b/copier/messages.yml new file mode 100644 index 00000000..e475d29e --- /dev/null +++ b/copier/messages.yml @@ -0,0 +1,28 @@ +# user messages +_message_before_copy: | + Thanks for generating a project using our template. + + You'll be asked a series of questions whose answers will be used to + generate a tailored project for you. + +_message_after_copy: | + Your project "{{ package_name }}" has been created successfully! + + Next steps: + + 1. Change directory to the project root: + + $ cd {{ _copier_conf.dst_path }} + + 2. Read next_steps.md which contains information on next steps. + +_message_before_update: | + Thanks for updating your project using our template. + + You'll be asked a series of questions whose answers are pre-populated + with previously entered values. Feel free to change them as needed. + +_message_after_update: | + Your project "{{ package_name }}" has been updated successfully! + In case there are any conflicts, please resolve them. Then, + you're done. diff --git a/copier/settings.yml b/copier/settings.yml new file mode 100644 index 00000000..5457c2a9 --- /dev/null +++ b/copier/settings.yml @@ -0,0 +1,8 @@ +# internal fields +_subdirectory: template + +# Settings like `_skip_if_exists` are merged +_skip_if_exists: + - "pyproject.toml" + - CITATION.cff + - LICENSE From 24e5c066321a4db0f2eea1e865649012c603657c Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 11:45:44 +0200 Subject: [PATCH 125/285] fix the unit tests --- tests/test_project.py | 31 +++++++++++++++++++++++++++---- tests/test_values.py | 28 ++++++++++++++-------------- 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/tests/test_project.py b/tests/test_project.py index 69b392a3..45118ded 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -11,8 +11,24 @@ IS_WINDOWS = platform.startswith('win') -def test_project_folder(copie): - project = copie.copy() +@pytest.fixture(scope='session') +def copier_project_defaults(): + return { + "package_name": "my_python_package", + "package_short_description": "Short description of package", + "keyword1": "keyword1", + "keyword2": "keyword2", + "version": "0.1.0", + "github_organization": "", + "full_name": "Jane Smith", + "email": "yourname@esciencecenter.nl", + "code_of_conduct_email": "yourname@esciencecenter.nl", + "copyright_holder": "Netherlands eScience Center" + } + +def test_project_folder(copie, copier_project_defaults): + project_defaults = copier_project_defaults + project = copie.copy(extra_answers=project_defaults) assert project.exit_code == 0 assert project.exception is None @@ -42,8 +58,15 @@ def project_env_bin_dir(tmp_path_factory): @pytest.fixture(scope='session') -def baked_with_development_dependencies(tmp_path_factory, project_env_bin_dir): - project = run_copy(src_path=str(here()), dst_path=str(tmp_path_factory.mktemp('projects')), defaults=True, vcs_ref="HEAD") +def baked_with_development_dependencies(tmp_path_factory, project_env_bin_dir, copier_project_defaults): + project_defaults = copier_project_defaults + project = run_copy( + src_path=str(here()), + dst_path=str(tmp_path_factory.mktemp('projects')), + defaults=True, + vcs_ref="HEAD", + data=project_defaults + ) project_dir = project.dst_path bin_dir = project_env_bin_dir diff --git a/tests/test_values.py b/tests/test_values.py index f0cafd48..23c62566 100644 --- a/tests/test_values.py +++ b/tests/test_values.py @@ -1,18 +1,18 @@ -def test_double_quotes_in_name_and_description(copie): - ctx = { - "project_short_description": '"double quotes"', - "full_name": '"name"name' - } - project = copie.copy(extra_answers=ctx) +# def test_double_quotes_in_name_and_description(copie): +# ctx = { +# "project_short_description": '"double quotes"', +# "full_name": '"name"name' +# } +# project = copie.copy(extra_answers=ctx) - assert project.exit_code == 0 +# assert project.exit_code == 0 -def test_single_quotes_in_name_and_description(copie): - ctx = { - "project_short_description": "'single quotes'", - "full_name": "Mr. O'Keefe" - } - project = copie.copy(extra_answers=ctx) +# def test_single_quotes_in_name_and_description(copie): +# ctx = { +# "project_short_description": "'single quotes'", +# "full_name": "Mr. O'Keefe" +# } +# project = copie.copy(extra_answers=ctx) - assert project.exit_code == 0 +# assert project.exit_code == 0 From a4ae2adfb04de0a0a8bf848060f3e732d40fc6ed Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 11:47:11 +0200 Subject: [PATCH 126/285] do not ask copyrightholder in minimum profile --- copier.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/copier.yml b/copier.yml index b7f78105..1040220a 100644 --- a/copier.yml +++ b/copier.yml @@ -62,6 +62,7 @@ code_of_conduct_email: copyright_holder: type: str placeholder: Netherlands eScience Center + when: "{{ template_profile != 'minimum' }}" # calculated fields for GitHub repository: From 9fb42a52d07ec74c4d9fd0746808ac2164c16f91 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 11:56:08 +0200 Subject: [PATCH 127/285] fix full_name issue when using minimum profile --- template/docs/conf.py.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/docs/conf.py.jinja b/template/docs/conf.py.jinja index 530c4d8f..f182650c 100644 --- a/template/docs/conf.py.jinja +++ b/template/docs/conf.py.jinja @@ -19,7 +19,7 @@ project = u"{{ package_name }}" copyright = u"{{ '%Y-%m-%d %H:%M:%S' | strftime }}, {{ copyright_holder }}" -author = u"{{ full_name.replace('\"', '\\\"') }}" +author = u"{{ full_name|replace('\"', '\\\"') }}" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the From 81aea58964a965a4c5423c74465870275e9b83a7 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Thu, 22 Aug 2024 12:07:09 +0200 Subject: [PATCH 128/285] Fix EOL --- .../{% if AddZenodo %}next_steps_zenodo.yml{% endif %} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/.github/workflows/{% if AddZenodo %}next_steps_zenodo.yml{% endif %} b/template/.github/workflows/{% if AddZenodo %}next_steps_zenodo.yml{% endif %} index e290da57..a4b6772f 100644 --- a/template/.github/workflows/{% if AddZenodo %}next_steps_zenodo.yml{% endif %} +++ b/template/.github/workflows/{% if AddZenodo %}next_steps_zenodo.yml{% endif %} @@ -18,7 +18,7 @@ jobs: - name: List created issues run: | echo 'Created issues that must be completed to have fully working Python package: - * Sonarcloud integration ${{ steps.sonarcloud.outputs.url }} + * Sonarcloud integration ${{ steps.sonarcloud.outputs.url }}' - name: Cleanup files needed to create next steps issues run: | git config --global user.name 'NLeSC Python template' From d8a4b8db1ae6ca9cc376a8569251a9b65fb1cfd2 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 12:09:27 +0200 Subject: [PATCH 129/285] initial grouping of questions --- copier.yml | 117 +++------------------------ copier/questions/essential.yml | 26 ++++++ copier/questions/features.yml | 37 +++++++++ copier/questions/package_details.yml | 45 +++++++++++ 4 files changed, 118 insertions(+), 107 deletions(-) create mode 100644 copier/questions/essential.yml create mode 100644 copier/questions/features.yml create mode 100644 copier/questions/package_details.yml diff --git a/copier.yml b/copier.yml index 1040220a..18e762a5 100644 --- a/copier.yml +++ b/copier.yml @@ -3,124 +3,27 @@ !include copier/settings.yml --- -# Essential questions - -package_name: - type: str - placeholder: my_python_package - help: Enter the name of the Python package. - validator: >- - {% if not (package_name | regex_search('^[a-z][a-z0-9\_]+$')) %} - Package name must start with a letter, followed one or more letters, digits or underscores all lowercase - {% endif %} -version: - type: str - placeholder: 0.1.0 - help: Enter the version of the Python package - # profile selection template_profile: type: str default: ask - help: Optional questions (You can use our defaults, or the bare minimum, or decide everything) + help: Profile selection (use the defaults, or the bare minimum, or decide everything) choices: Recommended (our defaults for research software): "recommended" Minimum (no extra features): "minimum" Let me choose (decide each feature yourself): "ask" -# package details -package_short_description: - type: str - placeholder: Short description of package - when: "{{ template_profile != 'minimum' }}" -keyword1: - type: str - placeholder: keyword1 - when: "{{ template_profile != 'minimum' }}" -keyword2: - type: str - placeholder: keyword2 - when: "{{ template_profile != 'minimum' }}" -github_organization: - type: str - placeholder: "" - help: Enter the name of your GitHub username or organization - when: "{{ template_profile != 'minimum' }}" -full_name: - type: str - placeholder: Jane Smith - help: Enter your full name - when: "{{ template_profile != 'minimum' }}" -email: - type: str - placeholder: yourname@esciencecenter.nl - when: "{{ template_profile != 'minimum' }}" -code_of_conduct_email: - type: str - placeholder: "{{ email }}" - when: "{{ template_profile != 'minimum' }}" -copyright_holder: - type: str - placeholder: Netherlands eScience Center - when: "{{ template_profile != 'minimum' }}" - -# calculated fields for GitHub -repository: - default: git@github.com:{{ github_organization }}/{{ package_name }} - when: false - -repository_url: - default: https://github.com/{{ github_organization }}/{{ package_name }} - when: false - -# extra questions -license: - type: str - choices: - - "Apache Software License 2.0" - - "MIT license" - - "BSD license" - - "ISC license" - - "GNU General Public License v3 or later" - - "GNU Lesser General Public License v3 or later" - - "Not open source" - default: "Apache Software License 2.0" - -AddLinkCheck: - when: "{{ template_profile == 'ask' }}" - type: bool - default: "{{ template_profile != 'minimum' }}" - help: Do you want to add a GitHub action to check broken links? - -AddGitHubActions: - when: "{{ template_profile == 'ask' }}" - type: bool - default: "{{ template_profile != 'minimum' }}" - help: GitHub actions to test the package and the documentation - -AddCitation: - when: "{{ template_profile == 'ask' }}" - type: bool - default: "{{ template_profile != 'minimum' }}" - help: Citation file and cffconvert workflow which validates the citation file - -AddChangeLog: - when: "{{ template_profile == 'ask' }}" - type: bool - default: "{{ template_profile != 'minimum' }}" - help: Add a change log to keep track of changes in the package +--- +# questions about the package details +!include copier/questions/essential.yml -AddOnlineDocumentation: - when: "{{ template_profile == 'ask' }}" - type: bool - default: "{{ template_profile != 'minimum' }}" - help: Online documentation using Read the Docs +--- +# questions about the package details +!include copier/questions/package_details.yml -AddPreCommit: - when: "{{ template_profile == 'ask' }}" - type: bool - default: "{{ template_profile != 'minimum' }}" - help: Add pre-commit hook to check code style and format on every commit? +--- +# Features +!include copier/questions/features.yml --- # User messages diff --git a/copier/questions/essential.yml b/copier/questions/essential.yml new file mode 100644 index 00000000..5e900b90 --- /dev/null +++ b/copier/questions/essential.yml @@ -0,0 +1,26 @@ +--- +# Essential questions +package_name: + type: str + placeholder: my_python_package + help: Enter the name of the Python package. + validator: >- + {% if not (package_name | regex_search('^[a-z][a-z0-9\_]+$')) %} + Package name must start with a letter, followed one or more letters, digits or underscores all lowercase + {% endif %} +version: + type: str + placeholder: 0.1.0 + help: Enter the version of the Python package + +license: + type: str + choices: + - "Apache Software License 2.0" + - "MIT license" + - "BSD license" + - "ISC license" + - "GNU General Public License v3 or later" + - "GNU Lesser General Public License v3 or later" + - "Not open source" + default: "Apache Software License 2.0" diff --git a/copier/questions/features.yml b/copier/questions/features.yml new file mode 100644 index 00000000..f4adab36 --- /dev/null +++ b/copier/questions/features.yml @@ -0,0 +1,37 @@ +--- +# Questions for features +AddLinkCheck: + when: "{{ template_profile == 'ask' }}" + type: bool + default: "{{ template_profile != 'minimum' }}" + help: Do you want to add a GitHub action to check broken links? + +AddGitHubActions: + when: "{{ template_profile == 'ask' }}" + type: bool + default: "{{ template_profile != 'minimum' }}" + help: GitHub actions to test the package and the documentation + +AddCitation: + when: "{{ template_profile == 'ask' }}" + type: bool + default: "{{ template_profile != 'minimum' }}" + help: Citation file and cffconvert workflow which validates the citation file + +AddChangeLog: + when: "{{ template_profile == 'ask' }}" + type: bool + default: "{{ template_profile != 'minimum' }}" + help: Add a change log to keep track of changes in the package + +AddOnlineDocumentation: + when: "{{ template_profile == 'ask' }}" + type: bool + default: "{{ template_profile != 'minimum' }}" + help: Online documentation using Read the Docs + +AddPreCommit: + when: "{{ template_profile == 'ask' }}" + type: bool + default: "{{ template_profile != 'minimum' }}" + help: Add pre-commit hook to check code style and format on every commit? diff --git a/copier/questions/package_details.yml b/copier/questions/package_details.yml new file mode 100644 index 00000000..2165ef12 --- /dev/null +++ b/copier/questions/package_details.yml @@ -0,0 +1,45 @@ +--- +# package details +package_short_description: + type: str + placeholder: Short description of package + when: "{{ template_profile != 'minimum' }}" +keyword1: + type: str + placeholder: keyword1 + when: "{{ template_profile != 'minimum' }}" +keyword2: + type: str + placeholder: keyword2 + when: "{{ template_profile != 'minimum' }}" +github_organization: + type: str + placeholder: "" + help: Enter the name of your GitHub username or organization + when: "{{ template_profile != 'minimum' }}" +full_name: + type: str + placeholder: Jane Smith + help: Enter your full name + when: "{{ template_profile != 'minimum' }}" +email: + type: str + placeholder: yourname@esciencecenter.nl + when: "{{ template_profile != 'minimum' }}" +code_of_conduct_email: + type: str + placeholder: "{{ email }}" + when: "{{ template_profile != 'minimum' }}" +copyright_holder: + type: str + placeholder: Netherlands eScience Center + when: "{{ template_profile != 'minimum' }}" + +# calculated fields for GitHub +repository: + default: git@github.com:{{ github_organization }}/{{ package_name }} + when: false + +repository_url: + default: https://github.com/{{ github_organization }}/{{ package_name }} + when: false From e71567545e54434298a733546cc999f666641062 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 13:45:54 +0200 Subject: [PATCH 130/285] ask for confirmation before package details questions --- copier/questions/essential.yml | 1 - copier/questions/package_details.yml | 21 +++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/copier/questions/essential.yml b/copier/questions/essential.yml index 5e900b90..92db3154 100644 --- a/copier/questions/essential.yml +++ b/copier/questions/essential.yml @@ -12,7 +12,6 @@ version: type: str placeholder: 0.1.0 help: Enter the version of the Python package - license: type: str choices: diff --git a/copier/questions/package_details.yml b/copier/questions/package_details.yml index 2165ef12..78117a87 100644 --- a/copier/questions/package_details.yml +++ b/copier/questions/package_details.yml @@ -1,39 +1,44 @@ --- # package details +add_package_details: + type: bool + help: Do you want to add extra details for the package? + default: yes + when: "{{ template_profile != 'minimum'}}" package_short_description: type: str placeholder: Short description of package - when: "{{ template_profile != 'minimum' }}" + when: "{{ template_profile != 'minimum' and add_package_details }}" keyword1: type: str placeholder: keyword1 - when: "{{ template_profile != 'minimum' }}" + when: "{{ template_profile != 'minimum' and add_package_details }}" keyword2: type: str placeholder: keyword2 - when: "{{ template_profile != 'minimum' }}" + when: "{{ template_profile != 'minimum' and add_package_details }}" github_organization: type: str placeholder: "" help: Enter the name of your GitHub username or organization - when: "{{ template_profile != 'minimum' }}" + when: "{{ template_profile != 'minimum' and add_package_details }}" full_name: type: str placeholder: Jane Smith help: Enter your full name - when: "{{ template_profile != 'minimum' }}" + when: "{{ template_profile != 'minimum' and add_package_details }}" email: type: str placeholder: yourname@esciencecenter.nl - when: "{{ template_profile != 'minimum' }}" + when: "{{ template_profile != 'minimum' and add_package_details }}" code_of_conduct_email: type: str placeholder: "{{ email }}" - when: "{{ template_profile != 'minimum' }}" + when: "{{ template_profile != 'minimum' and add_package_details }}" copyright_holder: type: str placeholder: Netherlands eScience Center - when: "{{ template_profile != 'minimum' }}" + when: "{{ template_profile != 'minimum' and add_package_details }}" # calculated fields for GitHub repository: From bbc96a72bff2e96cde63b2545df691b5438fb00a Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 13:48:25 +0200 Subject: [PATCH 131/285] improve profile selection question --- copier.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/copier.yml b/copier.yml index 18e762a5..343f6207 100644 --- a/copier.yml +++ b/copier.yml @@ -7,10 +7,10 @@ template_profile: type: str default: ask - help: Profile selection (use the defaults, or the bare minimum, or decide everything) + help: Select a profile choices: Recommended (our defaults for research software): "recommended" - Minimum (no extra features): "minimum" + Minimum (bare minimum, no extra features): "minimum" Let me choose (decide each feature yourself): "ask" --- From 59371af1ff677da72f35d4d63c0cbd862e0814b9 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 13:50:23 +0200 Subject: [PATCH 132/285] add a text about placeholder to the messages --- copier/messages.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/copier/messages.yml b/copier/messages.yml index e475d29e..d19e7232 100644 --- a/copier/messages.yml +++ b/copier/messages.yml @@ -5,6 +5,9 @@ _message_before_copy: | You'll be asked a series of questions whose answers will be used to generate a tailored project for you. + For each question there is a placeholder. Make sure you provide an + input to each of them. + _message_after_copy: | Your project "{{ package_name }}" has been created successfully! From f7f8698bdc3a818dfce0e198f6d9bf93c2916a02 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Thu, 22 Aug 2024 13:51:38 +0200 Subject: [PATCH 133/285] Optional code of conduct --- copier.yml | 7 +++++++ template/CONTRIBUTING.md.jinja | 2 +- template/project_setup.md.jinja | 2 ++ ...f AddCodeConduct %}CODE_OF_CONDUCT.md{% endif %}.jinja} | 0 4 files changed, 10 insertions(+), 1 deletion(-) rename template/{CODE_OF_CONDUCT.md.jinja => {% if AddCodeConduct %}CODE_OF_CONDUCT.md{% endif %}.jinja} (100%) diff --git a/copier.yml b/copier.yml index 04222e9b..b83ee4f5 100644 --- a/copier.yml +++ b/copier.yml @@ -107,6 +107,13 @@ AddPreCommit: default: "{{ template_profile != 'minimum' }}" help: Add pre-commit hook to check code style and format on every commit? +AddCodeConduct: + when: "{{ template_profile == 'ask' }}" + type: bool + default: "{{ template_profile != 'minimum' }}" + help: Add code of conduct? + + # internal fields _subdirectory: template diff --git a/template/CONTRIBUTING.md.jinja b/template/CONTRIBUTING.md.jinja index cc1a1787..4c3f90e0 100644 --- a/template/CONTRIBUTING.md.jinja +++ b/template/CONTRIBUTING.md.jinja @@ -1,6 +1,6 @@ # Contributing guidelines -We welcome any kind of contribution to our software, from simple comment or question to a full fledged [pull request](https://help.github.com/articles/about-pull-requests/). Please read and follow our [Code of Conduct](CODE_OF_CONDUCT.md). +We welcome any kind of contribution to our software, from simple comment or question to a full fledged [pull request](https://help.github.com/articles/about-pull-requests/). {% if AddCodeConduct -%}Please read and follow our [Code of Conduct](CODE_OF_CONDUCT.md).{%- endif %} A contribution can be one of the following cases: diff --git a/template/project_setup.md.jinja b/template/project_setup.md.jinja index ba015fc9..d0a5ad09 100644 --- a/template/project_setup.md.jinja +++ b/template/project_setup.md.jinja @@ -100,10 +100,12 @@ help you decide which tool to use for packaging. - Follow the [making software citable](https://guide.esciencecenter.nl/#/citable_software/making_software_citable) section in the guide. {%- endif -%} +{% if AddCodeConduct -%} ## CODE_OF_CONDUCT.md - Information about how to behave professionally - [Relevant section in the guide](https://guide.esciencecenter.nl/#/best_practices/documentation?id=code-of-conduct) +{%- endif -%} ## CONTRIBUTING.md diff --git a/template/CODE_OF_CONDUCT.md.jinja b/template/{% if AddCodeConduct %}CODE_OF_CONDUCT.md{% endif %}.jinja similarity index 100% rename from template/CODE_OF_CONDUCT.md.jinja rename to template/{% if AddCodeConduct %}CODE_OF_CONDUCT.md{% endif %}.jinja From b173def8f393dd62bdc88ef427f4231a35c5d4e2 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Thu, 22 Aug 2024 13:59:14 +0200 Subject: [PATCH 134/285] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index da19350b..ebbc7a22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Added +* Make Code of Conduct optional [#464](https://github.com/NLeSC/python-template/pull/530) * Make citation optional [#471](https://github.com/NLeSC/python-template/pull/471) * Make online documentation optional [#476](https://github.com/NLeSC/python-template/pull/476) * Added Python 3.12 support [#356](https://github.com/NLeSC/python-template/issues/356) From e51c0ee74403cff6eb058a9411254e31b28e78c2 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 14:01:37 +0200 Subject: [PATCH 135/285] add helper text for the package details questions --- copier/questions/package_details.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/copier/questions/package_details.yml b/copier/questions/package_details.yml index 78117a87..5448dbaf 100644 --- a/copier/questions/package_details.yml +++ b/copier/questions/package_details.yml @@ -2,20 +2,23 @@ # package details add_package_details: type: bool - help: Do you want to add extra details for the package? default: yes + help: Do you want to add extra details for the package? when: "{{ template_profile != 'minimum'}}" package_short_description: type: str - placeholder: Short description of package + placeholder: Short description + help: Short description of package when: "{{ template_profile != 'minimum' and add_package_details }}" keyword1: type: str placeholder: keyword1 + help: Add a keyword when: "{{ template_profile != 'minimum' and add_package_details }}" keyword2: type: str placeholder: keyword2 + help: Add a keyword when: "{{ template_profile != 'minimum' and add_package_details }}" github_organization: type: str @@ -30,14 +33,17 @@ full_name: email: type: str placeholder: yourname@esciencecenter.nl + help: What is your email address? when: "{{ template_profile != 'minimum' and add_package_details }}" code_of_conduct_email: type: str - placeholder: "{{ email }}" + placeholder: yourname@esciencecenter.nl + help: What is the email address cor code of conduct? when: "{{ template_profile != 'minimum' and add_package_details }}" copyright_holder: type: str placeholder: Netherlands eScience Center + help: Who is the copyright holder? when: "{{ template_profile != 'minimum' and add_package_details }}" # calculated fields for GitHub From 6e485d8c555b469d7ababf7d97f30548d8450665 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 14:22:37 +0200 Subject: [PATCH 136/285] fix formatting of copier yaml files --- copier/questions/features.yml | 10 +++++----- copier/questions/package_details.yml | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/copier/questions/features.yml b/copier/questions/features.yml index f4adab36..d11ea805 100644 --- a/copier/questions/features.yml +++ b/copier/questions/features.yml @@ -1,35 +1,35 @@ --- # Questions for features +addExtraFeatures: + type: bool + default: yes + help: Do you want to add extra features? + when: "{{ template_profile == 'ask'}}" AddLinkCheck: when: "{{ template_profile == 'ask' }}" type: bool default: "{{ template_profile != 'minimum' }}" help: Do you want to add a GitHub action to check broken links? - AddGitHubActions: when: "{{ template_profile == 'ask' }}" type: bool default: "{{ template_profile != 'minimum' }}" help: GitHub actions to test the package and the documentation - AddCitation: when: "{{ template_profile == 'ask' }}" type: bool default: "{{ template_profile != 'minimum' }}" help: Citation file and cffconvert workflow which validates the citation file - AddChangeLog: when: "{{ template_profile == 'ask' }}" type: bool default: "{{ template_profile != 'minimum' }}" help: Add a change log to keep track of changes in the package - AddOnlineDocumentation: when: "{{ template_profile == 'ask' }}" type: bool default: "{{ template_profile != 'minimum' }}" help: Online documentation using Read the Docs - AddPreCommit: when: "{{ template_profile == 'ask' }}" type: bool diff --git a/copier/questions/package_details.yml b/copier/questions/package_details.yml index 5448dbaf..bacdbeac 100644 --- a/copier/questions/package_details.yml +++ b/copier/questions/package_details.yml @@ -1,6 +1,6 @@ --- # package details -add_package_details: +AddPackageDetails: type: bool default: yes help: Do you want to add extra details for the package? @@ -9,42 +9,42 @@ package_short_description: type: str placeholder: Short description help: Short description of package - when: "{{ template_profile != 'minimum' and add_package_details }}" + when: "{{ template_profile != 'minimum' and AddPackageDetails }}" keyword1: type: str placeholder: keyword1 - help: Add a keyword - when: "{{ template_profile != 'minimum' and add_package_details }}" + help: Add keyword1 + when: "{{ template_profile != 'minimum' and AddPackageDetails }}" keyword2: type: str placeholder: keyword2 - help: Add a keyword - when: "{{ template_profile != 'minimum' and add_package_details }}" + help: Add keyword2 + when: "{{ template_profile != 'minimum' and AddPackageDetails }}" github_organization: type: str placeholder: "" help: Enter the name of your GitHub username or organization - when: "{{ template_profile != 'minimum' and add_package_details }}" + when: "{{ template_profile != 'minimum' and AddPackageDetails }}" full_name: type: str placeholder: Jane Smith help: Enter your full name - when: "{{ template_profile != 'minimum' and add_package_details }}" + when: "{{ template_profile != 'minimum' and AddPackageDetails }}" email: type: str placeholder: yourname@esciencecenter.nl help: What is your email address? - when: "{{ template_profile != 'minimum' and add_package_details }}" + when: "{{ template_profile != 'minimum' and AddPackageDetails }}" code_of_conduct_email: type: str placeholder: yourname@esciencecenter.nl help: What is the email address cor code of conduct? - when: "{{ template_profile != 'minimum' and add_package_details }}" + when: "{{ template_profile != 'minimum' and AddPackageDetails }}" copyright_holder: type: str placeholder: Netherlands eScience Center help: Who is the copyright holder? - when: "{{ template_profile != 'minimum' and add_package_details }}" + when: "{{ template_profile != 'minimum' and AddPackageDetails }}" # calculated fields for GitHub repository: From 8e560eed34adbf7b55486e52ffd784b556d083e5 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 14:44:58 +0200 Subject: [PATCH 137/285] pull the changes in next step workflow before updating the branch again --- .../{% if AddCitation %}next_steps_citation.yml{% endif %} | 1 + ...ocumentation %}next_steps_online_documentation.yml{% endif %} | 1 + 2 files changed, 2 insertions(+) diff --git a/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} b/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} index 28f369b5..bd6c1f00 100644 --- a/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} +++ b/template/.github/workflows/{% if AddCitation %}next_steps_citation.yml{% endif %} @@ -23,6 +23,7 @@ jobs: run: | git config --global user.name 'NLeSC Python template' git config --global user.email 'nlesc-python-template@users.noreply.github.com' + git pull # other next step workflows may push changes before git rm .github/workflows/next_steps_citation.yml git rm .github/workflows/next_steps_citation_issue.md git commit -am "Cleanup automated next steps issue generator for citation" diff --git a/template/.github/workflows/{% if AddOnlineDocumentation %}next_steps_online_documentation.yml{% endif %} b/template/.github/workflows/{% if AddOnlineDocumentation %}next_steps_online_documentation.yml{% endif %} index 8aa9452a..c9f29e84 100644 --- a/template/.github/workflows/{% if AddOnlineDocumentation %}next_steps_online_documentation.yml{% endif %} +++ b/template/.github/workflows/{% if AddOnlineDocumentation %}next_steps_online_documentation.yml{% endif %} @@ -23,6 +23,7 @@ jobs: run: | git config --global user.name 'NLeSC Python template' git config --global user.email 'nlesc-python-template@users.noreply.github.com' + git pull # other next step workflows may push changes before git rm .github/workflows/next_steps_online_documentation.yml git rm .github/workflows/next_steps_online_documentation_issue.md git commit -am "Cleanup automated next steps issue generator for online documentation" From 06acad31d8f295a524ee66c0e516ebfe720f5b19 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Thu, 22 Aug 2024 15:10:39 +0200 Subject: [PATCH 138/285] Add git pull --- .../workflows/{% if AddZenodo %}next_steps_zenodo.yml{% endif %} | 1 + 1 file changed, 1 insertion(+) diff --git a/template/.github/workflows/{% if AddZenodo %}next_steps_zenodo.yml{% endif %} b/template/.github/workflows/{% if AddZenodo %}next_steps_zenodo.yml{% endif %} index a4b6772f..17b5d66d 100644 --- a/template/.github/workflows/{% if AddZenodo %}next_steps_zenodo.yml{% endif %} +++ b/template/.github/workflows/{% if AddZenodo %}next_steps_zenodo.yml{% endif %} @@ -23,6 +23,7 @@ jobs: run: | git config --global user.name 'NLeSC Python template' git config --global user.email 'nlesc-python-template@users.noreply.github.com' + git pull # other next step workflows may push changes before git rm .github/workflows/next_steps_zenodo.yml git rm .github/workflows/next_steps_zenodo_issue.md git commit -am "Cleanup automated next steps issue generator for zenodo" From e1ca6d091fd9f3bbabc4abf3f35a9ef474fcfffd Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 15:15:18 +0200 Subject: [PATCH 139/285] fix the filename typo of sonar-project.properties --- ... if AddSonarCloud %}sonar-project.properties{% endif %}.jinja} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename template/{{% if AddSonarCloud %}sonar-project.properties.jinja{% endif %} => {% if AddSonarCloud %}sonar-project.properties{% endif %}.jinja} (100%) diff --git a/template/{% if AddSonarCloud %}sonar-project.properties.jinja{% endif %} b/template/{% if AddSonarCloud %}sonar-project.properties{% endif %}.jinja similarity index 100% rename from template/{% if AddSonarCloud %}sonar-project.properties.jinja{% endif %} rename to template/{% if AddSonarCloud %}sonar-project.properties{% endif %}.jinja From 0c135f80e1369a869aea25983372ccd82d45e5fc Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 15:30:55 +0200 Subject: [PATCH 140/285] pull changes in sonarcloud next steps workflow --- .../{% if AddSonarCloud %}next_steps_sonarcloud.yml{% endif %} | 1 + 1 file changed, 1 insertion(+) diff --git a/template/.github/workflows/{% if AddSonarCloud %}next_steps_sonarcloud.yml{% endif %} b/template/.github/workflows/{% if AddSonarCloud %}next_steps_sonarcloud.yml{% endif %} index 0a0c676a..576a7642 100644 --- a/template/.github/workflows/{% if AddSonarCloud %}next_steps_sonarcloud.yml{% endif %} +++ b/template/.github/workflows/{% if AddSonarCloud %}next_steps_sonarcloud.yml{% endif %} @@ -23,6 +23,7 @@ jobs: run: | git config --global user.name 'NLeSC Python template' git config --global user.email 'nlesc-python-template@users.noreply.github.com' + git pull # other next step workflows may push changes before git rm .github/workflows/next_steps_sonarcloud.yml git rm .github/workflows/next_steps_sonarcloud_issue.md git commit -am "Cleanup automated next steps issue generator for sonarcloud" From 1fe296a6327b92ca009a6b5c889a86dd1e4e3b0c Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Thu, 22 Aug 2024 15:49:24 +0200 Subject: [PATCH 141/285] Update CHANGELOG.md Co-authored-by: fdiblen <144492+fdiblen@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3283fc7e..9dc5bf8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## Unreleased ### Added -* Make zenodo integration optional [#520](https://github.com/NLeSC/python-template/pull/520) +* Make zenodo next step instructions optional [#520](https://github.com/NLeSC/python-template/pull/520) * Make citation optional [#471](https://github.com/NLeSC/python-template/pull/471) * Make online documentation optional [#476](https://github.com/NLeSC/python-template/pull/476) * Added Python 3.12 support [#356](https://github.com/NLeSC/python-template/issues/356) From eb2664401e2a582979e2d008e33e4d39b0e5c840 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Thu, 22 Aug 2024 15:49:41 +0200 Subject: [PATCH 142/285] Update copier.yml Co-authored-by: fdiblen <144492+fdiblen@users.noreply.github.com> --- copier.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier.yml b/copier.yml index ee17c2ac..8a9c3850 100644 --- a/copier.yml +++ b/copier.yml @@ -111,7 +111,7 @@ AddZenodo: when: "{{ template_profile == 'ask' }}" type: bool default: "{{ template_profile != 'minimum' }}" - help: Add instructions about zenodo integration? + help: Create a GitHub issue on how to enable Zenodo integration? # internal fields _subdirectory: template From c5b42e2b12a612898657fc64de0a51685770f5dc Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Thu, 22 Aug 2024 15:51:04 +0200 Subject: [PATCH 143/285] Update profiles.md Co-authored-by: fdiblen <144492+fdiblen@users.noreply.github.com> --- profiles.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/profiles.md b/profiles.md index c0a287a0..3871b35f 100644 --- a/profiles.md +++ b/profiles.md @@ -29,7 +29,7 @@ - .editorconfig - publishing and release - - zenodo #469 + - zenodo #520 - keywords - changelog.md - cffconvert workflow and citation file From 4169e3fd99d30d64bec5e12f86e6c962cbcc5f81 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Thu, 22 Aug 2024 15:51:28 +0200 Subject: [PATCH 144/285] Update template/README.dev.md.jinja Co-authored-by: fdiblen <144492+fdiblen@users.noreply.github.com> --- template/README.dev.md.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/README.dev.md.jinja b/template/README.dev.md.jinja index 11bd3b04..70a89851 100644 --- a/template/README.dev.md.jinja +++ b/template/README.dev.md.jinja @@ -197,6 +197,6 @@ python -m twine upload dist/* Don't forget to also make a [release on GitHub]({{repository_url}}/releases/new). -{%- if AddZenodod -%} +{%- if AddZenodo -%} GitHub-Zenodo integration will also trigger Zenodo into making a snapshot of your repository and sticking a DOI on it. {%- endif -%} From b144b4b1de599cf3fe0fe81de0081f5016f6d7af Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Thu, 22 Aug 2024 15:57:02 +0200 Subject: [PATCH 145/285] Make badge optional --- template/README.md.jinja | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/template/README.md.jinja b/template/README.md.jinja index 64e4acc3..3ecfbfcf 100644 --- a/template/README.md.jinja +++ b/template/README.md.jinja @@ -7,9 +7,7 @@ | (1/5) code repository | [![github repo badge](https://img.shields.io/badge/github-repo-000.svg?logo=github&labelColor=gray&color=blue)]({{repository_url}}) | | (2/5) license | [![github license badge](https://img.shields.io/github/license/{{github_organization}}/{{package_name}})]({{repository_url}}) | | (3/5) community registry | [![RSD](https://img.shields.io/badge/rsd-{{package_name}}-00a3e3.svg)](https://www.research-software.nl/software/{{package_name}}) [![workflow pypi badge](https://img.shields.io/pypi/v/{{package_name}}.svg?colorB=blue)](https://pypi.python.org/project/{{package_name}}/) | -{% if AddZenodo -%} -| (4/5) citation | [![DOI](https://zenodo.org/badge/DOI/.svg)](https://doi.org/) | -{%- endif -%} +| (4/5) citation | {% if AddZenodo -%} [![DOI](https://zenodo.org/badge/DOI/.svg)](https://doi.org/){%- endif -%} | (5/5) checklist | [![workflow cii badge](https://bestpractices.coreinfrastructure.org/projects//badge)](https://bestpractices.coreinfrastructure.org/projects/) | | howfairis | [![fair-software badge](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8B-yellow)](https://fair-software.eu) | | **Other best practices** |   | From 65d74ab63ee1ad433be612406a3b93576ad94729 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Thu, 22 Aug 2024 16:33:02 +0200 Subject: [PATCH 146/285] Update template/README.dev.md.jinja Co-authored-by: fdiblen <144492+fdiblen@users.noreply.github.com> --- template/README.dev.md.jinja | 1 - 1 file changed, 1 deletion(-) diff --git a/template/README.dev.md.jinja b/template/README.dev.md.jinja index 70a89851..e7740cdd 100644 --- a/template/README.dev.md.jinja +++ b/template/README.dev.md.jinja @@ -196,7 +196,6 @@ python -m twine upload dist/* ### (3/3) GitHub Don't forget to also make a [release on GitHub]({{repository_url}}/releases/new). - {%- if AddZenodo -%} GitHub-Zenodo integration will also trigger Zenodo into making a snapshot of your repository and sticking a DOI on it. {%- endif -%} From 13d354005b0b0bb9716626863f0a4843b1f8890b Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Thu, 22 Aug 2024 16:33:18 +0200 Subject: [PATCH 147/285] Update template/README.md.jinja Co-authored-by: fdiblen <144492+fdiblen@users.noreply.github.com> --- template/README.md.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/README.md.jinja b/template/README.md.jinja index e8b60163..a85606c5 100644 --- a/template/README.md.jinja +++ b/template/README.md.jinja @@ -7,7 +7,7 @@ | (1/5) code repository | [![github repo badge](https://img.shields.io/badge/github-repo-000.svg?logo=github&labelColor=gray&color=blue)]({{repository_url}}) | | (2/5) license | [![github license badge](https://img.shields.io/github/license/{{github_organization}}/{{package_name}})]({{repository_url}}) | | (3/5) community registry | [![RSD](https://img.shields.io/badge/rsd-{{package_name}}-00a3e3.svg)](https://www.research-software.nl/software/{{package_name}}) [![workflow pypi badge](https://img.shields.io/pypi/v/{{package_name}}.svg?colorB=blue)](https://pypi.python.org/project/{{package_name}}/) | -| (4/5) citation | {% if AddZenodo -%} [![DOI](https://zenodo.org/badge/DOI/.svg)](https://doi.org/){%- endif -%} +| (4/5) citation | {% if AddZenodo -%} [![DOI](https://zenodo.org/badge/DOI/.svg)](https://doi.org/){%- endif -%} | | (5/5) checklist | [![workflow cii badge](https://bestpractices.coreinfrastructure.org/projects//badge)](https://bestpractices.coreinfrastructure.org/projects/) | | howfairis | [![fair-software badge](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8B-yellow)](https://fair-software.eu) | | **Other best practices** |   | From 76bbfbc2d1dc0d169091f50756071029c1aa1944 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Thu, 22 Aug 2024 17:21:28 +0200 Subject: [PATCH 148/285] Update copier.yml Co-authored-by: fdiblen <144492+fdiblen@users.noreply.github.com> --- copier.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/copier.yml b/copier.yml index 09249c6c..2a966d8a 100644 --- a/copier.yml +++ b/copier.yml @@ -114,7 +114,6 @@ AddCodeConduct: default: "{{ template_profile != 'minimum' }}" help: Add code of conduct? - AddSonarCloud: when: "{{ template_profile == 'ask' }}" type: bool From 3e8da9feb55caf6b33c57f6d74b1387e161c376c Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 17:30:37 +0200 Subject: [PATCH 149/285] add a new yaml file for profiles --- copier/profiles.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 copier/profiles.yml diff --git a/copier/profiles.yml b/copier/profiles.yml new file mode 100644 index 00000000..5204ddee --- /dev/null +++ b/copier/profiles.yml @@ -0,0 +1,10 @@ +--- +# profile selection +template_profile: + type: str + default: ask + help: Select a profile + choices: + Recommended (our defaults for research software): "recommended" + Minimum (bare minimum, no extra features): "minimum" + Let me choose (decide each feature yourself): "ask" From 5786282a84a4c0c3874c2f979dfa26a84fc5b4a9 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 17:34:25 +0200 Subject: [PATCH 150/285] update the changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2871540f..b4e8ea4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased ### Added +* New YAML files for copier questions [#529](https://github.com/NLeSC/python-template/pull/529) * Make zenodo next step instructions optional [#520](https://github.com/NLeSC/python-template/pull/520) * Make SonarCloud optional [#515](https://github.com/NLeSC/python-template/pull/515) * Make citation optional [#471](https://github.com/NLeSC/python-template/pull/471) @@ -15,7 +16,7 @@ * Added new 'docs' section in extra dependencies [#317](https://github.com/NLeSC/python-template/issues/317) ### Changed - +* Made copier configuration more modular [#529](https://github.com/NLeSC/python-template/pull/529) * pre-commit script is optional ([#457](https://github.com/NLeSC/python-template/issues/457)) * CHANGELOG.md is now optional ([#462](https://github.com/NLeSC/python-template/issues/462)) * Moved to src/ based layout for generated packages From 91d9ab1558299ce273aad47cda7abba16e658728 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 17:49:47 +0200 Subject: [PATCH 151/285] movi profile question to copier/profiles.yml --- copier.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/copier.yml b/copier.yml index 343f6207..8f037049 100644 --- a/copier.yml +++ b/copier.yml @@ -3,15 +3,8 @@ !include copier/settings.yml --- -# profile selection -template_profile: - type: str - default: ask - help: Select a profile - choices: - Recommended (our defaults for research software): "recommended" - Minimum (bare minimum, no extra features): "minimum" - Let me choose (decide each feature yourself): "ask" +# profiles +!include copier/profiles.yml --- # questions about the package details From 8ef99a6e0ba3fa48d2b1a80393034ec5a8d9f5a3 Mon Sep 17 00:00:00 2001 From: Sander van Rijn Date: Thu, 22 Aug 2024 18:39:25 +0200 Subject: [PATCH 152/285] Add v0.5.0 section --- CHANGELOG.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2871540f..36518b98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,10 +3,27 @@ ## Unreleased ### Added + * Make zenodo next step instructions optional [#520](https://github.com/NLeSC/python-template/pull/520) * Make SonarCloud optional [#515](https://github.com/NLeSC/python-template/pull/515) * Make citation optional [#471](https://github.com/NLeSC/python-template/pull/471) * Make online documentation optional [#476](https://github.com/NLeSC/python-template/pull/476) + +### Changed + +* pre-commit script is optional ([#457](https://github.com/NLeSC/python-template/issues/457)) +* CHANGELOG.md is now optional ([#462](https://github.com/NLeSC/python-template/issues/462)) + +### Removed + +* + +## 0.5.0 + +Released on August 15, 2024 + +### Added + * Added Python 3.12 support [#356](https://github.com/NLeSC/python-template/issues/356) * Template unit tests for documentation generation, linting and version bumping * Docstring for function @@ -16,8 +33,6 @@ ### Changed -* pre-commit script is optional ([#457](https://github.com/NLeSC/python-template/issues/457)) -* CHANGELOG.md is now optional ([#462](https://github.com/NLeSC/python-template/issues/462)) * Moved to src/ based layout for generated packages * Moved from setup.cfg/.py to pyproject.toml [#351](https://github.com/NLeSC/python-template/issues/351) * Moved from prospector to ruff [#336](https://github.com/NLeSC/python-template/issues/336) @@ -45,6 +60,8 @@ ## 0.4.0 +Released on May 3, 2021 + ### Added * Instructions to add your existing code to directory generated by the NLeSC Python template [#202](https://github.com/NLeSC/python-template/issues/202) @@ -75,6 +92,8 @@ ## 0.3.0 +Released on Apr 22, 2021 + ### Added * Added Python 3.9 support @@ -105,6 +124,7 @@ * Improved the documentation for the generated package and template itself ## Removed + * Dropped appveyor [#160](https://github.com/NLeSC/python-template/issues/160) * Dropped everything Conda related * Drop Python 3.5 support From 44b4e43ac67ddc237f604296b50031b41940a2a4 Mon Sep 17 00:00:00 2001 From: Sander van Rijn Date: Thu, 22 Aug 2024 18:43:33 +0200 Subject: [PATCH 153/285] add links to changelog, matching template style --- CHANGELOG.md | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36518b98..fc661e6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Change Log -## Unreleased +## [Unreleased] ### Added @@ -18,7 +18,7 @@ * -## 0.5.0 +## [0.5.0] Released on August 15, 2024 @@ -58,7 +58,7 @@ Released on August 15, 2024 * Statements in project_setup.md already mentioned in README.dev.md * .zenodo.json is no longer necessary, CITATION.cff also works with Zenodo. -## 0.4.0 +## [0.4.0] Released on May 3, 2021 @@ -90,7 +90,7 @@ Released on May 3, 2021 * Automatic publish to PyPi after GitHub release [#196](https://github.com/NLeSC/python-template/issues/196) -## 0.3.0 +## [0.3.0] Released on Apr 22, 2021 @@ -123,7 +123,7 @@ Released on Apr 22, 2021 * Updated Code of Conduct for generated package * Improved the documentation for the generated package and template itself -## Removed +### Removed * Dropped appveyor [#160](https://github.com/NLeSC/python-template/issues/160) * Dropped everything Conda related @@ -131,7 +131,7 @@ Released on Apr 22, 2021 * Removed unit tests doing the linting -## 0.2.0 +## [0.2.0] Released on July 17, 2019 @@ -169,7 +169,7 @@ Released on July 17, 2019 * Python 2 support -## 0.1.0 +## [0.1.0] Released on July 12, 2018. @@ -189,3 +189,11 @@ Released on July 12, 2018. - README - Requirements.txt - Setup configuration + + +[Unreleased]: https://github.com/NLeSC/python-template//compare/0.5.0...HEAD +[0.5.0]: https://github.com/NLeSC/python-template/releases/tag/0.5.0 +[0.4.0]: https://github.com/NLeSC/python-template/releases/tag/0.4.0 +[0.3.0]: https://github.com/NLeSC/python-template/releases/tag/0.3.0 +[0.2.0]: https://github.com/NLeSC/python-template/releases/tag/0.2.0 +[0.1.0]: https://github.com/NLeSC/python-template/releases/tag/0.1.0 From 10746578e719076b9fe3c4b942a1d3989cafcaed Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Thu, 22 Aug 2024 19:05:27 +0200 Subject: [PATCH 154/285] fix the tests in tests/test_values.py --- tests/test_values.py | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/tests/test_values.py b/tests/test_values.py index 23c62566..6bb78dad 100644 --- a/tests/test_values.py +++ b/tests/test_values.py @@ -1,18 +1,24 @@ -# def test_double_quotes_in_name_and_description(copie): -# ctx = { -# "project_short_description": '"double quotes"', -# "full_name": '"name"name' -# } -# project = copie.copy(extra_answers=ctx) +from test_project import copier_project_defaults -# assert project.exit_code == 0 +def test_double_quotes_in_name_and_description(copie, copier_project_defaults): + project_defaults = copier_project_defaults + test_values = { + "project_short_description": '"double quotes"', + "full_name": '"name"name' + } + project_defaults.update(test_values) + project = copie.copy(extra_answers=project_defaults) + assert project.exit_code == 0 -# def test_single_quotes_in_name_and_description(copie): -# ctx = { -# "project_short_description": "'single quotes'", -# "full_name": "Mr. O'Keefe" -# } -# project = copie.copy(extra_answers=ctx) -# assert project.exit_code == 0 +def test_single_quotes_in_name_and_description(copie, copier_project_defaults): + project_defaults = copier_project_defaults + test_values = { + "project_short_description": "'single quotes'", + "full_name": "Mr. O'Keefe" + } + project_defaults.update(test_values) + project = copie.copy(extra_answers=project_defaults) + + assert project.exit_code == 0 From e852fa2850057de6d2133936c283ce3f57d6c6fb Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Fri, 23 Aug 2024 13:59:01 +0200 Subject: [PATCH 155/285] fix empty lines --- template/project_setup.md.jinja | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/template/project_setup.md.jinja b/template/project_setup.md.jinja index a5c31ec5..f3914fab 100644 --- a/template/project_setup.md.jinja +++ b/template/project_setup.md.jinja @@ -73,7 +73,7 @@ help you decide which tool to use for packaging. - `sonar-project.properties` is the SonarCloud [configuration](https://docs.sonarqube.org/latest/analysis/analysis-parameters/) file - `.github/workflows/sonarcloud.yml` is the GitHub action workflow which performs the SonarCloud analysis -{%- endif -%} +{%- endif %} ## Package version number @@ -100,14 +100,14 @@ help you decide which tool to use for packaging. - To allow others to cite your software, add a `CITATION.cff` file - It only makes sense to do this once there is something to cite (e.g., a software release with a DOI). - Follow the [making software citable](https://guide.esciencecenter.nl/#/citable_software/making_software_citable) section in the guide. -{%- endif -%} +{%- endif %} {% if AddCodeConduct -%} ## CODE_OF_CONDUCT.md - Information about how to behave professionally - [Relevant section in the guide](https://guide.esciencecenter.nl/#/best_practices/documentation?id=code-of-conduct) -{%- endif -%} +{%- endif %} ## CONTRIBUTING.md From 74ac2314e85cf0ccdf3b95d99ab8a13b6a3501ad Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Fri, 23 Aug 2024 14:17:09 +0200 Subject: [PATCH 156/285] Add dev doc question --- copier.yml | 6 ++++++ template/CONTRIBUTING.md.jinja | 2 ++ ...nja => {% if AddDevDoc %}README.dev.md{% endif %}.jinja} | 0 3 files changed, 8 insertions(+) rename template/{README.dev.md.jinja => {% if AddDevDoc %}README.dev.md{% endif %}.jinja} (100%) diff --git a/copier.yml b/copier.yml index f478764c..22259f89 100644 --- a/copier.yml +++ b/copier.yml @@ -120,6 +120,12 @@ AddSonarCloud: default: "{{ template_profile != 'minimum' }}" help: Add SonarCloud (code analysis service) integration? +AddDevDoc: + when: "{{ template_profile == 'ask' }}" + type: bool + default: "{{ template_profile != 'minimum' }}" + help: Add developer documentation? + # internal fields _subdirectory: template diff --git a/template/CONTRIBUTING.md.jinja b/template/CONTRIBUTING.md.jinja index 51a953b8..b3675d22 100644 --- a/template/CONTRIBUTING.md.jinja +++ b/template/CONTRIBUTING.md.jinja @@ -31,7 +31,9 @@ The sections below outline the steps in each case. 1. (**important**) announce your plan to the rest of the community *before you start working*. This announcement should be in the form of a (new) issue; 1. (**important**) wait until some kind of consensus is reached about your idea being a good idea; 1. if needed, fork the repository to your own Github profile and create your own feature branch off of the latest main commit. While working on your feature branch, make sure to stay up to date with the main branch by pulling in changes, possibly from the 'upstream' repository (follow the instructions [here](https://help.github.com/articles/configuring-a-remote-for-a-fork/) and [here](https://help.github.com/articles/syncing-a-fork/)); +{% if AddDevDoc -%} 1. install dependencies (see the [development documentation](README.dev.md#development_install)); +{%- endif %} 1. make sure the existing tests still work by running ``pytest``; 1. add your own tests (if necessary); 1. update or expand the documentation; diff --git a/template/README.dev.md.jinja b/template/{% if AddDevDoc %}README.dev.md{% endif %}.jinja similarity index 100% rename from template/README.dev.md.jinja rename to template/{% if AddDevDoc %}README.dev.md{% endif %}.jinja From 62b8747fb642c5caacac04e9748d83f7b3306c67 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Fri, 23 Aug 2024 14:20:14 +0200 Subject: [PATCH 157/285] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2871540f..b52fe2ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased ### Added +* Make developer documentation optional [#467](https://github.com/NLeSC/python-template/pull/541) * Make zenodo next step instructions optional [#520](https://github.com/NLeSC/python-template/pull/520) * Make SonarCloud optional [#515](https://github.com/NLeSC/python-template/pull/515) * Make citation optional [#471](https://github.com/NLeSC/python-template/pull/471) From 045ac59ded6032fb5654b28bec49b010ebc58f4f Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Fri, 23 Aug 2024 14:29:36 +0200 Subject: [PATCH 158/285] Add if logic --- template/README.md.jinja | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/template/README.md.jinja b/template/README.md.jinja index a85606c5..89c9287b 100644 --- a/template/README.md.jinja +++ b/template/README.md.jinja @@ -26,7 +26,9 @@ {% if AddSonarCloud -%} | SonarCloud | [![sonarcloud]({{repository_url}}/actions/workflows/sonarcloud.yml/badge.svg)]({{repository_url}}/actions/workflows/sonarcloud.yml) | {%- endif -%} -| MarkDown link checker | [![markdown-link-check]({{repository_url}}/actions/workflows/markdown-link-check.yml/badge.svg)]({{repository_url}}/actions/workflows/markdown-link-check.yml) | +{% if AddLinkCheck -%} +| Link checker | [![link-check]({{repository_url}}/actions/workflows/link-check.yml/badge.svg)]({{repository_url}}/actions/workflows/link-check.yml) | +{%- endif -%} ## How to use {{ package_name }} From 72c85eb013ef56e8eec26d1647ad3e6b17b9dd02 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Fri, 23 Aug 2024 15:44:07 +0200 Subject: [PATCH 159/285] Add contributing question --- copier.yml | 6 ++++++ template/README.md.jinja | 2 ++ template/project_setup.md.jinja | 2 ++ ...% if AddContribution %}CONTRIBUTING.md{% endif %}.jinja} | 0 4 files changed, 10 insertions(+) rename template/{CONTRIBUTING.md.jinja => {% if AddContribution %}CONTRIBUTING.md{% endif %}.jinja} (100%) diff --git a/copier.yml b/copier.yml index f478764c..70ee6328 100644 --- a/copier.yml +++ b/copier.yml @@ -120,6 +120,12 @@ AddSonarCloud: default: "{{ template_profile != 'minimum' }}" help: Add SonarCloud (code analysis service) integration? +AddContributing: + when: "{{ template_profile == 'ask' }}" + type: bool + default: "{{ template_profile != 'minimum' }}" + help: Add contributing guidelines? + # internal fields _subdirectory: template diff --git a/template/README.md.jinja b/template/README.md.jinja index a85606c5..91669afd 100644 --- a/template/README.md.jinja +++ b/template/README.md.jinja @@ -48,10 +48,12 @@ python -m pip install . Include a link to your project's full documentation here. +{% if AddContributing -%} ## Contributing If you want to contribute to the development of {{ package_name }}, have a look at the [contribution guidelines](CONTRIBUTING.md). +{%- endif %} ## Credits diff --git a/template/project_setup.md.jinja b/template/project_setup.md.jinja index 72e4be95..15a58293 100644 --- a/template/project_setup.md.jinja +++ b/template/project_setup.md.jinja @@ -107,10 +107,12 @@ help you decide which tool to use for packaging. - Information about how to behave professionally - [Relevant section in the guide](https://guide.esciencecenter.nl/#/best_practices/documentation?id=code-of-conduct) +{% if AddContributing -%} ## CONTRIBUTING.md - Information about how to contribute to this software package - [Relevant section in the guide](https://guide.esciencecenter.nl/#/best_practices/documentation?id=contribution-guidelines) +{%- endif %} ## MANIFEST.in diff --git a/template/CONTRIBUTING.md.jinja b/template/{% if AddContribution %}CONTRIBUTING.md{% endif %}.jinja similarity index 100% rename from template/CONTRIBUTING.md.jinja rename to template/{% if AddContribution %}CONTRIBUTING.md{% endif %}.jinja From e4c9467593068b64dc4bc6dc062c317b47c5c514 Mon Sep 17 00:00:00 2001 From: fdiblen <144492+fdiblen@users.noreply.github.com> Date: Fri, 23 Aug 2024 16:39:49 +0200 Subject: [PATCH 160/285] Update copier.yml Co-authored-by: Olga Lyashevska --- copier.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier.yml b/copier.yml index 8f037049..034b241b 100644 --- a/copier.yml +++ b/copier.yml @@ -7,7 +7,7 @@ !include copier/profiles.yml --- -# questions about the package details +# essential questions about the package details !include copier/questions/essential.yml --- From 8ef8708812e293ffca8c29bb0d4ca2a9156b8041 Mon Sep 17 00:00:00 2001 From: fdiblen <144492+fdiblen@users.noreply.github.com> Date: Fri, 23 Aug 2024 16:40:06 +0200 Subject: [PATCH 161/285] Update copier.yml Co-authored-by: Olga Lyashevska --- copier.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier.yml b/copier.yml index 034b241b..c6ac62f5 100644 --- a/copier.yml +++ b/copier.yml @@ -11,7 +11,7 @@ !include copier/questions/essential.yml --- -# questions about the package details +# additional questions about the package details !include copier/questions/package_details.yml --- From 35b6d98f27dcffe67be773d7ca6af17569863378 Mon Sep 17 00:00:00 2001 From: fdiblen <144492+fdiblen@users.noreply.github.com> Date: Fri, 23 Aug 2024 16:40:25 +0200 Subject: [PATCH 162/285] Update copier/questions/features.yml Co-authored-by: Olga Lyashevska --- copier/questions/features.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier/questions/features.yml b/copier/questions/features.yml index 1754867f..8c6654da 100644 --- a/copier/questions/features.yml +++ b/copier/questions/features.yml @@ -4,7 +4,7 @@ addExtraFeatures: type: bool default: yes help: Do you want to add extra features? - when: "{{ template_profile == 'ask'}}" + when: "{{ template_profile == 'ask' }}" AddLinkCheck: when: "{{ template_profile == 'ask' }}" type: bool From e5fd6459c07d64291358f38ef961eac8eece6c8c Mon Sep 17 00:00:00 2001 From: fdiblen <144492+fdiblen@users.noreply.github.com> Date: Fri, 23 Aug 2024 16:40:39 +0200 Subject: [PATCH 163/285] Update copier/questions/features.yml Co-authored-by: Olga Lyashevska --- copier/questions/features.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier/questions/features.yml b/copier/questions/features.yml index 8c6654da..00219087 100644 --- a/copier/questions/features.yml +++ b/copier/questions/features.yml @@ -14,7 +14,7 @@ AddGitHubActions: when: "{{ template_profile == 'ask' }}" type: bool default: "{{ template_profile != 'minimum' }}" - help: GitHub actions to test the package and the documentation + help: Do you want to add GitHub actions to test the package and the documentation? AddCitation: when: "{{ template_profile == 'ask' }}" type: bool From 24e5cce6a134890e7081acec91313c467aaad8c4 Mon Sep 17 00:00:00 2001 From: fdiblen <144492+fdiblen@users.noreply.github.com> Date: Fri, 23 Aug 2024 17:01:55 +0200 Subject: [PATCH 164/285] Update copier/questions/package_details.yml Co-authored-by: Olga Lyashevska --- copier/questions/package_details.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier/questions/package_details.yml b/copier/questions/package_details.yml index bacdbeac..81af499e 100644 --- a/copier/questions/package_details.yml +++ b/copier/questions/package_details.yml @@ -8,7 +8,7 @@ AddPackageDetails: package_short_description: type: str placeholder: Short description - help: Short description of package + help: Provide a short description of package. when: "{{ template_profile != 'minimum' and AddPackageDetails }}" keyword1: type: str From 6f58f48dce96a7e4ca4b1888896134707e9a0a01 Mon Sep 17 00:00:00 2001 From: fdiblen <144492+fdiblen@users.noreply.github.com> Date: Fri, 23 Aug 2024 17:02:07 +0200 Subject: [PATCH 165/285] Update copier/questions/package_details.yml Co-authored-by: Olga Lyashevska --- copier/questions/package_details.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier/questions/package_details.yml b/copier/questions/package_details.yml index 81af499e..ce93c7e2 100644 --- a/copier/questions/package_details.yml +++ b/copier/questions/package_details.yml @@ -38,7 +38,7 @@ email: code_of_conduct_email: type: str placeholder: yourname@esciencecenter.nl - help: What is the email address cor code of conduct? + help: What is the email address of code of conduct? when: "{{ template_profile != 'minimum' and AddPackageDetails }}" copyright_holder: type: str From 8bbfa2c829fedb3640479d3b7fbca140bbef148b Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Fri, 23 Aug 2024 17:23:07 +0200 Subject: [PATCH 166/285] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2871540f..76442a72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased ### Added +* Make contributing guidelines optional [#465]() * Make zenodo next step instructions optional [#520](https://github.com/NLeSC/python-template/pull/520) * Make SonarCloud optional [#515](https://github.com/NLeSC/python-template/pull/515) * Make citation optional [#471](https://github.com/NLeSC/python-template/pull/471) From b5052b7426f6b4b6a65f88d9c4de2b338ac54693 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Fri, 23 Aug 2024 19:08:00 +0200 Subject: [PATCH 167/285] Fix next_steps --- template/next_steps.md.jinja | 2 ++ 1 file changed, 2 insertions(+) diff --git a/template/next_steps.md.jinja b/template/next_steps.md.jinja index 8d0aa499..152b7d52 100644 --- a/template/next_steps.md.jinja +++ b/template/next_steps.md.jinja @@ -38,9 +38,11 @@ A short while after you push your commits to GitHub for the first time, a few is automatically ([here]({{repository_url}}/issues?q=author%3Aapp%2Fgithub-actions)). Resolve them to complete the setup of your repository. +{% if AddDevDoc -%} ## Project development documentation The [README.dev.md](README.dev.md) contains developer documentation. +{%- endif %} ## Project layout explained From 3c74c6076ca7c5ca27c250c3f610dfba6428b6ba Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Fri, 23 Aug 2024 19:54:04 +0200 Subject: [PATCH 168/285] Fix broken link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 344f45dc..fc214a77 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Use this [Copier](https://copier.readthedocs.io) template to generate an empty P |   |   | | **GitHub Actions** |   | | Citation metadata consistency | [![cffconvert](https://github.com/nlesc/python-template/actions/workflows/cffconvert.yml/badge.svg)](https://github.com/nlesc/python-template/actions/workflows/cffconvert.yml) | -| MarkDown link checker | [![markdown-link-check](https://github.com/nlesc/python-template/actions/workflows/markdown-link-check.yml/badge.svg)](https://github.com/nlesc/python-template/actions/workflows/markdown-link-check.yml) | +| Link checker | [![link-check](https://github.com/nlesc/python-template/actions/workflows/link-check.yml/badge.svg)](https://github.com/nlesc/python-template/actions/workflows/link-check.yml) | | Tests | [![tests](https://github.com/nlesc/python-template/actions/workflows/tests.yml/badge.svg)](https://github.com/nlesc/python-template/actions/workflows/tests.yml) | ## How to use From bb2dbf06cc2849cda29fa1106bf3a51b4c15631f Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Fri, 23 Aug 2024 21:21:44 +0200 Subject: [PATCH 169/285] add a category for code quality --- copier/questions/features_code_quality.yml | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 copier/questions/features_code_quality.yml diff --git a/copier/questions/features_code_quality.yml b/copier/questions/features_code_quality.yml new file mode 100644 index 00000000..57b433e6 --- /dev/null +++ b/copier/questions/features_code_quality.yml @@ -0,0 +1,24 @@ +--- +# Questions for code quality features +SelectCodeQualityFeatures: + when: "{{ template_profile != 'minimum' }}" + type: str + default: [] + help: Select code quality features + multiselect: true + choices: + GitHub Actions: + value: select_github_actions_flag + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" + Linting (using ruff NOT_IMPLEMENTED): + value: not_implemented_linting + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" + Pre-commit: + value: AddPreCommit + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" + Code analysis (using SonarCloud): + value: AddSonarCloud + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" + Editorconfig (NOT_IMPLEMENTED): + value: not_implemented_editor_config + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" From 7282976a91f685647e95dfe639769034aede14e6 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Fri, 23 Aug 2024 21:22:22 +0200 Subject: [PATCH 170/285] make category type yaml --- copier/questions/features_code_quality.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier/questions/features_code_quality.yml b/copier/questions/features_code_quality.yml index 57b433e6..3fc72763 100644 --- a/copier/questions/features_code_quality.yml +++ b/copier/questions/features_code_quality.yml @@ -2,7 +2,7 @@ # Questions for code quality features SelectCodeQualityFeatures: when: "{{ template_profile != 'minimum' }}" - type: str + type: yaml default: [] help: Select code quality features multiselect: true From e7a3d73d1ddba71d9ee8b6e53e12bcd2db1a80e1 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Fri, 23 Aug 2024 21:23:09 +0200 Subject: [PATCH 171/285] add a list of pre-selected features for recommended profile --- copier/questions/features_code_quality.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/copier/questions/features_code_quality.yml b/copier/questions/features_code_quality.yml index 3fc72763..3d330cd8 100644 --- a/copier/questions/features_code_quality.yml +++ b/copier/questions/features_code_quality.yml @@ -3,7 +3,12 @@ SelectCodeQualityFeatures: when: "{{ template_profile != 'minimum' }}" type: yaml - default: [] + default: |- + {% if template_profile == 'recommended' %} + [select_github_actions_flag, not_implemented_linting, AddSonarCloud, not_implemented_editor_config] + {%- else -%} + [] + {%- endif %} help: Select code quality features multiselect: true choices: From da8e2368ddd0788d453ad8fbab322e0be09a0c48 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Fri, 23 Aug 2024 21:25:54 +0200 Subject: [PATCH 172/285] add a sub-menu to select GitHub Actions --- copier/questions/features_code_quality.yml | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/copier/questions/features_code_quality.yml b/copier/questions/features_code_quality.yml index 3d330cd8..f26b9000 100644 --- a/copier/questions/features_code_quality.yml +++ b/copier/questions/features_code_quality.yml @@ -27,3 +27,26 @@ SelectCodeQualityFeatures: Editorconfig (NOT_IMPLEMENTED): value: not_implemented_editor_config # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" + +# split AddGitHubActions --> enable_github_actions_build and enable_github_actions_documentation +SelectGitHubActions: + when: "{{ 'select_github_actions_flag' in SelectCodeQualityFeatures }}" + type: yaml + default: |- + {% if template_profile == 'recommended' %} + [not_implemented_enable_github_actions_build, not_implemented_enable_github_actions_documentation] + {%- else -%} + [] + {%- endif %} + help: Select GitHub Action workflows + multiselect: true + choices: + Build (NOT_IMPLEMENTED): + value: not_implemented_enable_github_actions_build + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" + Documentation (NOT_IMPLEMENTED): + value: not_implemented_enable_github_actions_documentation + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" + Link checker (reports broken URLs): + value: AddLinkCheck + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" From fd4ec0174e347f0fd24f465919e4319a5069b745 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Fri, 23 Aug 2024 21:33:05 +0200 Subject: [PATCH 173/285] remove code quality questions from questions/features.yml --- copier/questions/features.yml | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/copier/questions/features.yml b/copier/questions/features.yml index c5c6e185..a6aca098 100644 --- a/copier/questions/features.yml +++ b/copier/questions/features.yml @@ -5,21 +5,6 @@ addExtraFeatures: default: yes help: Do you want to add extra features? when: "{{ template_profile == 'ask' }}" -AddLinkCheck: - when: "{{ template_profile == 'ask' }}" - type: bool - default: "{{ template_profile != 'minimum' }}" - help: Do you want to add a GitHub action to check broken links? -AddGitHubActions: - when: "{{ template_profile == 'ask' }}" - type: bool - default: "{{ template_profile != 'minimum' }}" - help: Do you want to add GitHub actions to test the package and the documentation? -AddCitation: - when: "{{ template_profile == 'ask' }}" - type: bool - default: "{{ template_profile != 'minimum' }}" - help: Citation file and cffconvert workflow which validates the citation file AddChangeLog: when: "{{ template_profile == 'ask' }}" type: bool @@ -30,21 +15,11 @@ AddOnlineDocumentation: type: bool default: "{{ template_profile != 'minimum' }}" help: Online documentation using Read the Docs -AddPreCommit: - when: "{{ template_profile == 'ask' }}" - type: bool - default: "{{ template_profile != 'minimum' }}" - help: Add pre-commit hook to check code style and format on every commit? AddZenodo: when: "{{ template_profile == 'ask' }}" type: bool default: "{{ template_profile != 'minimum' }}" help: Create a GitHub issue on how to enable Zenodo integration? -AddSonarCloud: - when: "{{ template_profile == 'ask' }}" - type: bool - default: "{{ template_profile != 'minimum' }}" - help: Add SonarCloud (code analysis service) integration? AddCodeConduct: when: "{{ template_profile == 'ask' }}" type: bool From f1dab0df83b762b5fd6cb16eae16d3dace623a02 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Fri, 23 Aug 2024 21:37:20 +0200 Subject: [PATCH 174/285] add TODO for AddGitHubActions --- copier/questions/features_code_quality.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier/questions/features_code_quality.yml b/copier/questions/features_code_quality.yml index f26b9000..cd6747ea 100644 --- a/copier/questions/features_code_quality.yml +++ b/copier/questions/features_code_quality.yml @@ -28,7 +28,7 @@ SelectCodeQualityFeatures: value: not_implemented_editor_config # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" -# split AddGitHubActions --> enable_github_actions_build and enable_github_actions_documentation +# TODO: split AddGitHubActions --> enable_github_actions_build and enable_github_actions_documentation SelectGitHubActions: when: "{{ 'select_github_actions_flag' in SelectCodeQualityFeatures }}" type: yaml From 0672cbbb34c816f88f9f6bd11140f8bc366e67bc Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Fri, 23 Aug 2024 21:46:57 +0200 Subject: [PATCH 175/285] add a category for documentation --- copier/questions/features.yml | 5 ---- copier/questions/features_documentation.yml | 26 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 copier/questions/features_documentation.yml diff --git a/copier/questions/features.yml b/copier/questions/features.yml index a6aca098..a5a8ffb2 100644 --- a/copier/questions/features.yml +++ b/copier/questions/features.yml @@ -30,8 +30,3 @@ AddContributing: type: bool default: "{{ template_profile != 'minimum' }}" help: Add contributing guidelines? -AddDevDoc: - when: "{{ template_profile == 'ask' }}" - type: bool - default: "{{ template_profile != 'minimum' }}" - help: Add developer documentation? diff --git a/copier/questions/features_documentation.yml b/copier/questions/features_documentation.yml new file mode 100644 index 00000000..fd9f535d --- /dev/null +++ b/copier/questions/features_documentation.yml @@ -0,0 +1,26 @@ +--- +# Questions for documentation features +SelectDocumentationFeatures: + when: "{{ template_profile != 'minimum' }}" + type: yaml + default: |- + {% if template_profile == 'recommended' %} + [AddOnlineDocumentation, AddDevDoc, not_implemented_project_setup] + {%- else -%} + [] + {%- endif %} + help: Select documentation features + multiselect: true + choices: + Online documentation (using Read the Docs): + value: AddOnlineDocumentation + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" + Developer documentation: + value: AddDevDoc + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" + Project setup description (NOT_IMPLEMENTED): + value: not_implemented_project_setup + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" + Markdown link checker GitHub Action (NOT_IMPLEMENTED): + value: not_implemented_markdown_link_checker + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" From b27e12221208e9f8715bc78a9fb681bf77a72064 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Fri, 23 Aug 2024 21:49:24 +0200 Subject: [PATCH 176/285] add a category for community --- copier/questions/features_community.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 copier/questions/features_community.yml diff --git a/copier/questions/features_community.yml b/copier/questions/features_community.yml new file mode 100644 index 00000000..c30edf6b --- /dev/null +++ b/copier/questions/features_community.yml @@ -0,0 +1,20 @@ +--- +# Questions for community features +SelectCommunityFeatures: + when: "{{ template_profile != 'minimum' }}" + type: yaml + default: |- + {% if template_profile == 'recommended' %} + [AddCodeConduct, AddContributing] + {%- else -%} + [] + {%- endif %} + help: Select documentation features + multiselect: true + choices: + Code of conduct: + value: AddCodeConduct + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" + Contributing guidelines: + value: AddContributing + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" From 0e6e210553aa975a0d10cfbcf3119b65a1e4a71b Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Fri, 23 Aug 2024 21:55:08 +0200 Subject: [PATCH 177/285] add a category for publish and release --- copier/questions/features.yml | 32 ------------- copier/questions/features_publish_release.yml | 47 +++++++++++++++++++ 2 files changed, 47 insertions(+), 32 deletions(-) delete mode 100644 copier/questions/features.yml create mode 100644 copier/questions/features_publish_release.yml diff --git a/copier/questions/features.yml b/copier/questions/features.yml deleted file mode 100644 index a5a8ffb2..00000000 --- a/copier/questions/features.yml +++ /dev/null @@ -1,32 +0,0 @@ ---- -# Questions for features -addExtraFeatures: - type: bool - default: yes - help: Do you want to add extra features? - when: "{{ template_profile == 'ask' }}" -AddChangeLog: - when: "{{ template_profile == 'ask' }}" - type: bool - default: "{{ template_profile != 'minimum' }}" - help: Add a change log to keep track of changes in the package -AddOnlineDocumentation: - when: "{{ template_profile == 'ask' }}" - type: bool - default: "{{ template_profile != 'minimum' }}" - help: Online documentation using Read the Docs -AddZenodo: - when: "{{ template_profile == 'ask' }}" - type: bool - default: "{{ template_profile != 'minimum' }}" - help: Create a GitHub issue on how to enable Zenodo integration? -AddCodeConduct: - when: "{{ template_profile == 'ask' }}" - type: bool - default: "{{ template_profile != 'minimum' }}" - help: Add code of conduct? -AddContributing: - when: "{{ template_profile == 'ask' }}" - type: bool - default: "{{ template_profile != 'minimum' }}" - help: Add contributing guidelines? diff --git a/copier/questions/features_publish_release.yml b/copier/questions/features_publish_release.yml new file mode 100644 index 00000000..bc9a331b --- /dev/null +++ b/copier/questions/features_publish_release.yml @@ -0,0 +1,47 @@ +--- +# Questions for publishing and releasing features +SelectPublishReleaseFeatures: + when: "{{ template_profile != 'minimum' }}" + type: yaml + default: |- + {% if template_profile == 'recommended' %} + [select_citation_flag, AddZenodo] + {%- else -%} + [] + {%- endif %} + help: Select publish and release features + multiselect: true + choices: + Citation: + value: select_citation_flag + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" + Changelog: + value: AddChangeLog + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" + Zenodo integration instructions: + value: AddZenodo + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" + Package keywords(NOT_IMPLEMENTED): + value: not_implemented_keywords + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" + + +# split AddCitation --> enable_citation_file and enable_cffconvert +SelectCitation: + when: "{{ 'select_citation_flag' in SelectPublishReleaseFeatures }}" + type: yaml + default: |- + {% if template_profile == 'recommended' %} + [enable_citation_file, enable_cffconvert] + {%- else -%} + [] + {%- endif %} + help: Select GitHub Action workflows + multiselect: true + choices: + CITATION.cff file (NOT_IMPLEMENTED): + value: enable_citation_file + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" + cffconvert GitHub Action (NOT_IMPLEMENTED): + value: enable_cffconvert + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" From 3f9542ed0d3d9206c3eea4eb5197f5769c94f0dc Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Fri, 23 Aug 2024 21:58:01 +0200 Subject: [PATCH 178/285] include feature yaml file in copier.yml --- copier.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/copier.yml b/copier.yml index c6ac62f5..398a557d 100644 --- a/copier.yml +++ b/copier.yml @@ -15,8 +15,20 @@ !include copier/questions/package_details.yml --- -# Features -!include copier/questions/features.yml +# code quality +!include copier/questions/features_code_quality.yml + +--- +# publish and release +!include copier/questions/features_publish_release.yml + +--- +# publish and release +!include copier/questions/features_documentation.yml + +--- +# community +!include copier/questions/features_community.yml --- # User messages From c8ddd59ead7a39105f08ec0aa16aa67def254803 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Fri, 23 Aug 2024 22:01:38 +0200 Subject: [PATCH 179/285] add a validator for package version --- copier/questions/essential.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/copier/questions/essential.yml b/copier/questions/essential.yml index 92db3154..ba047e75 100644 --- a/copier/questions/essential.yml +++ b/copier/questions/essential.yml @@ -12,6 +12,10 @@ version: type: str placeholder: 0.1.0 help: Enter the version of the Python package + validator: >- + {% if not (package_name | regex_search('^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$')) %} + Package version should use Semantic Versioning 2.0.0 (MAJOR.MINOR.PATCH) + {% endif %} license: type: str choices: From 2662932cefe376560889a56c6667ad861cd30623 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Fri, 23 Aug 2024 22:03:35 +0200 Subject: [PATCH 180/285] make full name an essential question --- copier/questions/essential.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/copier/questions/essential.yml b/copier/questions/essential.yml index ba047e75..8bd1bd2a 100644 --- a/copier/questions/essential.yml +++ b/copier/questions/essential.yml @@ -16,6 +16,10 @@ version: {% if not (package_name | regex_search('^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$')) %} Package version should use Semantic Versioning 2.0.0 (MAJOR.MINOR.PATCH) {% endif %} +full_name: + type: str + placeholder: Jane Smith + help: Enter your full name license: type: str choices: From d8f98d925907ac75b5f0aba729e22107324174a8 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Fri, 23 Aug 2024 22:04:47 +0200 Subject: [PATCH 181/285] update help text and condition for package detail questions --- copier/questions/package_details.yml | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/copier/questions/package_details.yml b/copier/questions/package_details.yml index ce93c7e2..301a5495 100644 --- a/copier/questions/package_details.yml +++ b/copier/questions/package_details.yml @@ -8,43 +8,38 @@ AddPackageDetails: package_short_description: type: str placeholder: Short description - help: Provide a short description of package. + help: Short description of package when: "{{ template_profile != 'minimum' and AddPackageDetails }}" keyword1: type: str placeholder: keyword1 help: Add keyword1 - when: "{{ template_profile != 'minimum' and AddPackageDetails }}" + when: "{{ template_profile != 'minimum' and AddPackageDetails }}" keyword2: type: str placeholder: keyword2 help: Add keyword2 - when: "{{ template_profile != 'minimum' and AddPackageDetails }}" + when: "{{ template_profile != 'minimum' and AddPackageDetails }}" github_organization: type: str placeholder: "" help: Enter the name of your GitHub username or organization - when: "{{ template_profile != 'minimum' and AddPackageDetails }}" -full_name: - type: str - placeholder: Jane Smith - help: Enter your full name - when: "{{ template_profile != 'minimum' and AddPackageDetails }}" + when: "{{ template_profile != 'minimum' and AddPackageDetails }}" email: type: str placeholder: yourname@esciencecenter.nl help: What is your email address? - when: "{{ template_profile != 'minimum' and AddPackageDetails }}" + when: "{{ template_profile != 'minimum' and AddPackageDetails }}" code_of_conduct_email: type: str placeholder: yourname@esciencecenter.nl - help: What is the email address of code of conduct? - when: "{{ template_profile != 'minimum' and AddPackageDetails }}" + help: What is the email address cor code of conduct? + when: "{{ template_profile != 'minimum' and AddPackageDetails }}" copyright_holder: type: str placeholder: Netherlands eScience Center help: Who is the copyright holder? - when: "{{ template_profile != 'minimum' and AddPackageDetails }}" + when: "{{ template_profile != 'minimum' and AddPackageDetails }}" # calculated fields for GitHub repository: From 7fd5c175c3ac9d07abbbf271daa14d04b4faf5da Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Fri, 23 Aug 2024 22:09:14 +0200 Subject: [PATCH 182/285] fix the version validator --- copier/questions/essential.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier/questions/essential.yml b/copier/questions/essential.yml index 8bd1bd2a..f4e2e9ea 100644 --- a/copier/questions/essential.yml +++ b/copier/questions/essential.yml @@ -13,7 +13,7 @@ version: placeholder: 0.1.0 help: Enter the version of the Python package validator: >- - {% if not (package_name | regex_search('^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$')) %} + {% if not (version | regex_search('^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$')) %} Package version should use Semantic Versioning 2.0.0 (MAJOR.MINOR.PATCH) {% endif %} full_name: From cafb6500716621b4da33f01425f2eefbfcabf33b Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Fri, 23 Aug 2024 22:17:08 +0200 Subject: [PATCH 183/285] use a default value for version --- copier/questions/essential.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier/questions/essential.yml b/copier/questions/essential.yml index f4e2e9ea..6171d574 100644 --- a/copier/questions/essential.yml +++ b/copier/questions/essential.yml @@ -10,7 +10,7 @@ package_name: {% endif %} version: type: str - placeholder: 0.1.0 + default: 0.1.0 help: Enter the version of the Python package validator: >- {% if not (version | regex_search('^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$')) %} From ce00ad2da76c70b45beab979a7f8ad28ebb35cf6 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 15:21:42 +0200 Subject: [PATCH 184/285] disable CITATION.cff in test_bumpversion --- tests/test_project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_project.py b/tests/test_project.py index 45118ded..eb989b42 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -212,6 +212,6 @@ def test_bumpversion(baked_with_development_dependencies, project_env_bin_dir): assert '' in result.stdout expected_version = '1.0.0' assert expected_version in (project_dir / 'pyproject.toml').read_text('utf-8') - assert expected_version in (project_dir / 'CITATION.cff').read_text('utf-8') + # assert expected_version in (project_dir / 'CITATION.cff').read_text('utf-8') assert expected_version in (project_dir / 'src' / 'my_python_package' / '__init__.py').read_text('utf-8') assert expected_version in (project_dir / 'docs' / 'conf.py').read_text('utf-8') From bf1805ce52624e7a6abdcd0df8e33384b974fd42 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 15:28:53 +0200 Subject: [PATCH 185/285] build and tests run in separate workflows. Only last three Python versions are used. --- .github/workflows/build.yml | 34 ++++++++++++++++++++++++++++++++++ .github/workflows/tests.yml | 8 ++------ 2 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..64aade12 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,34 @@ +name: build + +on: + push: + branches: + - main + pull_request: + branches: + - main +jobs: + + tests: + name: Run template tests + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] + python-version: ['3.10', '3.11', '3.12'] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Python info + shell: bash -e {0} + run: | + which python + python --version + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools + python -m pip install .[dev] diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f709f3d0..8c74ba21 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,10 +13,10 @@ jobs: name: Run template tests runs-on: ${{ matrix.os }} strategy: - fail-fast: false + fail-fast: true matrix: os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: ['3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} @@ -28,10 +28,6 @@ jobs: run: | which python python --version - - name: Install dependencies - run: | - python -m pip install --upgrade pip setuptools - python -m pip install .[dev] - name: Run pytest run: | python -m pytest -v --durations=0 From 106b9502dc6ac851bf59ce3a4929164d5cd420ef Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Mon, 26 Aug 2024 15:40:55 +0200 Subject: [PATCH 186/285] Add changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce14ec11..24e904ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ * Make online documentation optional [#476](https://github.com/NLeSC/python-template/pull/476) ### Changed - +* Fix broken link checker [#546](https://github.com/NLeSC/python-template/pull/546) * pre-commit script is optional ([#457](https://github.com/NLeSC/python-template/issues/457)) * CHANGELOG.md is now optional ([#462](https://github.com/NLeSC/python-template/issues/462)) From 73092a9d6d6cfa2d071ebe549718b4cf237dae10 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 15:47:57 +0200 Subject: [PATCH 187/285] remove Python 3.8 and 3.9 from setup.cfg --- setup.cfg | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index 67b1efdd..ef1b53ab 100644 --- a/setup.cfg +++ b/setup.cfg @@ -12,8 +12,6 @@ classifiers = License :: OSI Approved :: Apache Software License Natural Language :: English Programming Language :: Python :: 3 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 Programming Language :: Python :: 3.12 @@ -30,7 +28,7 @@ version = 0.4.0 [options] zip_safe = False include_package_data = True -python_requires = >=3.8 +python_requires = >=3.10 packages = install_requires = copier==9.2.0 From 7d53e8d42aecb6844578c588ac121215b2b32a64 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 15:48:48 +0200 Subject: [PATCH 188/285] remove Python 3.8 and 3.9 from the generated package --- .../workflows/{% if AddGitHubActions %}build.yml{% endif %} | 4 ++-- template/project_setup.md.jinja | 2 -- template/pyproject.toml.jinja | 2 -- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/template/.github/workflows/{% if AddGitHubActions %}build.yml{% endif %} b/template/.github/workflows/{% if AddGitHubActions %}build.yml{% endif %} index 97c648cf..1d4df162 100644 --- a/template/.github/workflows/{% if AddGitHubActions %}build.yml{% endif %} +++ b/template/.github/workflows/{% if AddGitHubActions %}build.yml{% endif %} @@ -14,10 +14,10 @@ jobs: name: Build for (${{ '{{ ' -}} matrix.python-version }}, ${{ '{{ ' -}} matrix.os }}) runs-on: ${{ '{{ ' -}} matrix.os }} strategy: - fail-fast: false + fail-fast: true matrix: os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: ['3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ '{{ ' -}} matrix.python-version }} diff --git a/template/project_setup.md.jinja b/template/project_setup.md.jinja index 3fa94112..6d4a4b46 100644 --- a/template/project_setup.md.jinja +++ b/template/project_setup.md.jinja @@ -11,8 +11,6 @@ checklist](https://guide.esciencecenter.nl/#/best_practices/checklist). This repository is set up with Python versions: -- 3.8 -- 3.9 - 3.10 - 3.11 - 3.12 diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index 2d868d06..1c7062d7 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -24,8 +24,6 @@ classifiers = [ }[license] }}", "Natural Language :: English", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", From 9ed2cf7199f2c0011108cf9291b7f8bdc2cf008a Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 15:54:47 +0200 Subject: [PATCH 189/285] install the dependencies to run the tests --- .github/workflows/tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8c74ba21..7de55161 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,6 +28,10 @@ jobs: run: | which python python --version + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools + python -m pip install .[dev] - name: Run pytest run: | python -m pytest -v --durations=0 From e86d2ad2e3252767a394754a135741fd4a05baf5 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 16:06:01 +0200 Subject: [PATCH 190/285] update the name of the build job --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 64aade12..12767382 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,8 +9,8 @@ on: - main jobs: - tests: - name: Run template tests + build: + name: Run pip install runs-on: ${{ matrix.os }} strategy: fail-fast: true From 55a247dac16d06892e7690b94ad1726ece9e8290 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 16:18:54 +0200 Subject: [PATCH 191/285] disable CITATION.cff in test_bumpversion --- tests/test_project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_project.py b/tests/test_project.py index eb989b42..bd656545 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -203,7 +203,7 @@ def test_bumpversion(baked_with_development_dependencies, project_env_bin_dir): original_version = '0.1.0' assert original_version in (project_dir / 'pyproject.toml').read_text('utf-8') - assert original_version in (project_dir / 'CITATION.cff').read_text('utf-8') + # assert original_version in (project_dir / 'CITATION.cff').read_text('utf-8') assert original_version in (project_dir / 'src' / 'my_python_package' / '__init__.py').read_text('utf-8') assert original_version in (project_dir / 'docs' / 'conf.py').read_text('utf-8') From 6c4e9980ab479dd0703b532f4e36bcb478323558 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 16:46:50 +0200 Subject: [PATCH 192/285] update the changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce14ec11..4c0410a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,12 +14,12 @@ ### Changed +* Droped Python 3.8 and 3.9 support [#551](https://github.com/NLeSC/python-template/pull/551) * pre-commit script is optional ([#457](https://github.com/NLeSC/python-template/issues/457)) * CHANGELOG.md is now optional ([#462](https://github.com/NLeSC/python-template/issues/462)) ### Removed -* ## [0.5.0] From a0d485fef6c591aaf3eb059be650e99af7d78734 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 17:36:12 +0200 Subject: [PATCH 193/285] add a validator for full name --- copier/questions/essential.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/copier/questions/essential.yml b/copier/questions/essential.yml index 6171d574..80855ea6 100644 --- a/copier/questions/essential.yml +++ b/copier/questions/essential.yml @@ -20,6 +20,10 @@ full_name: type: str placeholder: Jane Smith help: Enter your full name + validator: >- + {% if not full_name %} + Name cannot be empty + {% endif %} license: type: str choices: From f03d26f0f40e234c704bd13dac483baf27e944ef Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 17:37:02 +0200 Subject: [PATCH 194/285] add validators for description, github organization and emails --- copier/questions/package_details.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/copier/questions/package_details.yml b/copier/questions/package_details.yml index 301a5495..5dcc0860 100644 --- a/copier/questions/package_details.yml +++ b/copier/questions/package_details.yml @@ -10,6 +10,10 @@ package_short_description: placeholder: Short description help: Short description of package when: "{{ template_profile != 'minimum' and AddPackageDetails }}" + validator: >- + {% if not package_short_description %} + Package description cannot be empty + {% endif %} keyword1: type: str placeholder: keyword1 @@ -25,16 +29,28 @@ github_organization: placeholder: "" help: Enter the name of your GitHub username or organization when: "{{ template_profile != 'minimum' and AddPackageDetails }}" + validator: >- + {% if not github_organization %} + This field cannot be empty + {% endif %} email: type: str placeholder: yourname@esciencecenter.nl help: What is your email address? when: "{{ template_profile != 'minimum' and AddPackageDetails }}" + validator: >- + {% if not (email | regex_search('([A-Za-z0-9]+[.-_])*[A-Za-z0-9]+@[A-Za-z0-9-]+(\.[A-Z|a-z]{2,})+')) %} + Please enter a valid email address + {% endif %} code_of_conduct_email: type: str placeholder: yourname@esciencecenter.nl help: What is the email address cor code of conduct? when: "{{ template_profile != 'minimum' and AddPackageDetails }}" + validator: >- + {% if not (code_of_conduct_email | regex_search('([A-Za-z0-9]+[.-_])*[A-Za-z0-9]+@[A-Za-z0-9-]+(\.[A-Z|a-z]{2,})+')) %} + Please enter a valid email address + {% endif %} copyright_holder: type: str placeholder: Netherlands eScience Center From 3eeeae76baab22c04bca314aeb9eade2d4c9bfc2 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 18:05:32 +0200 Subject: [PATCH 195/285] fix apache 2.0 naming issue --- copier/questions/essential.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/copier/questions/essential.yml b/copier/questions/essential.yml index 80855ea6..54fe971f 100644 --- a/copier/questions/essential.yml +++ b/copier/questions/essential.yml @@ -27,11 +27,11 @@ full_name: license: type: str choices: - - "Apache Software License 2.0" + - "Apache-2.0" - "MIT license" - "BSD license" - "ISC license" - "GNU General Public License v3 or later" - "GNU Lesser General Public License v3 or later" - "Not open source" - default: "Apache Software License 2.0" + default: "Apache-2.0" From 16e970c99442b0c0891757ab369e922016a00410 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 18:27:08 +0200 Subject: [PATCH 196/285] fix the help field of community features --- copier/questions/features_community.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier/questions/features_community.yml b/copier/questions/features_community.yml index c30edf6b..b1267824 100644 --- a/copier/questions/features_community.yml +++ b/copier/questions/features_community.yml @@ -9,7 +9,7 @@ SelectCommunityFeatures: {%- else -%} [] {%- endif %} - help: Select documentation features + help: Select community features multiselect: true choices: Code of conduct: From f40675b5ebf70a2d236c38051092e7e66436fec9 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 18:29:37 +0200 Subject: [PATCH 197/285] fix the typo in code of conduct help field --- copier/questions/package_details.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier/questions/package_details.yml b/copier/questions/package_details.yml index 5dcc0860..342ccc6c 100644 --- a/copier/questions/package_details.yml +++ b/copier/questions/package_details.yml @@ -45,7 +45,7 @@ email: code_of_conduct_email: type: str placeholder: yourname@esciencecenter.nl - help: What is the email address cor code of conduct? + help: What is the email address for code of conduct? when: "{{ template_profile != 'minimum' and AddPackageDetails }}" validator: >- {% if not (code_of_conduct_email | regex_search('([A-Za-z0-9]+[.-_])*[A-Za-z0-9]+@[A-Za-z0-9-]+(\.[A-Z|a-z]{2,})+')) %} From 4afb3939f991d0efef23f3ef59d90104737f8b83 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 19:09:26 +0200 Subject: [PATCH 198/285] use computed values for github actions --- copier/questions/features_code_quality.yml | 30 +++++++++++++------ ...dGitHubActionBuild %}build.yml{% endif %}} | 0 ...umentation %}documentation.yml{% endif %}} | 0 3 files changed, 21 insertions(+), 9 deletions(-) rename template/.github/workflows/{{% if AddGitHubActions %}build.yml{% endif %} => {% if AddGitHubActionBuild %}build.yml{% endif %}} (100%) rename template/.github/workflows/{{% if AddGitHubActions %}documentation.yml{% endif %} => {% if AddGitHubActionDocumentation %}documentation.yml{% endif %}} (100%) diff --git a/copier/questions/features_code_quality.yml b/copier/questions/features_code_quality.yml index cd6747ea..40b2cf12 100644 --- a/copier/questions/features_code_quality.yml +++ b/copier/questions/features_code_quality.yml @@ -5,7 +5,7 @@ SelectCodeQualityFeatures: type: yaml default: |- {% if template_profile == 'recommended' %} - [select_github_actions_flag, not_implemented_linting, AddSonarCloud, not_implemented_editor_config] + [SelectGitHubActions_flag, not_implemented_linting, AddSonarCloud, not_implemented_editor_config] {%- else -%} [] {%- endif %} @@ -13,7 +13,7 @@ SelectCodeQualityFeatures: multiselect: true choices: GitHub Actions: - value: select_github_actions_flag + value: SelectGitHubActions_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" Linting (using ruff NOT_IMPLEMENTED): value: not_implemented_linting @@ -28,25 +28,37 @@ SelectCodeQualityFeatures: value: not_implemented_editor_config # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" -# TODO: split AddGitHubActions --> enable_github_actions_build and enable_github_actions_documentation + SelectGitHubActions: - when: "{{ 'select_github_actions_flag' in SelectCodeQualityFeatures }}" + when: "{{ 'SelectGitHubActions_flag' in SelectCodeQualityFeatures }}" type: yaml default: |- {% if template_profile == 'recommended' %} - [not_implemented_enable_github_actions_build, not_implemented_enable_github_actions_documentation] + [AddGitHubActionBuild, AddGitHubActionDocumentation] {%- else -%} [] {%- endif %} help: Select GitHub Action workflows multiselect: true choices: - Build (NOT_IMPLEMENTED): - value: not_implemented_enable_github_actions_build + Build: + value: AddGitHubActionBuild_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" - Documentation (NOT_IMPLEMENTED): - value: not_implemented_enable_github_actions_documentation + Documentation: + value: AddGitHubActionDocumentation_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" Link checker (reports broken URLs): value: AddLinkCheck # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" + + +# computed features +AddGitHubActionBuild: + type: bool + default: "{{ 'AddGitHubActionBuild_flag' in SelectGitHubActions }}" + when: false + +AddGitHubActionDocumentation: + type: bool + default: "{{ 'AddGitHubActionDocumentation_flag' in SelectGitHubActions }}" + when: false diff --git a/template/.github/workflows/{% if AddGitHubActions %}build.yml{% endif %} b/template/.github/workflows/{% if AddGitHubActionBuild %}build.yml{% endif %} similarity index 100% rename from template/.github/workflows/{% if AddGitHubActions %}build.yml{% endif %} rename to template/.github/workflows/{% if AddGitHubActionBuild %}build.yml{% endif %} diff --git a/template/.github/workflows/{% if AddGitHubActions %}documentation.yml{% endif %} b/template/.github/workflows/{% if AddGitHubActionDocumentation %}documentation.yml{% endif %} similarity index 100% rename from template/.github/workflows/{% if AddGitHubActions %}documentation.yml{% endif %} rename to template/.github/workflows/{% if AddGitHubActionDocumentation %}documentation.yml{% endif %} From ac91735363cb5dc6a42cef8197f4a207c6ceb5f4 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 19:13:37 +0200 Subject: [PATCH 199/285] use computed values for link checker github action --- copier/questions/features_code_quality.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/copier/questions/features_code_quality.yml b/copier/questions/features_code_quality.yml index 40b2cf12..60b9f415 100644 --- a/copier/questions/features_code_quality.yml +++ b/copier/questions/features_code_quality.yml @@ -48,7 +48,7 @@ SelectGitHubActions: value: AddGitHubActionDocumentation_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" Link checker (reports broken URLs): - value: AddLinkCheck + value: AddLinkCheck_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" @@ -62,3 +62,8 @@ AddGitHubActionDocumentation: type: bool default: "{{ 'AddGitHubActionDocumentation_flag' in SelectGitHubActions }}" when: false + +AddLinkCheck: + type: bool + default: "{{ 'AddLinkCheck_flag' in SelectGitHubActions }}" + when: false From a7252438451dab0f0da29af6cf1586b6505efd81 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 19:18:37 +0200 Subject: [PATCH 200/285] use computed values for precommit and sonarcloud features --- copier/questions/features_code_quality.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/copier/questions/features_code_quality.yml b/copier/questions/features_code_quality.yml index 60b9f415..47a5cb8a 100644 --- a/copier/questions/features_code_quality.yml +++ b/copier/questions/features_code_quality.yml @@ -1,5 +1,7 @@ --- # Questions for code quality features + +# the main menu SelectCodeQualityFeatures: when: "{{ template_profile != 'minimum' }}" type: yaml @@ -19,16 +21,17 @@ SelectCodeQualityFeatures: value: not_implemented_linting # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" Pre-commit: - value: AddPreCommit + value: AddPreCommit_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" Code analysis (using SonarCloud): - value: AddSonarCloud + value: AddSonarCloud_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" Editorconfig (NOT_IMPLEMENTED): value: not_implemented_editor_config # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" +# Sub-menus SelectGitHubActions: when: "{{ 'SelectGitHubActions_flag' in SelectCodeQualityFeatures }}" type: yaml @@ -67,3 +70,13 @@ AddLinkCheck: type: bool default: "{{ 'AddLinkCheck_flag' in SelectGitHubActions }}" when: false + +AddPreCommit: + type: bool + default: "{{ 'AddPreCommit_flag' in SelectCodeQualityFeatures }}" + when: false + +AddSonarCloud: + type: bool + default: "{{ 'AddSonarCloud_flag' in SelectCodeQualityFeatures }}" + when: false From da7448f54b40dbf300e9d78a1f8efe010d107c37 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 19:20:41 +0200 Subject: [PATCH 201/285] update selected flags for recommended profile --- copier/questions/features_code_quality.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/copier/questions/features_code_quality.yml b/copier/questions/features_code_quality.yml index 47a5cb8a..e85fcdc7 100644 --- a/copier/questions/features_code_quality.yml +++ b/copier/questions/features_code_quality.yml @@ -7,7 +7,7 @@ SelectCodeQualityFeatures: type: yaml default: |- {% if template_profile == 'recommended' %} - [SelectGitHubActions_flag, not_implemented_linting, AddSonarCloud, not_implemented_editor_config] + [SelectGitHubActions_flag, not_implemented_linting, AddSonarCloud_flag, not_implemented_editor_config] {%- else -%} [] {%- endif %} @@ -37,7 +37,7 @@ SelectGitHubActions: type: yaml default: |- {% if template_profile == 'recommended' %} - [AddGitHubActionBuild, AddGitHubActionDocumentation] + [AddGitHubActionBuild_flag, AddGitHubActionDocumentation_flag] {%- else -%} [] {%- endif %} From ad87f5325a5a18c753c248231efd3ef9a0e8d7d1 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 19:26:32 +0200 Subject: [PATCH 202/285] add computed values and flags for community features --- copier/questions/features_community.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/copier/questions/features_community.yml b/copier/questions/features_community.yml index b1267824..802c8daa 100644 --- a/copier/questions/features_community.yml +++ b/copier/questions/features_community.yml @@ -1,11 +1,13 @@ --- # Questions for community features + +# the main menu SelectCommunityFeatures: when: "{{ template_profile != 'minimum' }}" type: yaml default: |- {% if template_profile == 'recommended' %} - [AddCodeConduct, AddContributing] + [AddCodeConduct_flag, AddContributing_flag] {%- else -%} [] {%- endif %} @@ -13,8 +15,19 @@ SelectCommunityFeatures: multiselect: true choices: Code of conduct: - value: AddCodeConduct + value: AddCodeConduct_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" Contributing guidelines: - value: AddContributing + value: AddContributing_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" + +# computed features +AddCodeConduct: + type: bool + default: "{{ 'AddCodeConduct_flag' in SelectCommunityFeatures }}" + when: false + +AddContributing: + type: bool + default: "{{ 'AddContributing_flag' in SelectCommunityFeatures }}" + when: false From 5b651a46fc5e288aab74d342361a36421f6fbc99 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 19:28:29 +0200 Subject: [PATCH 203/285] add computed values and flags for documentation features --- copier/questions/features_documentation.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/copier/questions/features_documentation.yml b/copier/questions/features_documentation.yml index fd9f535d..5893a586 100644 --- a/copier/questions/features_documentation.yml +++ b/copier/questions/features_documentation.yml @@ -1,11 +1,13 @@ --- # Questions for documentation features + +# the main menu SelectDocumentationFeatures: when: "{{ template_profile != 'minimum' }}" type: yaml default: |- {% if template_profile == 'recommended' %} - [AddOnlineDocumentation, AddDevDoc, not_implemented_project_setup] + [AddOnlineDocumentation_flag, AddDevDoc_flag, not_implemented_project_setup] {%- else -%} [] {%- endif %} @@ -13,10 +15,10 @@ SelectDocumentationFeatures: multiselect: true choices: Online documentation (using Read the Docs): - value: AddOnlineDocumentation + value: AddOnlineDocumentation_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" Developer documentation: - value: AddDevDoc + value: AddDevDoc_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" Project setup description (NOT_IMPLEMENTED): value: not_implemented_project_setup @@ -24,3 +26,14 @@ SelectDocumentationFeatures: Markdown link checker GitHub Action (NOT_IMPLEMENTED): value: not_implemented_markdown_link_checker # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" + +# computed features +AddOnlineDocumentation: + type: bool + default: "{{ 'AddOnlineDocumentation_flag' in SelectDocumentationFeatures }}" + when: false + +AddDevDoc: + type: bool + default: "{{ 'AddDevDoc_flag' in SelectDocumentationFeatures }}" + when: false From ba273231ca7453d0f16b7fba6233e276934da65e Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 19:32:47 +0200 Subject: [PATCH 204/285] add computed values and flags for publish and release features --- copier/questions/features_publish_release.yml | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/copier/questions/features_publish_release.yml b/copier/questions/features_publish_release.yml index bc9a331b..8497d0d7 100644 --- a/copier/questions/features_publish_release.yml +++ b/copier/questions/features_publish_release.yml @@ -1,11 +1,13 @@ --- # Questions for publishing and releasing features + +# the main menu SelectPublishReleaseFeatures: when: "{{ template_profile != 'minimum' }}" type: yaml default: |- {% if template_profile == 'recommended' %} - [select_citation_flag, AddZenodo] + [SelectCitation_flag, AddZenodo] {%- else -%} [] {%- endif %} @@ -13,22 +15,23 @@ SelectPublishReleaseFeatures: multiselect: true choices: Citation: - value: select_citation_flag + value: SelectCitation_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" Changelog: - value: AddChangeLog + value: AddChangeLog_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" Zenodo integration instructions: - value: AddZenodo + value: AddZenodo_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" Package keywords(NOT_IMPLEMENTED): value: not_implemented_keywords # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" +# Sub-menus # split AddCitation --> enable_citation_file and enable_cffconvert SelectCitation: - when: "{{ 'select_citation_flag' in SelectPublishReleaseFeatures }}" + when: "{{ 'SelectCitation_flag' in SelectPublishReleaseFeatures }}" type: yaml default: |- {% if template_profile == 'recommended' %} @@ -40,8 +43,20 @@ SelectCitation: multiselect: true choices: CITATION.cff file (NOT_IMPLEMENTED): - value: enable_citation_file + value: AddCitationFile_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" cffconvert GitHub Action (NOT_IMPLEMENTED): - value: enable_cffconvert + value: AddCFFConvert_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" + + +# computed features +AddChangeLog: + type: bool + default: "{{ 'AddChangeLog_flag' in SelectPublishReleaseFeatures }}" + when: false + +AddZenodo: + type: bool + default: "{{ 'AddZenodo_flag' in SelectPublishReleaseFeatures }}" + when: false From 4bf594aadcc512edc048fca5d4f6558e03fd1152 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 19:36:23 +0200 Subject: [PATCH 205/285] fix typo in if condition of CONTRIBUTING.md --- ...a => {% if AddContributing %}CONTRIBUTING.md{% endif %}.jinja} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename template/{{% if AddContribution %}CONTRIBUTING.md{% endif %}.jinja => {% if AddContributing %}CONTRIBUTING.md{% endif %}.jinja} (100%) diff --git a/template/{% if AddContribution %}CONTRIBUTING.md{% endif %}.jinja b/template/{% if AddContributing %}CONTRIBUTING.md{% endif %}.jinja similarity index 100% rename from template/{% if AddContribution %}CONTRIBUTING.md{% endif %}.jinja rename to template/{% if AddContributing %}CONTRIBUTING.md{% endif %}.jinja From 8bbda7c01498d70b8e93bb8277ffbd7ca2e4d3f0 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 19:40:48 +0200 Subject: [PATCH 206/285] implement the logic for citation, add computed values and flags --- copier/questions/features_publish_release.yml | 16 +++++++++++++--- ...if AddCFFConvert %}cffconvert.yml{% endif %}} | 0 2 files changed, 13 insertions(+), 3 deletions(-) rename template/.github/workflows/{{% if AddCitation %}cffconvert.yml{% endif %} => {% if AddCFFConvert %}cffconvert.yml{% endif %}} (100%) diff --git a/copier/questions/features_publish_release.yml b/copier/questions/features_publish_release.yml index 8497d0d7..82372926 100644 --- a/copier/questions/features_publish_release.yml +++ b/copier/questions/features_publish_release.yml @@ -39,18 +39,28 @@ SelectCitation: {%- else -%} [] {%- endif %} - help: Select GitHub Action workflows + help: Select citation features multiselect: true choices: - CITATION.cff file (NOT_IMPLEMENTED): + CITATION.cff file: value: AddCitationFile_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" - cffconvert GitHub Action (NOT_IMPLEMENTED): + cffconvert GitHub Action (to validate CITATION.cff files): value: AddCFFConvert_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" # computed features +AddCitation: + type: bool + default: "{{ 'AddCitationFile_flag' in SelectCitation }}" + when: false + +AddCFFConvert: + type: bool + default: "{{ 'AddCFFConvert_flag' in SelectCitation }}" + when: false + AddChangeLog: type: bool default: "{{ 'AddChangeLog_flag' in SelectPublishReleaseFeatures }}" diff --git a/template/.github/workflows/{% if AddCitation %}cffconvert.yml{% endif %} b/template/.github/workflows/{% if AddCFFConvert %}cffconvert.yml{% endif %} similarity index 100% rename from template/.github/workflows/{% if AddCitation %}cffconvert.yml{% endif %} rename to template/.github/workflows/{% if AddCFFConvert %}cffconvert.yml{% endif %} From 287e8a9e82561019bbff7a1225f9c2e4a340e622 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 19:42:57 +0200 Subject: [PATCH 207/285] update selected flags for recommended profile --- copier/questions/features_publish_release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/copier/questions/features_publish_release.yml b/copier/questions/features_publish_release.yml index 82372926..8f1d027a 100644 --- a/copier/questions/features_publish_release.yml +++ b/copier/questions/features_publish_release.yml @@ -7,7 +7,7 @@ SelectPublishReleaseFeatures: type: yaml default: |- {% if template_profile == 'recommended' %} - [SelectCitation_flag, AddZenodo] + [SelectCitation_flag, AddZenodo_flag] {%- else -%} [] {%- endif %} @@ -35,7 +35,7 @@ SelectCitation: type: yaml default: |- {% if template_profile == 'recommended' %} - [enable_citation_file, enable_cffconvert] + [AddCitationFile_flag, AddCFFConvert_flag] {%- else -%} [] {%- endif %} From 82a5437150dbdc8b8c60406f325bd0eee83d363b Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 19:51:59 +0200 Subject: [PATCH 208/285] remove link checker from the documentation as it already exists under GitHub Actions --- copier/questions/features_documentation.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/copier/questions/features_documentation.yml b/copier/questions/features_documentation.yml index 5893a586..98e61711 100644 --- a/copier/questions/features_documentation.yml +++ b/copier/questions/features_documentation.yml @@ -23,9 +23,6 @@ SelectDocumentationFeatures: Project setup description (NOT_IMPLEMENTED): value: not_implemented_project_setup # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" - Markdown link checker GitHub Action (NOT_IMPLEMENTED): - value: not_implemented_markdown_link_checker - # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" # computed features AddOnlineDocumentation: From d842352a388cfb024013ac8330c3294068587588 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 21:04:24 +0200 Subject: [PATCH 209/285] add linting next step as a question --- copier/questions/features.yml | 5 +++++ ...{% if AddLinting %}next_steps_linting.yml{% endif %}} | 9 +++++---- ...nting %}next_steps_linting_issue.md{% endif %}.jinja} | 0 3 files changed, 10 insertions(+), 4 deletions(-) rename template/.github/workflows/{next_steps.yml => {% if AddLinting %}next_steps_linting.yml{% endif %}} (74%) rename template/.github/{next_steps/05_linting.md.jinja => workflows/{% if AddLinting %}next_steps_linting_issue.md{% endif %}.jinja} (100%) diff --git a/copier/questions/features.yml b/copier/questions/features.yml index c5c6e185..7e218894 100644 --- a/copier/questions/features.yml +++ b/copier/questions/features.yml @@ -60,3 +60,8 @@ AddDevDoc: type: bool default: "{{ template_profile != 'minimum' }}" help: Add developer documentation? +AddLinting: + when: "{{ template_profile == 'ask' }}" + type: bool + default: "{{ template_profile != 'minimum' }}" + help: Add linting? diff --git a/template/.github/workflows/next_steps.yml b/template/.github/workflows/{% if AddLinting %}next_steps_linting.yml{% endif %} similarity index 74% rename from template/.github/workflows/next_steps.yml rename to template/.github/workflows/{% if AddLinting %}next_steps_linting.yml{% endif %} index 56263d50..9be89e43 100644 --- a/template/.github/workflows/next_steps.yml +++ b/template/.github/workflows/{% if AddLinting %}next_steps_linting.yml{% endif %} @@ -2,7 +2,7 @@ on: [push] permissions: contents: write issues: write -name: Create issues for next steps +name: Create issues for linting jobs: next_steps: runs-on: ubuntu-latest @@ -13,7 +13,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - filename: .github/next_steps/05_linting.md + filename: .github/workflows/next_steps_linting_issue.md id: linting - name: List created issues run: | @@ -23,7 +23,8 @@ jobs: run: | git config --global user.name 'NLeSC Python template' git config --global user.email 'nlesc-python-template@users.noreply.github.com' - git rm .github/workflows/next_steps.yml - git rm -r .github/next_steps + git pull # other next step workflows may push changes before + git rm .github/workflows/next_steps_linting.yml + git rm .github/workflows/next_steps_linting_issue.md git commit -am "Cleanup automated next steps issue generator" git push diff --git a/template/.github/next_steps/05_linting.md.jinja b/template/.github/workflows/{% if AddLinting %}next_steps_linting_issue.md{% endif %}.jinja similarity index 100% rename from template/.github/next_steps/05_linting.md.jinja rename to template/.github/workflows/{% if AddLinting %}next_steps_linting_issue.md{% endif %}.jinja From f534857a992121159f3ff34ff035d0ad6ab03a0f Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 21:15:14 +0200 Subject: [PATCH 210/285] add condition for linting mentions in README.dev.md --- template/{% if AddDevDoc %}README.dev.md{% endif %}.jinja | 2 ++ 1 file changed, 2 insertions(+) diff --git a/template/{% if AddDevDoc %}README.dev.md{% endif %}.jinja b/template/{% if AddDevDoc %}README.dev.md{% endif %}.jinja index e7740cdd..b992a0b1 100644 --- a/template/{% if AddDevDoc %}README.dev.md{% endif %}.jinja +++ b/template/{% if AddDevDoc %}README.dev.md{% endif %}.jinja @@ -62,6 +62,7 @@ coverage report `coverage` can also generate output in HTML and other formats; see `coverage help` for more information. +{%- if AddLinting -%} ## Running linters locally For linting and sorting imports we will use [ruff](https://beta.ruff.rs/docs/). Running the linters requires an @@ -76,6 +77,7 @@ ruff . --fix ``` To fix readability of your code style you can use [yapf](https://github.com/google/yapf). +{%- endif -%} {%- if AddPreCommit -%} You can enable automatic linting with `ruff` on commit by enabling the git hook from `.githooks/pre-commit`, like so: From 52e184bd806b82a0aecdc41382ca6cc7d32e6a59 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 21:16:03 +0200 Subject: [PATCH 211/285] add condition for linting job in build workflow --- .../workflows/{% if AddGitHubActions %}build.yml{% endif %} | 2 ++ 1 file changed, 2 insertions(+) diff --git a/template/.github/workflows/{% if AddGitHubActions %}build.yml{% endif %} b/template/.github/workflows/{% if AddGitHubActions %}build.yml{% endif %} index 1d4df162..c05f29a1 100644 --- a/template/.github/workflows/{% if AddGitHubActions %}build.yml{% endif %} +++ b/template/.github/workflows/{% if AddGitHubActions %}build.yml{% endif %} @@ -38,6 +38,7 @@ jobs: - name: Verify that we can build the package run: python -m build +{%- if AddLinting -%} lint: name: Linting build runs-on: ubuntu-latest @@ -62,3 +63,4 @@ jobs: run: | ruff check ruff format --check +{%- endif -%} From c4d08e925d3a0a92ad1aafd508d7bf4535ed8a6d Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 21:18:01 +0200 Subject: [PATCH 212/285] update the changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6301aa95..66d41981 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [Unreleased] ### Added +* Make linting optional [#568](https://github.com/NLeSC/python-template/pull/568) * Make contributing guidelines optional [#465]() * Make developer documentation optional [#467](https://github.com/NLeSC/python-template/pull/541) * Make Code of Conduct optional [#464](https://github.com/NLeSC/python-template/pull/530) From 17e4d1fdb19d43327afb044bd60e2d699d6a41d9 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 21:23:19 +0200 Subject: [PATCH 213/285] update the helper of AddPackageDetails --- copier/questions/package_details.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/copier/questions/package_details.yml b/copier/questions/package_details.yml index 342ccc6c..df9673c3 100644 --- a/copier/questions/package_details.yml +++ b/copier/questions/package_details.yml @@ -3,7 +3,9 @@ AddPackageDetails: type: bool default: yes - help: Do you want to add extra details for the package? + help: |- + If you are planning to publish the package it is recommended to provide more details. + Do you want to provide extra details for the package? when: "{{ template_profile != 'minimum'}}" package_short_description: type: str From 14e089fcb5165252beb2136d7a62188f631d373c Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 22:46:35 +0200 Subject: [PATCH 214/285] remove the table explaining template variables --- README.md | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/README.md b/README.md index fc214a77..7e803325 100644 --- a/README.md +++ b/README.md @@ -77,23 +77,6 @@ Run `copier copy` with the template: copier copy https://github.com/nlesc/python-template.git path/to/destination ``` -| Name | Default value | Explanation | -| ------------------------- | ------------- | ----------- | -| package_name | my_python_package | Name of the package. Avoid using spaces, dashes, or uppercase letters for the best experience across operating systems. This also will be used as the github repository name.| -| package_short_description | Short description of package | The information that you enter here will end up in the README, documentation, license, and pyproject.toml, so it may be a good idea to prepare something in advance. | -| keyword1 | keyword1 | A term that describes your package. | -| keyword2 | keyword2 | Another term that describes your package. | -| version | 0.1.0 |   | -| github_organization | <my-github-organization> | GitHub organization that will contain this project's repository. This can also be your GitHub user name. | -| license | Apache Software License 2.0 | The software license under which the code is made available. | -| full_name | Jane Smith | Your full name, e.g. _Jane Smith_. | -| email | yourname@esciencecenter.nl | Your (work) email address. | -| copyright_holder | Netherlands eScience Center | Name(s) of the organization(s) or person(s) who hold the copyright of the software. | -| code_of_conduct_email | yourname@esciencecenter.nl | Email address of the person who should be contacted in case of violations of the Code of Conduct. | - -Once the project files have been generated, follow the steps outlined in -[next_steps.md](template/next_steps.md.jinja). - #### Step 2/2: Read about what was just generated Good job! You have now generated the skeleton for your package: From c1811633f6a6d5c9b9d9274fb6a2fe7033a12642 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 22:54:08 +0200 Subject: [PATCH 215/285] remove the skeleton from README.md --- README.md | 60 ++----------------------------------------------------- 1 file changed, 2 insertions(+), 58 deletions(-) diff --git a/README.md b/README.md index 7e803325..9a4b5231 100644 --- a/README.md +++ b/README.md @@ -77,65 +77,9 @@ Run `copier copy` with the template: copier copy https://github.com/nlesc/python-template.git path/to/destination ``` -#### Step 2/2: Read about what was just generated - -Good job! You have now generated the skeleton for your package: - -```text -. -├── CHANGELOG.md -├── CITATION.cff -├── CODE_OF_CONDUCT.md -├── CONTRIBUTING.md -├── .copier-answers.yml -├── docs -│   ├── conf.py -│   ├── index.rst -│   ├── make.bat -│   ├── Makefile -│   └── _templates -│   └── .gitignore -├── .editorconfig -├── .githooks -│   └── pre-commit -├── .github -│   ├── next_steps -│   │   ├── 01_sonarcloud_integration.md -│   │   ├── 02_citation.md -│   │   ├── 03_readthedocs.md -│   │   ├── 04_zenodo_integration.md -│   │   └── 05_linting.md -│   └── workflows -│   ├── build.yml -│   ├── cffconvert.yml -│   ├── documentation.yml -│   ├── markdown-link-check.yml -│   ├── next_steps.yml -│   └── sonarcloud.yml -├── .gitignore -├── MANIFEST.in -├── .mlc-config.json -├── next_steps.md -├── NOTICE -├── project_setup.md -├── pyproject.toml -├── README.dev.md -├── README.md -├── .readthedocs.yaml -├── sonar-project.properties -├── src -│   └── my_python_package -│   ├── __init__.py -│   └── my_module.py -├── tests -│   ├── __init__.py -│   ├── test_my_module.py -│   ├── test_project.py -│   └── test_values.py -└── .zenodo.json -``` +Good job! Based on the profile and selected features, a package will be created in `path/to/destination`. -For an explanation of what's there, read on in the [project_setup.md](template/project_setup.md.jinja) file. +For an explanation of what's there, read on in the `project_setup.md` file. ### Scenario 2: Apply to pre-existing code From 29150c6b4280b8a706ddcf88aefd4e9838bf5640 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Mon, 26 Aug 2024 22:58:20 +0200 Subject: [PATCH 216/285] simplify the scenario 1 in user documentation --- README.md | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 9a4b5231..8629f5c8 100644 --- a/README.md +++ b/README.md @@ -64,20 +64,15 @@ pipx install copier ### Scenario 1: Create a new package - -#### Step 1/2: Create the files and directory structure - Run `copier copy` with the template: ```shell -# Notes: -# 1. Make sure that `path/to/destination` is an empty directory -# 2. See table below for explanation of each question -# 3. The files will be generated in the specified destination directory copier copy https://github.com/nlesc/python-template.git path/to/destination ``` -Good job! Based on the profile and selected features, a package will be created in `path/to/destination`. +> [!NOTE] +> 1. Make sure that `path/to/destination` is an empty directory +> 1. Based on the profile and selected features, the package will be generated in the specified destination directory For an explanation of what's there, read on in the `project_setup.md` file. From a6526ca13661f6a2cc5df46af6e4966cd1d389cd Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Tue, 27 Aug 2024 11:19:08 +0200 Subject: [PATCH 217/285] Add editorconfig question --- copier/questions/features.yml | 5 +++++ ...nfig => {% if AddEditorConfig %}.editorconfig{% endif %}} | 0 2 files changed, 5 insertions(+) rename template/{.editorconfig => {% if AddEditorConfig %}.editorconfig{% endif %}} (100%) diff --git a/copier/questions/features.yml b/copier/questions/features.yml index c5c6e185..de4760e3 100644 --- a/copier/questions/features.yml +++ b/copier/questions/features.yml @@ -60,3 +60,8 @@ AddDevDoc: type: bool default: "{{ template_profile != 'minimum' }}" help: Add developer documentation? +AddEditorConfig: + when: "{{ template_profile == 'ask' }}" + type: bool + default: "{{ template_profile != 'minimum' }}" + help: Add editorconfig file? diff --git a/template/.editorconfig b/template/{% if AddEditorConfig %}.editorconfig{% endif %} similarity index 100% rename from template/.editorconfig rename to template/{% if AddEditorConfig %}.editorconfig{% endif %} From 7cc247fd9a9024be5d1e9f428e0654e18a1f4692 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Tue, 27 Aug 2024 11:22:39 +0200 Subject: [PATCH 218/285] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6301aa95..a39606a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [Unreleased] ### Added +* Make editorconfig optional [#571](https://github.com/NLeSC/python-template/pull/571) * Make contributing guidelines optional [#465]() * Make developer documentation optional [#467](https://github.com/NLeSC/python-template/pull/541) * Make Code of Conduct optional [#464](https://github.com/NLeSC/python-template/pull/530) From 88f1f501637e886e4884cda6669a9051be34bce3 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 27 Aug 2024 11:26:11 +0200 Subject: [PATCH 219/285] update the changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6301aa95..6ccc2fab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ * Make online documentation optional [#476](https://github.com/NLeSC/python-template/pull/476) ### Changed +* Updated the user documentation (README.md) of the template [#569](https://github.com/NLeSC/python-template/pull/569) * Droped Python 3.8 and 3.9 support [#551](https://github.com/NLeSC/python-template/pull/551) * Fix broken link checker [#546](https://github.com/NLeSC/python-template/pull/546) * pre-commit script is optional ([#457](https://github.com/NLeSC/python-template/issues/457)) From ffdb9b00329a4e9062ff212d9cc0e2ce4a73d639 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 27 Aug 2024 12:21:36 +0200 Subject: [PATCH 220/285] update the intro sentence in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8629f5c8..9d75c69f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Netherlands eScience Center Python Template -Spend less time setting up and configuring your new Python packages and comply with the [Netherlands eScience Center Software Development Guide](https://guide.esciencecenter.nl/) from the start. +Spend less time setting up and configuring your new Python packages which includes research software good practices from the start. Use this [Copier](https://copier.readthedocs.io) template to generate an empty Python package. Features include: From 77730414c1128ec9dcc4d5e4c46363c99dd0d3a2 Mon Sep 17 00:00:00 2001 From: fdiblen <144492+fdiblen@users.noreply.github.com> Date: Tue, 27 Aug 2024 12:42:38 +0200 Subject: [PATCH 221/285] Create 01_bug_report.md --- .github/ISSUE_TEMPLATE/01_bug_report.md | 49 +++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/01_bug_report.md diff --git a/.github/ISSUE_TEMPLATE/01_bug_report.md b/.github/ISSUE_TEMPLATE/01_bug_report.md new file mode 100644 index 00000000..0f46294b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/01_bug_report.md @@ -0,0 +1,49 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: 'bug' +assignees: '' + +--- + +## Checklist before submitting a bug report + +- [ ] I have checked the [existing issues](https://github.com/NLeSC/python-template/issues) and couldn't find an issue about this bug. + +## Bug details + +**Describe the bug** + +A clear and concise description of what the bug is. + +**To Reproduce** + +Steps to reproduce the behavior: +1. install copier using '...' +2. run `copier copy ...` +3. Select Pre-commit feature +4. ... + +**Error Message** + +If applicable, add the error message. + +**Expected behavior** + +A clear and concise description of what you expected to happen. + +**Screenshots** + +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + +- OS: + +- version: + + +**Additional context** + +Add any other context about the problem here. From 9ae316908946e9cbf8c8831b1f32403d3c68db15 Mon Sep 17 00:00:00 2001 From: fdiblen <144492+fdiblen@users.noreply.github.com> Date: Tue, 27 Aug 2024 12:54:20 +0200 Subject: [PATCH 222/285] Update PULL_REQUEST_TEMPLATE.md --- .github/PULL_REQUEST_TEMPLATE.md | 66 ++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 16 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index e70f32de..8649a5e4 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,35 +1,69 @@ -**Description** - +## Checklist before requesting a review + - [ ] I have read the [contribution guidelines](https://github.com/NLeSC/python-template/blob/main/CONTRIBUTING.md) -- [ ] This update is in line with what is recommended in the [Python chapter of the Guide](https://guide.esciencecenter.nl/#/best_practices/language_guides/python) +- [ ] My code follows the style guidelines of this project +- [ ] I have performed a self-review of my code +- [ ] I have commented my code, particularly in hard-to-understand areas +- [ ] I have made corresponding changes to the documentation +- [ ] My changes generate no new warnings +- [ ] I have added tests that prove my fix is effective or that my feature works +- [ ] New and existing unit tests pass locally with my changes - [ ] All user facing changes have been added to CHANGELOG.md + + +## Type of change + +Please delete options that are not relevant. + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] This change requires a documentation update + +## List of related issues or pull requests** - + +Refs: +- #ISSUE_NUMBER_1 +- #ISSUE_NUMBER_2 - +## Describe the changes made in this pull request + +Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change. **Instructions to review the pull request** - -Create a `python-template-test` repo on GitHub (will be overwritten if existing) + + +Install the requirements + ``` -# Create a temporary directory by running the following command. Keep the XXXXXX in the directory name. cd $(mktemp -d --tmpdir py-tmpl-XXXXXX) -# Use --vcs-ref to point to the branch you want to test -copier copy --vcs-ref https://github.com//python-template . -# Fill with python-template-test info -# Create a local git repo to push to GitHub to trigger CI actions +pip install pipx +pipx install copier +``` + +Create a new package using the template + +``` +copier copy --vcs-ref https://github.com/nlesc/python-template test_package +``` + +Create a local git repo to push to GitHub to trigger CI actions +``` git init git add --all git commit -m "First commit" -git remote add origin git@github.com:/python-template-test.git +git remote add origin git@github.com:/python-template-test.git git push -u origin main -f +``` + +``` # Create a local environment to test your generated package locally python -m venv env source env/bin/activate python -m pip install --upgrade pip setuptools python -m pip install '.[dev,publishing]' ``` + + From c1bf39cef21c23d94518d099cd72c5b5d373f0e3 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 27 Aug 2024 13:07:55 +0200 Subject: [PATCH 223/285] keep project setup all the time --- copier/questions/features_documentation.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/copier/questions/features_documentation.yml b/copier/questions/features_documentation.yml index 98e61711..ab16d8f6 100644 --- a/copier/questions/features_documentation.yml +++ b/copier/questions/features_documentation.yml @@ -7,22 +7,19 @@ SelectDocumentationFeatures: type: yaml default: |- {% if template_profile == 'recommended' %} - [AddOnlineDocumentation_flag, AddDevDoc_flag, not_implemented_project_setup] + [AddOnlineDocumentation_flag, AddDevDoc_flag] {%- else -%} [] {%- endif %} help: Select documentation features multiselect: true choices: - Online documentation (using Read the Docs): + Online documentation (Read the Docs): value: AddOnlineDocumentation_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" Developer documentation: value: AddDevDoc_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" - Project setup description (NOT_IMPLEMENTED): - value: not_implemented_project_setup - # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" # computed features AddOnlineDocumentation: From 8c0c0747b45604b885efbc3d173dd9cda9991b03 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 27 Aug 2024 13:10:21 +0200 Subject: [PATCH 224/285] update the changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ccc2fab..fb9cf9f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,8 @@ ## [Unreleased] ### Added -* Make contributing guidelines optional [#465]() +* Keep project_setup.md for all the profiles and remove from the menu [#576](https://github.com/NLeSC/python-template/pull/576) +* Make contributing guidelines optional [#465](https://github.com/NLeSC/python-template/pull/465) * Make developer documentation optional [#467](https://github.com/NLeSC/python-template/pull/541) * Make Code of Conduct optional [#464](https://github.com/NLeSC/python-template/pull/530) * New YAML files for copier questions [#529](https://github.com/NLeSC/python-template/pull/529) From 92e333780d5bdc52778491df3c67dd1aa2806590 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 27 Aug 2024 13:21:30 +0200 Subject: [PATCH 225/285] make the AddLinting a computed value --- copier/questions/features_code_quality.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/copier/questions/features_code_quality.yml b/copier/questions/features_code_quality.yml index 8fd465b0..b1b6bef7 100644 --- a/copier/questions/features_code_quality.yml +++ b/copier/questions/features_code_quality.yml @@ -79,6 +79,7 @@ AddSonarCloud: AddLinting: type: bool default: "{{ 'AddLinting_flag' in SelectCodeQualityFeatures }}" + when: false AddEditorConfig: type: bool default: "{{ 'AddEditorConfig_flag' in SelectCodeQualityFeatures }}" From 9a46b8692c25f096bc7f3474bbea533a5c748454 Mon Sep 17 00:00:00 2001 From: fdiblen <144492+fdiblen@users.noreply.github.com> Date: Tue, 27 Aug 2024 16:23:13 +0200 Subject: [PATCH 226/285] Update 10_generated_package.md --- .github/ISSUE_TEMPLATE/10_generated_package.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/10_generated_package.md b/.github/ISSUE_TEMPLATE/10_generated_package.md index 19215dd6..6ed2cf37 100644 --- a/.github/ISSUE_TEMPLATE/10_generated_package.md +++ b/.github/ISSUE_TEMPLATE/10_generated_package.md @@ -6,6 +6,12 @@ labels: generated-package assignees: '' --- + +## Checklist before submitting an issue + +- [ ] I have checked the [existing issues](https://github.com/NLeSC/python-template/issues) and couldn't find an issue about this bug. + +## Issue details From 83cc536b8197a976621903c0237009c5df4bd3e3 Mon Sep 17 00:00:00 2001 From: fdiblen <144492+fdiblen@users.noreply.github.com> Date: Tue, 27 Aug 2024 16:23:38 +0200 Subject: [PATCH 227/285] Update 20_template.md --- .github/ISSUE_TEMPLATE/20_template.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/20_template.md b/.github/ISSUE_TEMPLATE/20_template.md index df6e73dc..7937bcc4 100644 --- a/.github/ISSUE_TEMPLATE/20_template.md +++ b/.github/ISSUE_TEMPLATE/20_template.md @@ -6,6 +6,12 @@ labels: template assignees: '' --- + +## Checklist before submitting an issue + +- [ ] I have checked the [existing issues](https://github.com/NLeSC/python-template/issues) and couldn't find an issue about this bug. + +## Issue details From 9b1ef6b09185771d093b33807f3926e994db7a1a Mon Sep 17 00:00:00 2001 From: fdiblen <144492+fdiblen@users.noreply.github.com> Date: Tue, 27 Aug 2024 16:24:01 +0200 Subject: [PATCH 228/285] Update 30_blank.md --- .github/ISSUE_TEMPLATE/30_blank.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/30_blank.md b/.github/ISSUE_TEMPLATE/30_blank.md index 11b08d93..fde810e3 100644 --- a/.github/ISSUE_TEMPLATE/30_blank.md +++ b/.github/ISSUE_TEMPLATE/30_blank.md @@ -6,3 +6,12 @@ labels: '' assignees: '' --- + +## Checklist before submitting an issue + +- [ ] I have checked the [existing issues](https://github.com/NLeSC/python-template/issues) and couldn't find an issue about this bug. + +## Issue details + From 1ee697cd39b344832bc644ae6d96cb68e5d25cc7 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Tue, 27 Aug 2024 16:24:14 +0200 Subject: [PATCH 229/285] change default profile to recommended --- copier/profiles.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier/profiles.yml b/copier/profiles.yml index 5204ddee..30f1d472 100644 --- a/copier/profiles.yml +++ b/copier/profiles.yml @@ -2,7 +2,7 @@ # profile selection template_profile: type: str - default: ask + default: "recommended" help: Select a profile choices: Recommended (our defaults for research software): "recommended" From 666114ae6fe8f651884cfe6f525006e6b01ff811 Mon Sep 17 00:00:00 2001 From: fdiblen <144492+fdiblen@users.noreply.github.com> Date: Tue, 27 Aug 2024 16:26:24 +0200 Subject: [PATCH 230/285] Update 01_bug_report.md --- .github/ISSUE_TEMPLATE/01_bug_report.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/01_bug_report.md b/.github/ISSUE_TEMPLATE/01_bug_report.md index 0f46294b..a97cba64 100644 --- a/.github/ISSUE_TEMPLATE/01_bug_report.md +++ b/.github/ISSUE_TEMPLATE/01_bug_report.md @@ -39,6 +39,10 @@ If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** +- Template profile + - [ ] recommended + - [ ] minimum + - [ ] let me choose - OS: - version: From 63ec951cf1372a1678770f872e071734886c9419 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Tue, 27 Aug 2024 16:31:00 +0200 Subject: [PATCH 231/285] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6df43323..f32ca18a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ * Make online documentation optional [#476](https://github.com/NLeSC/python-template/pull/476) ### Changed +* Change the default profile to 'recommended' [#598](https://github.com/NLeSC/python-template/pull/598) * Updated the user documentation (README.md) of the template [#569](https://github.com/NLeSC/python-template/pull/569) * Droped Python 3.8 and 3.9 support [#551](https://github.com/NLeSC/python-template/pull/551) * Fix broken link checker [#546](https://github.com/NLeSC/python-template/pull/546) From 1a21dd863862e20724b764f4b0a1f51728a852a8 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Tue, 27 Aug 2024 16:39:37 +0200 Subject: [PATCH 232/285] Add version variable --- template/docs/conf.py.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/docs/conf.py.jinja b/template/docs/conf.py.jinja index f182650c..dbbec0af 100644 --- a/template/docs/conf.py.jinja +++ b/template/docs/conf.py.jinja @@ -26,7 +26,7 @@ author = u"{{ full_name|replace('\"', '\\\"') }}" # built documents. # # The short X.Y version. -version = "0.1.0" +version = "{{ version }}" # The full version, including alpha/beta/rc tags. release = version From 72cf7efd584d3a1a2cc0402964b30c27a9029f8c Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Tue, 27 Aug 2024 17:12:52 +0200 Subject: [PATCH 233/285] Set email default --- copier/questions/package_details.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier/questions/package_details.yml b/copier/questions/package_details.yml index df9673c3..144ad6f9 100644 --- a/copier/questions/package_details.yml +++ b/copier/questions/package_details.yml @@ -46,7 +46,7 @@ email: {% endif %} code_of_conduct_email: type: str - placeholder: yourname@esciencecenter.nl + default: {{ email}} help: What is the email address for code of conduct? when: "{{ template_profile != 'minimum' and AddPackageDetails }}" validator: >- From fabb00b541159438e4b865c3bf07ef2b0041adbf Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Tue, 27 Aug 2024 17:25:54 +0200 Subject: [PATCH 234/285] add missing quotes --- copier/questions/package_details.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier/questions/package_details.yml b/copier/questions/package_details.yml index 144ad6f9..06216fe6 100644 --- a/copier/questions/package_details.yml +++ b/copier/questions/package_details.yml @@ -46,7 +46,7 @@ email: {% endif %} code_of_conduct_email: type: str - default: {{ email}} + default: "{{ email }}" help: What is the email address for code of conduct? when: "{{ template_profile != 'minimum' and AddPackageDetails }}" validator: >- From 0c26d01d0aa5c6f3d8a36361a2a0185965a3fd66 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 27 Aug 2024 17:27:43 +0200 Subject: [PATCH 235/285] remove next_steps.md and show its content as a user message --- copier/messages.yml | 34 +++++++++++++++++++++---- template/next_steps.md.jinja | 49 ------------------------------------ 2 files changed, 29 insertions(+), 54 deletions(-) delete mode 100644 template/next_steps.md.jinja diff --git a/copier/messages.yml b/copier/messages.yml index d19e7232..dc340aa1 100644 --- a/copier/messages.yml +++ b/copier/messages.yml @@ -9,15 +9,39 @@ _message_before_copy: | input to each of them. _message_after_copy: | - Your project "{{ package_name }}" has been created successfully! + Your project "{{ package_name }}" has been successfully created in {{ _copier_conf.dst_path }} folder! - Next steps: + {% if template_profile != 'minimum' -%} - 1. Change directory to the project root: + Next steps: - $ cd {{ _copier_conf.dst_path }} + - Below are the commands to put your Python package under using git: - 2. Read next_steps.md which contains information on next steps. + cd {{ _copier_conf.dst_path }} + git init + git add --all + git commit -m "first commit" + git branch -M main + git remote add origin {{ repository }} + + - Push the initial commit to a new repo on GitHub + + Go to https://github.com/organizations/{{github_organization}}/repositories/new + and create a new repository named `{{ package_name }}` as an empty repository, then push your commits to GitHub: + + git push --set-upstream origin main + + {% if AddDevDoc -%} + - Project development documentation + + The [README.dev.md](README.dev.md) contains developer documentation + {%- endif-%} + + - Project layout explained + + For an explanation of what files are there, and what each of these do, please refer to {{ _copier_conf.dst_path }}/project_setup.md + + {%- endif-%} _message_before_update: | Thanks for updating your project using our template. diff --git a/template/next_steps.md.jinja b/template/next_steps.md.jinja deleted file mode 100644 index 152b7d52..00000000 --- a/template/next_steps.md.jinja +++ /dev/null @@ -1,49 +0,0 @@ -# Next steps - -## Put the generated files under version control - -Once your Python package is created, put it under [version -control](https://guide.esciencecenter.nl/#/best_practices/version_control) using -[git](https://git-scm.com/) and [GitHub](https://github.com/). - -Note that the next step assumes you have setup your connection to GitHub via SSH, -see [Connecting to GitHub with SSH](https://docs.github.com/en/github-ae@latest/authentication/connecting-to-github-with-ssh). - -Alternatively, you can also use a personal access token, see -[Creating a personal access token](https://docs.github.com/en/github-ae@latest/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token). If you choose this option, below you will have to replace -`git@github.com:` by `https://github.com/`. - -Inside of the generated directory, run the following commands: -```shell -git init -git add --all -git commit -m "first commit" -git branch -M main -git remote add origin {{ repository }} -``` - -## Push the initial commit to a new repo on GitHub - -Go to -[https://github.com/organizations/{{github_organization}}/repositories/new](https://github.com/organizations/{{github_organization}}/repositories/new) -and create a new repository named `{{ package_name }}` as an empty repository, then push your commits to GitHub: - -```shell -git push --set-upstream origin main -``` - -## Check automatically generated issues - -A short while after you push your commits to GitHub for the first time, a few issues outlining next steps will added -automatically ([here]({{repository_url}}/issues?q=author%3Aapp%2Fgithub-actions)). Resolve them to complete the -setup of your repository. - -{% if AddDevDoc -%} -## Project development documentation - -The [README.dev.md](README.dev.md) contains developer documentation. -{%- endif %} - -## Project layout explained - -For an explanation of what files are there, and what each of these do, please refer to [project_setup.md](project_setup.md). From 72033460d0634c8fcb77bed3c349484b493f959d Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 27 Aug 2024 17:30:10 +0200 Subject: [PATCH 236/285] update the changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6df43323..f7b6d97a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ * Make online documentation optional [#476](https://github.com/NLeSC/python-template/pull/476) ### Changed +* next_steps.md is shown as a copier message [#609](https://github.com/NLeSC/python-template/pull/609) * Updated the user documentation (README.md) of the template [#569](https://github.com/NLeSC/python-template/pull/569) * Droped Python 3.8 and 3.9 support [#551](https://github.com/NLeSC/python-template/pull/551) * Fix broken link checker [#546](https://github.com/NLeSC/python-template/pull/546) From ff750574bbcfa2e4c561e723b6afb1cb42d6e5f7 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 27 Aug 2024 17:58:42 +0200 Subject: [PATCH 237/285] fix next steps message formatting --- copier/messages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier/messages.yml b/copier/messages.yml index dc340aa1..4e00b66d 100644 --- a/copier/messages.yml +++ b/copier/messages.yml @@ -31,7 +31,7 @@ _message_after_copy: | git push --set-upstream origin main - {% if AddDevDoc -%} + {% if AddDevDoc %} - Project development documentation The [README.dev.md](README.dev.md) contains developer documentation From 1fa94dcb45e2739aba224e0349aea49fbda625c1 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Tue, 27 Aug 2024 18:06:22 +0200 Subject: [PATCH 238/285] fix next steps message formatting --- copier/messages.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/copier/messages.yml b/copier/messages.yml index 4e00b66d..14db1545 100644 --- a/copier/messages.yml +++ b/copier/messages.yml @@ -31,11 +31,11 @@ _message_after_copy: | git push --set-upstream origin main - {% if AddDevDoc %} + {% if AddDevDoc -%} - Project development documentation - The [README.dev.md](README.dev.md) contains developer documentation - {%- endif-%} + The README.dev.md contains developer documentation + {%- endif %} - Project layout explained From a89f3ff61bd88db376903b73115448499e3cc29b Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 28 Aug 2024 11:03:33 +0200 Subject: [PATCH 239/285] fix filename typo of githooks --- .../pre-commit | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename template/{{% if AddPreCommit %}.githhooks{% endif %} => {% if AddPreCommit %}.githooks{% endif %}}/pre-commit (100%) diff --git a/template/{% if AddPreCommit %}.githhooks{% endif %}/pre-commit b/template/{% if AddPreCommit %}.githooks{% endif %}/pre-commit similarity index 100% rename from template/{% if AddPreCommit %}.githhooks{% endif %}/pre-commit rename to template/{% if AddPreCommit %}.githooks{% endif %}/pre-commit From d40b7ebc616f0e37a59f96d2ae4734c7bd5d0302 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 28 Aug 2024 11:08:10 +0200 Subject: [PATCH 240/285] update the changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6eed046..6847d319 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ * Make online documentation optional [#476](https://github.com/NLeSC/python-template/pull/476) ### Changed +* fix filename typo of githooks [#611](https://github.com/NLeSC/python-template/pull/609) * next_steps.md is shown as a copier message [#609](https://github.com/NLeSC/python-template/pull/609) * Change the default profile to 'recommended' [#598](https://github.com/NLeSC/python-template/pull/598) * Updated the user documentation (README.md) of the template [#569](https://github.com/NLeSC/python-template/pull/569) From 7a99bb318e6931bde76f99c416a3125c7ba0f5f7 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 28 Aug 2024 11:11:58 +0200 Subject: [PATCH 241/285] update the code of conduct email question --- copier/questions/package_details.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/copier/questions/package_details.yml b/copier/questions/package_details.yml index 06216fe6..79fdb68d 100644 --- a/copier/questions/package_details.yml +++ b/copier/questions/package_details.yml @@ -46,8 +46,8 @@ email: {% endif %} code_of_conduct_email: type: str - default: "{{ email }}" - help: What is the email address for code of conduct? + default: "{{ email }}" + help: What is the email address to report code of conduct violations? when: "{{ template_profile != 'minimum' and AddPackageDetails }}" validator: >- {% if not (code_of_conduct_email | regex_search('([A-Za-z0-9]+[.-_])*[A-Za-z0-9]+@[A-Za-z0-9-]+(\.[A-Z|a-z]{2,})+')) %} From 31eb71418e1c5107f0a7b5604f6fb82a3610c14c Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 28 Aug 2024 11:31:45 +0200 Subject: [PATCH 242/285] Add readthedocs link --- template/pyproject.toml.jinja | 3 +++ 1 file changed, 3 insertions(+) diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index 1c7062d7..c8850e45 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -72,6 +72,9 @@ Issues = "{{ repository_url }}/issues" {% if AddChangeLog -%} Changelog = "{{ repository_url }}/CHANGELOG.md" {%- endif %} +{% if AddOnlineDocumentation -%} +ReadTheDocs = "https://{{ package_name }}.readthedocs.io" +{%- endif %} [tool.pytest.ini_options] testpaths = ["tests"] From ae25b75e411cf51b443dfc568f9794b5bd0c9491 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 28 Aug 2024 11:47:18 +0200 Subject: [PATCH 243/285] rename not open source license as other --- copier/questions/essential.yml | 2 +- ...= 'Other (add your own license)' %}LICENSE{% endif %}.jinja} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename template/{{% if license == 'Not open source' %}LICENSE{% endif %}.jinja => {% if license == 'Other (add your own license)' %}LICENSE{% endif %}.jinja} (100%) diff --git a/copier/questions/essential.yml b/copier/questions/essential.yml index 54fe971f..ba38f380 100644 --- a/copier/questions/essential.yml +++ b/copier/questions/essential.yml @@ -33,5 +33,5 @@ license: - "ISC license" - "GNU General Public License v3 or later" - "GNU Lesser General Public License v3 or later" - - "Not open source" + - "Other (add your own license)" default: "Apache-2.0" diff --git a/template/{% if license == 'Not open source' %}LICENSE{% endif %}.jinja b/template/{% if license == 'Other (add your own license)' %}LICENSE{% endif %}.jinja similarity index 100% rename from template/{% if license == 'Not open source' %}LICENSE{% endif %}.jinja rename to template/{% if license == 'Other (add your own license)' %}LICENSE{% endif %}.jinja From 953db4564da1257e84dfad3cbaa66b99f5e16daa Mon Sep 17 00:00:00 2001 From: Bouwe Andela Date: Wed, 28 Aug 2024 12:07:30 +0200 Subject: [PATCH 244/285] Remove unused isort configuration (#591) --- CHANGELOG.md | 2 +- template/pyproject.toml.jinja | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6eed046..f66cc4af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,7 @@ * CHANGELOG.md is now optional ([#462](https://github.com/NLeSC/python-template/issues/462)) ### Removed - +* Remove the configuration of isort ([#591](https://github.com/NLeSC/python-template/pull/591)), which is no longer used since [#347](https://github.com/NLeSC/python-template/issues/347). ## [0.5.0] diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index 1c7062d7..61b69ab6 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -81,14 +81,6 @@ branch = true source = ["src/{{ package_name }}"] command_line = "-m pytest" -[tool.isort] -lines_after_imports = 2 -force_single_line = 1 -no_lines_before = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"] -known_first_party = "{{ package_name }}" -src_paths = ["src/{{ package_name }}", "tests"] -line_length = 120 - [tool.tox] legacy_tox_ini = """ [tox] From 1d08baf6dfd98b576b01cce6e6537d277a673618 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 28 Aug 2024 12:08:32 +0200 Subject: [PATCH 245/285] fix license values --- copier/questions/essential.yml | 23 ++++++++++++------- ... == 'Apachev2' %}LICENSE{% endif %}.jinja} | 0 ...cense == 'BSD' %}LICENSE{% endif %}.jinja} | 0 ... 'GNULesserv3' %}LICENSE{% endif %}.jinja} | 0 ...nse == 'GNUv3' %}LICENSE{% endif %}.jinja} | 0 ...cense == 'ISC' %}LICENSE{% endif %}.jinja} | 0 ...cense == 'MIT' %}LICENSE{% endif %}.jinja} | 0 ...r own license)' %}LICENSE{% endif %}.jinja | 1 - ...ense == 'Other' %}LICENSE{% endif %}.jinja | 1 + 9 files changed, 16 insertions(+), 9 deletions(-) rename template/{{% if license == 'Apache-2.0' %}LICENSE{% endif %}.jinja => {% if license == 'Apachev2' %}LICENSE{% endif %}.jinja} (100%) rename template/{{% if license == 'BSD license' %}LICENSE{% endif %}.jinja => {% if license == 'BSD' %}LICENSE{% endif %}.jinja} (100%) rename template/{{% if license == 'GNU Lesser General Public License v3 or later' %}LICENSE{% endif %}.jinja => {% if license == 'GNULesserv3' %}LICENSE{% endif %}.jinja} (100%) rename template/{{% if license == 'GNU General Public License v3 or later' %}LICENSE{% endif %}.jinja => {% if license == 'GNUv3' %}LICENSE{% endif %}.jinja} (100%) rename template/{{% if license == 'ISC license' %}LICENSE{% endif %}.jinja => {% if license == 'ISC' %}LICENSE{% endif %}.jinja} (100%) rename template/{{% if license == 'MIT licence' %}LICENSE{% endif %}.jinja => {% if license == 'MIT' %}LICENSE{% endif %}.jinja} (100%) delete mode 100644 template/{% if license == 'Other (add your own license)' %}LICENSE{% endif %}.jinja create mode 100644 template/{% if license == 'Other' %}LICENSE{% endif %}.jinja diff --git a/copier/questions/essential.yml b/copier/questions/essential.yml index ba38f380..6bb14c7e 100644 --- a/copier/questions/essential.yml +++ b/copier/questions/essential.yml @@ -27,11 +27,18 @@ full_name: license: type: str choices: - - "Apache-2.0" - - "MIT license" - - "BSD license" - - "ISC license" - - "GNU General Public License v3 or later" - - "GNU Lesser General Public License v3 or later" - - "Other (add your own license)" - default: "Apache-2.0" + Apache License, Version 2.0: + value: Apachev2 + MIT license: + value: MIT + BSD license: + value: BSD + ISC license: + value: ISC + GNU General Public License v3 or later: + value: GNUv3 + GNU Lesser General Public License v3 or later: + value: GNULesserv3 + Other (add your own license): + value: Other + default: "Apachev2" diff --git a/template/{% if license == 'Apache-2.0' %}LICENSE{% endif %}.jinja b/template/{% if license == 'Apachev2' %}LICENSE{% endif %}.jinja similarity index 100% rename from template/{% if license == 'Apache-2.0' %}LICENSE{% endif %}.jinja rename to template/{% if license == 'Apachev2' %}LICENSE{% endif %}.jinja diff --git a/template/{% if license == 'BSD license' %}LICENSE{% endif %}.jinja b/template/{% if license == 'BSD' %}LICENSE{% endif %}.jinja similarity index 100% rename from template/{% if license == 'BSD license' %}LICENSE{% endif %}.jinja rename to template/{% if license == 'BSD' %}LICENSE{% endif %}.jinja diff --git a/template/{% if license == 'GNU Lesser General Public License v3 or later' %}LICENSE{% endif %}.jinja b/template/{% if license == 'GNULesserv3' %}LICENSE{% endif %}.jinja similarity index 100% rename from template/{% if license == 'GNU Lesser General Public License v3 or later' %}LICENSE{% endif %}.jinja rename to template/{% if license == 'GNULesserv3' %}LICENSE{% endif %}.jinja diff --git a/template/{% if license == 'GNU General Public License v3 or later' %}LICENSE{% endif %}.jinja b/template/{% if license == 'GNUv3' %}LICENSE{% endif %}.jinja similarity index 100% rename from template/{% if license == 'GNU General Public License v3 or later' %}LICENSE{% endif %}.jinja rename to template/{% if license == 'GNUv3' %}LICENSE{% endif %}.jinja diff --git a/template/{% if license == 'ISC license' %}LICENSE{% endif %}.jinja b/template/{% if license == 'ISC' %}LICENSE{% endif %}.jinja similarity index 100% rename from template/{% if license == 'ISC license' %}LICENSE{% endif %}.jinja rename to template/{% if license == 'ISC' %}LICENSE{% endif %}.jinja diff --git a/template/{% if license == 'MIT licence' %}LICENSE{% endif %}.jinja b/template/{% if license == 'MIT' %}LICENSE{% endif %}.jinja similarity index 100% rename from template/{% if license == 'MIT licence' %}LICENSE{% endif %}.jinja rename to template/{% if license == 'MIT' %}LICENSE{% endif %}.jinja diff --git a/template/{% if license == 'Other (add your own license)' %}LICENSE{% endif %}.jinja b/template/{% if license == 'Other (add your own license)' %}LICENSE{% endif %}.jinja deleted file mode 100644 index f816229f..00000000 --- a/template/{% if license == 'Other (add your own license)' %}LICENSE{% endif %}.jinja +++ /dev/null @@ -1 +0,0 @@ -Not open source diff --git a/template/{% if license == 'Other' %}LICENSE{% endif %}.jinja b/template/{% if license == 'Other' %}LICENSE{% endif %}.jinja new file mode 100644 index 00000000..8716c7ae --- /dev/null +++ b/template/{% if license == 'Other' %}LICENSE{% endif %}.jinja @@ -0,0 +1 @@ +Add your own license From a7cdc9f6dbd6d638207c6d30eedf12fb5b309287 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 28 Aug 2024 12:11:23 +0200 Subject: [PATCH 246/285] Fix white space --- template/pyproject.toml.jinja | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index c8850e45..d2b6e04b 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -71,11 +71,10 @@ Repository = "{{ repository_url }}" Issues = "{{ repository_url }}/issues" {% if AddChangeLog -%} Changelog = "{{ repository_url }}/CHANGELOG.md" -{%- endif %} +{% endif -%} {% if AddOnlineDocumentation -%} ReadTheDocs = "https://{{ package_name }}.readthedocs.io" -{%- endif %} - +{% endif %} [tool.pytest.ini_options] testpaths = ["tests"] From 89a193af0af26adf5f13af94ef66a3194dfd554c Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 28 Aug 2024 12:12:50 +0200 Subject: [PATCH 247/285] update the changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6eed046..ebe4c94f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ * Make online documentation optional [#476](https://github.com/NLeSC/python-template/pull/476) ### Changed +* added value field to license options [#617](https://github.com/NLeSC/python-template/pull/617) * next_steps.md is shown as a copier message [#609](https://github.com/NLeSC/python-template/pull/609) * Change the default profile to 'recommended' [#598](https://github.com/NLeSC/python-template/pull/598) * Updated the user documentation (README.md) of the template [#569](https://github.com/NLeSC/python-template/pull/569) From 71929ebc019af6e77219d75a1b4e2b2ede6f49be Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 28 Aug 2024 12:29:18 +0200 Subject: [PATCH 248/285] Remove extra line --- copier/messages.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/copier/messages.yml b/copier/messages.yml index 14db1545..06812219 100644 --- a/copier/messages.yml +++ b/copier/messages.yml @@ -30,13 +30,11 @@ _message_after_copy: | and create a new repository named `{{ package_name }}` as an empty repository, then push your commits to GitHub: git push --set-upstream origin main - - {% if AddDevDoc -%} + {% if AddDevDoc %} - Project development documentation The README.dev.md contains developer documentation - {%- endif %} - + {% endif %} - Project layout explained For an explanation of what files are there, and what each of these do, please refer to {{ _copier_conf.dst_path }}/project_setup.md From 1a3949e58e8bb32a3b3c2c4a5de9b4817a1c8743 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 28 Aug 2024 13:41:03 +0200 Subject: [PATCH 249/285] update gitignore --- template/.gitignore | 61 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 11 deletions(-) diff --git a/template/.gitignore b/template/.gitignore index baba4dd6..090505b1 100644 --- a/template/.gitignore +++ b/template/.gitignore @@ -1,33 +1,72 @@ +# Byte-compiled / optimized / DLL files *.py[cod] -*.egg-info -*.eggs -.ipynb_checkpoints - -build -dist -.cache +*$py.class __pycache__ -htmlcov +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# jupyter notebook +.ipynb_checkpoints + +# Unit test / coverage reports +htmlcov/ .coverage +.coverage.* coverage.xml +.cache .pytest_cache -.tox +.tox/ +# Sphinx documentation docs/_build # ide -.idea .eclipse .vscode +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ +.spyderproject +.spyproject # Mac .DS_Store # virtual environments env +.env env3 +.env3 venv +.venv venv3 +.venv3 +ENV/ +env.bak/ +venv.bak/ -.swp +# vim +*.swp +*.swo +*.orig From ac18ab74ad107cd145bd0404bac74d2834e5d4ec Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 28 Aug 2024 13:47:20 +0200 Subject: [PATCH 250/285] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd611f86..24cd6068 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ * Make online documentation optional [#476](https://github.com/NLeSC/python-template/pull/476) ### Changed +* Updated .gitignore [#622](https://github.com/NLeSC/python-template/pull/622) * added value field to license options [#617](https://github.com/NLeSC/python-template/pull/617) * fix filename typo of githooks [#611](https://github.com/NLeSC/python-template/pull/609) * next_steps.md is shown as a copier message [#609](https://github.com/NLeSC/python-template/pull/609) From 8664d0eac6078d32b59a215bd95fcfa978b2dc12 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 28 Aug 2024 14:01:29 +0200 Subject: [PATCH 251/285] always ask package details --- copier/questions/package_details.yml | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/copier/questions/package_details.yml b/copier/questions/package_details.yml index 06216fe6..83a691a6 100644 --- a/copier/questions/package_details.yml +++ b/copier/questions/package_details.yml @@ -1,17 +1,16 @@ --- # package details -AddPackageDetails: - type: bool - default: yes - help: |- - If you are planning to publish the package it is recommended to provide more details. - Do you want to provide extra details for the package? - when: "{{ template_profile != 'minimum'}}" +# AddPackageDetails: +# type: bool +# default: yes +# help: |- +# If you are planning to publish the package it is recommended to provide more details. +# Do you want to provide extra details for the package? +# when: false package_short_description: type: str placeholder: Short description help: Short description of package - when: "{{ template_profile != 'minimum' and AddPackageDetails }}" validator: >- {% if not package_short_description %} Package description cannot be empty @@ -20,17 +19,14 @@ keyword1: type: str placeholder: keyword1 help: Add keyword1 - when: "{{ template_profile != 'minimum' and AddPackageDetails }}" keyword2: type: str placeholder: keyword2 help: Add keyword2 - when: "{{ template_profile != 'minimum' and AddPackageDetails }}" github_organization: type: str placeholder: "" help: Enter the name of your GitHub username or organization - when: "{{ template_profile != 'minimum' and AddPackageDetails }}" validator: >- {% if not github_organization %} This field cannot be empty @@ -39,16 +35,14 @@ email: type: str placeholder: yourname@esciencecenter.nl help: What is your email address? - when: "{{ template_profile != 'minimum' and AddPackageDetails }}" validator: >- {% if not (email | regex_search('([A-Za-z0-9]+[.-_])*[A-Za-z0-9]+@[A-Za-z0-9-]+(\.[A-Z|a-z]{2,})+')) %} Please enter a valid email address {% endif %} code_of_conduct_email: type: str - default: "{{ email }}" + default: "{{ email }}" help: What is the email address for code of conduct? - when: "{{ template_profile != 'minimum' and AddPackageDetails }}" validator: >- {% if not (code_of_conduct_email | regex_search('([A-Za-z0-9]+[.-_])*[A-Za-z0-9]+@[A-Za-z0-9-]+(\.[A-Z|a-z]{2,})+')) %} Please enter a valid email address @@ -57,13 +51,11 @@ copyright_holder: type: str placeholder: Netherlands eScience Center help: Who is the copyright holder? - when: "{{ template_profile != 'minimum' and AddPackageDetails }}" # calculated fields for GitHub repository: default: git@github.com:{{ github_organization }}/{{ package_name }} when: false - repository_url: default: https://github.com/{{ github_organization }}/{{ package_name }} when: false From 4893eca3fe9b29bc29ed4f31b93ef83c2c0e1f02 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 28 Aug 2024 14:05:29 +0200 Subject: [PATCH 252/285] ask a single keyword question --- copier/questions/package_details.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/copier/questions/package_details.yml b/copier/questions/package_details.yml index 83a691a6..7706f1ec 100644 --- a/copier/questions/package_details.yml +++ b/copier/questions/package_details.yml @@ -15,14 +15,10 @@ package_short_description: {% if not package_short_description %} Package description cannot be empty {% endif %} -keyword1: +keywords: type: str - placeholder: keyword1 - help: Add keyword1 -keyword2: - type: str - placeholder: keyword2 - help: Add keyword2 + placeholder: keywords + help: Add keywords to make your package findable on PyPI github_organization: type: str placeholder: "" From c730f6a518dfc1c9c8dfded78fef2f383ad4423d Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 28 Aug 2024 14:06:28 +0200 Subject: [PATCH 253/285] format keywords in pyproject.toml --- template/pyproject.toml.jinja | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index 61b69ab6..e78e7219 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -31,8 +31,9 @@ classifiers = [ dependencies = [] description = "{{ package_short_description|replace('\"', '\\\"') }}" keywords = [ - "{{ keyword1 }}", - "{{ keyword2 }}", +{%- for item in keywords.split(',') -%} +"{{ item }}"{{ "," if not loop.last }} +{%- endfor -%} ] license = {file = "LICENSE"} name = "{{ package_name }}" From 9ede383c05626abbca27e31775567fc42005adf3 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 28 Aug 2024 14:07:31 +0200 Subject: [PATCH 254/285] update the placeholder for keywords --- copier/questions/package_details.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier/questions/package_details.yml b/copier/questions/package_details.yml index 7706f1ec..8ef406ac 100644 --- a/copier/questions/package_details.yml +++ b/copier/questions/package_details.yml @@ -17,7 +17,7 @@ package_short_description: {% endif %} keywords: type: str - placeholder: keywords + placeholder: keyword1,second keyword,third keyword help: Add keywords to make your package findable on PyPI github_organization: type: str From caeef1b0b9a8b51ecf4badd0d3baccfc76441ad0 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 28 Aug 2024 14:20:45 +0200 Subject: [PATCH 255/285] first version for readme --- README.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9d75c69f..472e2ada 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,16 @@ # Netherlands eScience Center Python Template -Spend less time setting up and configuring your new Python packages which includes research software good practices from the start. +Are you writing research software? Save your time on setting up and configuring your new Python packages by using this template. This [Copier-based](https://copier.readthedocs.io) template includes best practices for research software from the beginning. You can choose from various user profiles, each offering a range of features to suit your needs. -Use this [Copier](https://copier.readthedocs.io) template to generate an empty Python package. Features include: +## User profiles +- **Minimum** + As the name says is the bare minimum to get started with a Python package. +- **Recommended** + This profile is based on the Minimum and includes set of carefully selected features which we believe the users might want. However, all features can be modified by the user. +- **Let me choose** + This is a fully customizable profile. You can choose from a list of features to include in your package as you like. + +## Features - Boilerplate unit tests and documentation, - [Python static setup configuration](template/pyproject.toml.jinja), @@ -14,7 +22,7 @@ Use this [Copier](https://copier.readthedocs.io) template to generate an empty P - [README.md](template/README.md.jinja) for package users, - [README.dev.md](template/README.dev.md.jinja) for package developer, - [project_setup.md](template/project_setup.md.jinja) with extensive documentation about project setup, - - [Change log](template/%7B%25%20if%20AddChangeLog%20%25%7DCHANGELOG.md%7B%25%20endif%20%25%7D), + - [Changelog](template/%7B%25%20if%20AddChangeLog%20%25%7DCHANGELOG.md%7B%25%20endif%20%25%7D), - [Code of Conduct](template/CODE_OF_CONDUCT.md.jinja), - [Contributing guidelines](template/CONTRIBUTING.md.jinja), - Continuous code quality and code coverage reporting using [Sonarcloud](https://sonarcloud.io/), From 91ce1fc7f76bbec6ab7dba129d68693ac74b2d40 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 28 Aug 2024 14:22:23 +0200 Subject: [PATCH 256/285] render keywords in CITATION.cff --- template/{% if AddCitation %}CITATION.cff{% endif %}.jinja | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/template/{% if AddCitation %}CITATION.cff{% endif %}.jinja b/template/{% if AddCitation %}CITATION.cff{% endif %}.jinja index d8cf8a90..ab43a90a 100644 --- a/template/{% if AddCitation %}CITATION.cff{% endif %}.jinja +++ b/template/{% if AddCitation %}CITATION.cff{% endif %}.jinja @@ -12,8 +12,9 @@ doi: version: "{{ version }}" repository-code: "{{ repository_url }}" keywords: - - {{ keyword1 }} - - {{ keyword2 }} +{%- for item in keywords.split(',') %} + - "{{ item }}" +{%- endfor %} message: "If you use this software, please cite it using these metadata." {{ { "Apache Software License 2.0": "license: Apache-2.0", "MIT license": "license: MIT", From ee0926a19e908c00acc1ac84b84278ec3e087f1c Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 28 Aug 2024 14:24:44 +0200 Subject: [PATCH 257/285] fix the unit tests for keywords --- tests/test_project.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test_project.py b/tests/test_project.py index bd656545..e2d6eb0e 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -16,8 +16,7 @@ def copier_project_defaults(): return { "package_name": "my_python_package", "package_short_description": "Short description of package", - "keyword1": "keyword1", - "keyword2": "keyword2", + "keywords": "keyword1,keyword2", "version": "0.1.0", "github_organization": "", "full_name": "Jane Smith", From e159742adf8d2f92b9d3eaafc66f97f3bef0f3c1 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 28 Aug 2024 14:25:55 +0200 Subject: [PATCH 258/285] remove the keywords from publish and release menu --- copier/questions/features_publish_release.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/copier/questions/features_publish_release.yml b/copier/questions/features_publish_release.yml index 8f1d027a..1209120e 100644 --- a/copier/questions/features_publish_release.yml +++ b/copier/questions/features_publish_release.yml @@ -23,10 +23,6 @@ SelectPublishReleaseFeatures: Zenodo integration instructions: value: AddZenodo_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" - Package keywords(NOT_IMPLEMENTED): - value: not_implemented_keywords - # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" - # Sub-menus # split AddCitation --> enable_citation_file and enable_cffconvert From f555923fecaf4f5797d2a3d8e184541cc47f547f Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 28 Aug 2024 14:26:37 +0200 Subject: [PATCH 259/285] Update text --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 472e2ada..85d47c54 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ Are you writing research software? Save your time on setting up and configuring ## User profiles - **Minimum** - As the name says is the bare minimum to get started with a Python package. + As the name suggests, this profile provides the bare essentials to get started with a Python package.This is a good place to start if this is your first time writing research software. You can always add more features later. - **Recommended** - This profile is based on the Minimum and includes set of carefully selected features which we believe the users might want. However, all features can be modified by the user. + Building on the Minimum profile, this option includes a carefully selected set of features that we believe users will find useful. However, all features can be customized by the user. - **Let me choose** - This is a fully customizable profile. You can choose from a list of features to include in your package as you like. + This fully customizable profile allows you to select from a list of features to include in your package according to your preferences. ## Features From 361cefdf78ae8fdade1ca692839a18db0c750277 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 28 Aug 2024 14:27:50 +0200 Subject: [PATCH 260/285] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd611f86..ace444d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ * Make online documentation optional [#476](https://github.com/NLeSC/python-template/pull/476) ### Changed +* Update the user documentation (README.md) of the template [#575](https://github.com/NLeSC/python-template/pull/623) * added value field to license options [#617](https://github.com/NLeSC/python-template/pull/617) * fix filename typo of githooks [#611](https://github.com/NLeSC/python-template/pull/609) * next_steps.md is shown as a copier message [#609](https://github.com/NLeSC/python-template/pull/609) From 5b432f32bff53fe163280f7798b84a096ae4d000 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 28 Aug 2024 14:39:24 +0200 Subject: [PATCH 261/285] add a validator to copyright holder --- copier/questions/package_details.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/copier/questions/package_details.yml b/copier/questions/package_details.yml index 8ef406ac..2d3dd9d4 100644 --- a/copier/questions/package_details.yml +++ b/copier/questions/package_details.yml @@ -47,7 +47,10 @@ copyright_holder: type: str placeholder: Netherlands eScience Center help: Who is the copyright holder? - + validator: >- + {% if not copyright_holder %} + This field cannot be empty as it will be used in content of the generated files. + {% endif %} # calculated fields for GitHub repository: default: git@github.com:{{ github_organization }}/{{ package_name }} From f958703c33215b987a7668525e8b39d954b01a2d Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 28 Aug 2024 14:41:24 +0200 Subject: [PATCH 262/285] use the full name as default value of the copyright holder --- copier/questions/package_details.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/copier/questions/package_details.yml b/copier/questions/package_details.yml index 2d3dd9d4..e2e17672 100644 --- a/copier/questions/package_details.yml +++ b/copier/questions/package_details.yml @@ -45,8 +45,8 @@ code_of_conduct_email: {% endif %} copyright_holder: type: str - placeholder: Netherlands eScience Center - help: Who is the copyright holder? + default: "{{ full_name }}" + help: Who is the copyright holder (the default is your full name)? validator: >- {% if not copyright_holder %} This field cannot be empty as it will be used in content of the generated files. From 7f2a53facce9998c3304f82cfccd53714062f204 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 28 Aug 2024 15:45:13 +0200 Subject: [PATCH 263/285] mention the next screen for GitHub Actions --- copier/questions/features_code_quality.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier/questions/features_code_quality.yml b/copier/questions/features_code_quality.yml index b1b6bef7..ea29397f 100644 --- a/copier/questions/features_code_quality.yml +++ b/copier/questions/features_code_quality.yml @@ -14,7 +14,7 @@ SelectCodeQualityFeatures: help: Select code quality features multiselect: true choices: - GitHub Actions: + GitHub Actions (selection on the next menu): value: SelectGitHubActions_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" Linting: From 1a57008ac404b217090ee33bb9f02b51794c9273 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 28 Aug 2024 15:45:49 +0200 Subject: [PATCH 264/285] mention the next screen for citation --- copier/questions/features_publish_release.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/copier/questions/features_publish_release.yml b/copier/questions/features_publish_release.yml index 8f1d027a..3a4bd5a8 100644 --- a/copier/questions/features_publish_release.yml +++ b/copier/questions/features_publish_release.yml @@ -14,7 +14,7 @@ SelectPublishReleaseFeatures: help: Select publish and release features multiselect: true choices: - Citation: + Citation (selection on the next menu): value: SelectCitation_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" Changelog: @@ -55,17 +55,14 @@ AddCitation: type: bool default: "{{ 'AddCitationFile_flag' in SelectCitation }}" when: false - AddCFFConvert: type: bool default: "{{ 'AddCFFConvert_flag' in SelectCitation }}" when: false - AddChangeLog: type: bool default: "{{ 'AddChangeLog_flag' in SelectPublishReleaseFeatures }}" when: false - AddZenodo: type: bool default: "{{ 'AddZenodo_flag' in SelectPublishReleaseFeatures }}" From 8d33ddb9409b15ecdc166ce341316d265a780e8c Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 28 Aug 2024 15:47:05 +0200 Subject: [PATCH 265/285] skip merging CHANGELOG.md and CODE_OF_CONDUCT.md if they exist --- copier/settings.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/copier/settings.yml b/copier/settings.yml index 5457c2a9..cd2071bd 100644 --- a/copier/settings.yml +++ b/copier/settings.yml @@ -6,3 +6,5 @@ _skip_if_exists: - "pyproject.toml" - CITATION.cff - LICENSE + - CHANGELOG.md + - CODE_OF_CONDUCT.md From c3ffd45fac64db009ae64a45a310d8083b661ae7 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 28 Aug 2024 15:47:39 +0200 Subject: [PATCH 266/285] remove the whitespace from yaml files --- copier/questions/features_community.yml | 1 - copier/questions/features_documentation.yml | 1 - copier/questions/package_details.yml | 3 +-- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/copier/questions/features_community.yml b/copier/questions/features_community.yml index 802c8daa..60ffb645 100644 --- a/copier/questions/features_community.yml +++ b/copier/questions/features_community.yml @@ -26,7 +26,6 @@ AddCodeConduct: type: bool default: "{{ 'AddCodeConduct_flag' in SelectCommunityFeatures }}" when: false - AddContributing: type: bool default: "{{ 'AddContributing_flag' in SelectCommunityFeatures }}" diff --git a/copier/questions/features_documentation.yml b/copier/questions/features_documentation.yml index ab16d8f6..3e025607 100644 --- a/copier/questions/features_documentation.yml +++ b/copier/questions/features_documentation.yml @@ -26,7 +26,6 @@ AddOnlineDocumentation: type: bool default: "{{ 'AddOnlineDocumentation_flag' in SelectDocumentationFeatures }}" when: false - AddDevDoc: type: bool default: "{{ 'AddDevDoc_flag' in SelectDocumentationFeatures }}" diff --git a/copier/questions/package_details.yml b/copier/questions/package_details.yml index 79fdb68d..06f49004 100644 --- a/copier/questions/package_details.yml +++ b/copier/questions/package_details.yml @@ -59,11 +59,10 @@ copyright_holder: help: Who is the copyright holder? when: "{{ template_profile != 'minimum' and AddPackageDetails }}" -# calculated fields for GitHub +# computed fields for GitHub repository: default: git@github.com:{{ github_organization }}/{{ package_name }} when: false - repository_url: default: https://github.com/{{ github_organization }}/{{ package_name }} when: false From 1ac5d793014b06307c15c20c1be331dc304a1104 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 28 Aug 2024 15:50:03 +0200 Subject: [PATCH 267/285] update the changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd611f86..736b7656 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ * Make online documentation optional [#476](https://github.com/NLeSC/python-template/pull/476) ### Changed +* add extra info for sub-menus [#628](https://github.com/NLeSC/python-template/pull/628) +* skip merging CHANGELOG.md and CODE_OF_CONDUCT.md if they exist [#628](https://github.com/NLeSC/python-template/pull/628) * added value field to license options [#617](https://github.com/NLeSC/python-template/pull/617) * fix filename typo of githooks [#611](https://github.com/NLeSC/python-template/pull/609) * next_steps.md is shown as a copier message [#609](https://github.com/NLeSC/python-template/pull/609) From ee24e91b7f9e95c60fdbfbbd9ea2240b31a7a975 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 28 Aug 2024 17:23:15 +0200 Subject: [PATCH 268/285] add a regex to make sure github organization does not have any spaces --- copier/questions/package_details.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/copier/questions/package_details.yml b/copier/questions/package_details.yml index e2d2a3a4..2e74abd7 100644 --- a/copier/questions/package_details.yml +++ b/copier/questions/package_details.yml @@ -21,11 +21,11 @@ keywords: help: Add keywords to make your package findable on PyPI github_organization: type: str - placeholder: "" + placeholder: "your-github-username or your-github-organization" help: Enter the name of your GitHub username or organization validator: >- - {% if not github_organization %} - This field cannot be empty + {% if not (github_organization | regex_search('^\\S*$')) %} + Username or organization cannot include spaces {% endif %} email: type: str From 6a2ba420daa330e7d1df10f87ec6ea4df4ecdc11 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Wed, 28 Aug 2024 17:33:40 +0200 Subject: [PATCH 269/285] add append .git to the repository in next steps --- copier/messages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copier/messages.yml b/copier/messages.yml index 14db1545..b8bdb17e 100644 --- a/copier/messages.yml +++ b/copier/messages.yml @@ -22,7 +22,7 @@ _message_after_copy: | git add --all git commit -m "first commit" git branch -M main - git remote add origin {{ repository }} + git remote add origin {{ repository }}.git - Push the initial commit to a new repo on GitHub From a82057505c1572cf736064fd7d0bf790e10a1c89 Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 28 Aug 2024 17:42:49 +0200 Subject: [PATCH 270/285] Update template/.gitignore Co-authored-by: fdiblen <144492+fdiblen@users.noreply.github.com> --- template/.gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/template/.gitignore b/template/.gitignore index 090505b1..96146a0a 100644 --- a/template/.gitignore +++ b/template/.gitignore @@ -39,8 +39,6 @@ coverage.xml docs/_build # ide -.eclipse -.vscode # PyCharm # JetBrains specific template is maintained in a separate JetBrains.gitignore that can # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore From 6e8ad8eff126d493beeedc7298bd579f1b2769fc Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 28 Aug 2024 17:43:09 +0200 Subject: [PATCH 271/285] Update template/.gitignore Co-authored-by: fdiblen <144492+fdiblen@users.noreply.github.com> --- template/.gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/template/.gitignore b/template/.gitignore index 96146a0a..dd8a4fa2 100644 --- a/template/.gitignore +++ b/template/.gitignore @@ -21,7 +21,6 @@ share/python-wheels/ *.egg-info/ .installed.cfg *.egg -MANIFEST # jupyter notebook .ipynb_checkpoints From 8af8a863a40addce41acfd850d14961d527fb30f Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Wed, 28 Aug 2024 18:30:20 +0200 Subject: [PATCH 272/285] Update README.md Co-authored-by: fdiblen <144492+fdiblen@users.noreply.github.com> --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 85d47c54..b4014059 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Netherlands eScience Center Python Template -Are you writing research software? Save your time on setting up and configuring your new Python packages by using this template. This [Copier-based](https://copier.readthedocs.io) template includes best practices for research software from the beginning. You can choose from various user profiles, each offering a range of features to suit your needs. +Spend less time setting up and configuring your new Python packages by using this template. This [Copier](https://copier.readthedocs.io) template includes best practices for research software so your new package will include these practices from the start. + +You can choose from various user profiles, each offering a range of features to suit your needs. ## User profiles - **Minimum** From e0f013147c3b30994b8417361f7e0f15d77018df Mon Sep 17 00:00:00 2001 From: Olga Lyashevska Date: Thu, 29 Aug 2024 10:33:27 +0200 Subject: [PATCH 273/285] Update README.md Co-authored-by: fdiblen <144492+fdiblen@users.noreply.github.com> --- README.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b4014059..7617f805 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,20 @@ Spend less time setting up and configuring your new Python packages by using thi You can choose from various user profiles, each offering a range of features to suit your needs. ## User profiles -- **Minimum** - As the name suggests, this profile provides the bare essentials to get started with a Python package.This is a good place to start if this is your first time writing research software. You can always add more features later. -- **Recommended** - Building on the Minimum profile, this option includes a carefully selected set of features that we believe users will find useful. However, all features can be customized by the user. -- **Let me choose** - This fully customizable profile allows you to select from a list of features to include in your package according to your preferences. + +The template profiles for a Python package offer varying levels of customization to cater to different user needs. Below are the profiles the template offers. + +### Minimum + +This profile offers the essential features to begin developing a Python package, making it ideal for first-time research software developers. Additional features can be added as needed. + +### Recommended + +This option provides a pre-selected set of features for research software, which users can fully customize. + +### Let me choose + +This fully customizable profile enables you to selectively include or exclude features in your Python package. ## Features From 9740a3841207e0b565ba055a8e593facc4ad02ff Mon Sep 17 00:00:00 2001 From: Abel Soares Siqueira Date: Thu, 29 Aug 2024 11:52:12 +0200 Subject: [PATCH 274/285] Remove --fix from ruff tests and update template Running `ruff check` should pass without the `--fix` option. This changes to test that verifies this and updates the files in the template that would cause the test to fail. Namely, some single-quoted strings were changed to double-quoted strings. Related to #580. --- template/src/{{package_name}}/my_module.py.jinja | 6 +++--- template/tests/test_my_module.py.jinja | 10 +++++----- tests/test_project.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/template/src/{{package_name}}/my_module.py.jinja b/template/src/{{package_name}}/my_module.py.jinja index eda4d695..7248f258 100644 --- a/template/src/{{package_name}}/my_module.py.jinja +++ b/template/src/{{package_name}}/my_module.py.jinja @@ -24,7 +24,7 @@ def hello(name: str) -> str: 'Hello Jane Smith!' """ - if name == 'nobody': - msg = 'Can not say hello to nobody' + if name == "nobody": + msg = "Can not say hello to nobody" raise ValueError(msg) - return f'Hello {name}!' + return f"Hello {name}!" diff --git a/template/tests/test_my_module.py.jinja b/template/tests/test_my_module.py.jinja index 67e60785..ab73013d 100644 --- a/template/tests/test_my_module.py.jinja +++ b/template/tests/test_my_module.py.jinja @@ -5,22 +5,22 @@ from {{ package_name }}.my_module import hello def test_hello(): """Example using assert.""" - assert hello('nlesc') == 'Hello nlesc!' + assert hello("nlesc") == "Hello nlesc!" def test_hello_with_error(): """Example of testing for raised errors.""" with pytest.raises(ValueError) as excinfo: - hello('nobody') - assert 'Can not say hello to nobody' in str(excinfo.value) + hello("nobody") + assert "Can not say hello to nobody" in str(excinfo.value) @pytest.fixture def some_name(): """Example fixture.""" - return 'Jane Smith' + return "Jane Smith" def test_hello_with_fixture(some_name: str): """Example using a fixture.""" - assert hello(some_name) == 'Hello Jane Smith!' + assert hello(some_name) == "Hello Jane Smith!" diff --git a/tests/test_project.py b/tests/test_project.py index e2d6eb0e..58504fa8 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -191,7 +191,7 @@ def test_ruff_check(baked_with_development_dependencies, project_env_bin_dir): project_dir = baked_with_development_dependencies bin_dir = project_env_bin_dir - result = run([f'{bin_dir}ruff', 'check', '--fix'], project_dir) + result = run([f'{bin_dir}ruff', 'check'], project_dir) assert result.returncode == 0 assert '' in result.stdout From d0940956f945d6e917a81d32c0f0c28133dc2e21 Mon Sep 17 00:00:00 2001 From: Abel Soares Siqueira Date: Thu, 29 Aug 2024 12:24:35 +0200 Subject: [PATCH 275/285] Fix ruff instructions in template/README.dev.md Instead of 'ruff .', use 'ruff check .'. Related to #581 --- template/{% if AddDevDoc %}README.dev.md{% endif %}.jinja | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/template/{% if AddDevDoc %}README.dev.md{% endif %}.jinja b/template/{% if AddDevDoc %}README.dev.md{% endif %}.jinja index b992a0b1..a12eafcb 100644 --- a/template/{% if AddDevDoc %}README.dev.md{% endif %}.jinja +++ b/template/{% if AddDevDoc %}README.dev.md{% endif %}.jinja @@ -70,10 +70,10 @@ activated virtual environment with the development tools installed. ```shell # linter -ruff . +ruff check . # linter with automatic fixing -ruff . --fix +ruff check . --fix ``` To fix readability of your code style you can use [yapf](https://github.com/google/yapf). From c30e9a45f3d1587072034bd0c446516a77609819 Mon Sep 17 00:00:00 2001 From: Abel Soares Siqueira Date: Thu, 29 Aug 2024 14:31:38 +0200 Subject: [PATCH 276/285] Remove docs from minimum profile Introduces a question AddLocalDocumentation to control the existence of the `docs` folder. If the user selects "Online documentation", then "Local documentation" is implied. The logic behind this approach is simply to define the computed variable `AddLocalDocumentation` based on either flag. The downside is that the generated answers will still only show the online flag. Related to #593 --- CHANGELOG.md | 1 + copier/questions/features_documentation.yml | 9 ++++++++- template/project_setup.md.jinja | 2 ++ template/pyproject.toml.jinja | 6 ++++++ .../Makefile.jinja | 0 .../_templates/.gitignore | 0 .../conf.py.jinja | 0 .../index.rst.jinja | 0 .../make.bat.jinja | 0 9 files changed, 17 insertions(+), 1 deletion(-) rename template/{docs => {% if AddLocalDocumentation %}docs{% endif %}}/Makefile.jinja (100%) rename template/{docs => {% if AddLocalDocumentation %}docs{% endif %}}/_templates/.gitignore (100%) rename template/{docs => {% if AddLocalDocumentation %}docs{% endif %}}/conf.py.jinja (100%) rename template/{docs => {% if AddLocalDocumentation %}docs{% endif %}}/index.rst.jinja (100%) rename template/{docs => {% if AddLocalDocumentation %}docs{% endif %}}/make.bat.jinja (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index fae58d58..b55dd309 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ * Make SonarCloud optional [#515](https://github.com/NLeSC/python-template/pull/515) * Make citation optional [#471](https://github.com/NLeSC/python-template/pull/471) * Make online documentation optional [#476](https://github.com/NLeSC/python-template/pull/476) +* Make local documentation optional [#593](https://github.com/NLeSC/python-template/pull/593) ### Changed * Update the user documentation (README.md) of the template [#575](https://github.com/NLeSC/python-template/pull/623) diff --git a/copier/questions/features_documentation.yml b/copier/questions/features_documentation.yml index 3e025607..53c02b85 100644 --- a/copier/questions/features_documentation.yml +++ b/copier/questions/features_documentation.yml @@ -7,13 +7,16 @@ SelectDocumentationFeatures: type: yaml default: |- {% if template_profile == 'recommended' %} - [AddOnlineDocumentation_flag, AddDevDoc_flag] + [AddLocalDocumentation_flag, AddOnlineDocumentation_flag, AddDevDoc_flag] {%- else -%} [] {%- endif %} help: Select documentation features multiselect: true choices: + Local documentation: + value: AddLocalDocumentation_flag + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" Online documentation (Read the Docs): value: AddOnlineDocumentation_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" @@ -22,6 +25,10 @@ SelectDocumentationFeatures: # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" # computed features +AddLocalDocumentation: + type: bool + default: "{{ 'AddLocalDocumentation_flag' in SelectDocumentationFeatures or 'AddOnlineDocumentation_flag' in SelectDocumentationFeatures }}" + when: false AddOnlineDocumentation: type: bool default: "{{ 'AddOnlineDocumentation_flag' in SelectDocumentationFeatures }}" diff --git a/template/project_setup.md.jinja b/template/project_setup.md.jinja index 6d4a4b46..c4093c28 100644 --- a/template/project_setup.md.jinja +++ b/template/project_setup.md.jinja @@ -48,6 +48,7 @@ help you decide which tool to use for packaging. - Workflows can be found in [`.github/workflows`](.github/workflows/) - [Relevant section in the guide](https://guide.esciencecenter.nl/#/best_practices/language_guides/python?id=testing) +{% if AddLocalDocumentation -%} ## Documentation - Documentation should be put in the [`docs/`](docs/) directory. The contents have been generated using `sphinx-quickstart` (Sphinx version 1.6.5). @@ -59,6 +60,7 @@ help you decide which tool to use for packaging. - [AutoAPI](https://sphinx-autoapi.readthedocs.io/) is used to generate documentation for the package Python objects. {% if AddOnlineDocumentation %}- `.readthedocs.yaml` is the ReadTheDocs configuration file. When ReadTheDocs is building the documentation this package and its development dependencies are installed so the API reference can be rendered.{% endif -%} - [Relevant section in the guide](https://guide.esciencecenter.nl/#/best_practices/language_guides/python?id=writingdocumentation) +{%- endif %} ## Coding style conventions and code quality diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index 0ec6f942..10a61198 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -55,12 +55,14 @@ dev = [ "tox", "myst_parser", ] +{%- if AddLocalDocumentation %} docs = [ "sphinx", "sphinx_rtd_theme", "sphinx-autoapi", "myst_parser", ] +{%- endif %} publishing = [ "build", "twine", @@ -97,7 +99,9 @@ extras = dev [tool.ruff] line-length = 120 output-format = "concise" +{%- if AddLocalDocumentation %} extend-exclude = ["docs"] +{%- endif %} [tool.ruff.lint] # Allow unused variables when underscore-prefixed. @@ -149,5 +153,7 @@ filename = "pyproject.toml" filename = "CITATION.cff" {%- endif %} +{% if AddLocalDocumentation -%} [[tool.bumpversion.files]] filename = "docs/conf.py" +{%- endif %} diff --git a/template/docs/Makefile.jinja b/template/{% if AddLocalDocumentation %}docs{% endif %}/Makefile.jinja similarity index 100% rename from template/docs/Makefile.jinja rename to template/{% if AddLocalDocumentation %}docs{% endif %}/Makefile.jinja diff --git a/template/docs/_templates/.gitignore b/template/{% if AddLocalDocumentation %}docs{% endif %}/_templates/.gitignore similarity index 100% rename from template/docs/_templates/.gitignore rename to template/{% if AddLocalDocumentation %}docs{% endif %}/_templates/.gitignore diff --git a/template/docs/conf.py.jinja b/template/{% if AddLocalDocumentation %}docs{% endif %}/conf.py.jinja similarity index 100% rename from template/docs/conf.py.jinja rename to template/{% if AddLocalDocumentation %}docs{% endif %}/conf.py.jinja diff --git a/template/docs/index.rst.jinja b/template/{% if AddLocalDocumentation %}docs{% endif %}/index.rst.jinja similarity index 100% rename from template/docs/index.rst.jinja rename to template/{% if AddLocalDocumentation %}docs{% endif %}/index.rst.jinja diff --git a/template/docs/make.bat.jinja b/template/{% if AddLocalDocumentation %}docs{% endif %}/make.bat.jinja similarity index 100% rename from template/docs/make.bat.jinja rename to template/{% if AddLocalDocumentation %}docs{% endif %}/make.bat.jinja From d55fbb42c1236d0f3c331d86d287658e91e0e0f2 Mon Sep 17 00:00:00 2001 From: Abel Soares Siqueira Date: Thu, 29 Aug 2024 16:01:10 +0200 Subject: [PATCH 277/285] Remove tests from minimum profile Introduces a question AddLocalTests to control the existence of the tests folder. If the user selects 'GitHub Actions -> Build' or 'Code analysis (using SonarCloud)' then this option is also selected. Related to #594 --- CHANGELOG.md | 1 + copier/questions/features_code_quality.yml | 9 ++++++++- template/project_setup.md.jinja | 2 ++ template/pyproject.toml.jinja | 8 ++++++++ ...if AddContributing %}CONTRIBUTING.md{% endif %}.jinja | 2 ++ .../__init__.py | 0 .../test_my_module.py.jinja | 0 7 files changed, 21 insertions(+), 1 deletion(-) rename template/{tests => {% if AddLocalTests %}tests{% endif %}}/__init__.py (100%) rename template/{tests => {% if AddLocalTests %}tests{% endif %}}/test_my_module.py.jinja (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index fae58d58..e97f3abe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ * Make SonarCloud optional [#515](https://github.com/NLeSC/python-template/pull/515) * Make citation optional [#471](https://github.com/NLeSC/python-template/pull/471) * Make online documentation optional [#476](https://github.com/NLeSC/python-template/pull/476) +* Make local test optional [#594](https://github.com/NLeSC/python-template/pull/594) ### Changed * Update the user documentation (README.md) of the template [#575](https://github.com/NLeSC/python-template/pull/623) diff --git a/copier/questions/features_code_quality.yml b/copier/questions/features_code_quality.yml index ea29397f..b6e98791 100644 --- a/copier/questions/features_code_quality.yml +++ b/copier/questions/features_code_quality.yml @@ -7,13 +7,16 @@ SelectCodeQualityFeatures: type: yaml default: |- {% if template_profile == 'recommended' %} - [SelectGitHubActions_flag, AddLinting_flag, AddSonarCloud_flag, AddEditorConfig_flag] + [AddLocalTests_flag, SelectGitHubActions_flag, AddLinting_flag, AddSonarCloud_flag, AddEditorConfig_flag] {%- else -%} [] {%- endif %} help: Select code quality features multiselect: true choices: + Local tests: + value: AddLocalTests_flag + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" GitHub Actions (selection on the next menu): value: SelectGitHubActions_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" @@ -56,6 +59,10 @@ SelectGitHubActions: # computed features +AddLocalTests: + type: bool + default: "{{ 'AddLocalTests_flag' in SelectCodeQualityFeatures or 'AddGitHubActionBuild_flag' in SelectGitHubActions or 'AddSonarCloud_flag' in SelectCodeQualityFeatures }}" + when: false AddGitHubActionBuild: type: bool default: "{{ 'AddGitHubActionBuild_flag' in SelectGitHubActions }}" diff --git a/template/project_setup.md.jinja b/template/project_setup.md.jinja index 6d4a4b46..4e3aff1d 100644 --- a/template/project_setup.md.jinja +++ b/template/project_setup.md.jinja @@ -35,6 +35,7 @@ You can distribute your code using PyPI. [The guide](https://guide.esciencecenter.nl/#/best_practices/language_guides/python?id=building-and-packaging-code) can help you decide which tool to use for packaging. +{% if AddLocalTests -%} ## Testing and code coverage - Tests should be put in the `tests` folder. @@ -47,6 +48,7 @@ help you decide which tool to use for packaging. - The project uses [GitHub action workflows](https://docs.github.com/en/actions) to automatically run tests on GitHub infrastructure against multiple Python versions - Workflows can be found in [`.github/workflows`](.github/workflows/) - [Relevant section in the guide](https://guide.esciencecenter.nl/#/best_practices/language_guides/python?id=testing) +{%- endif %} ## Documentation diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index 0ec6f942..dd339db7 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -45,9 +45,11 @@ version = "{{ version }}" dev = [ "build", # build is not only used in publishing (below), but also in the template's test suite "bump-my-version", + {%- if AddLocalTests %} "coverage [toml]", "pytest", "pytest-cov", + {%- endif %} "ruff", "sphinx", "sphinx_rtd_theme", @@ -76,22 +78,28 @@ Changelog = "{{ repository_url }}/CHANGELOG.md" {% if AddOnlineDocumentation -%} ReadTheDocs = "https://{{ package_name }}.readthedocs.io" {% endif %} +{% if AddLocalTests -%} [tool.pytest.ini_options] testpaths = ["tests"] +{% endif %} +{% if AddLocalTests -%} [tool.coverage.run] branch = true source = ["src/{{ package_name }}"] command_line = "-m pytest" +{%- endif %} [tool.tox] legacy_tox_ini = """ [tox] envlist = py38,py39,py310,py311,py312 skip_missing_interpreters = true +{% if AddLocalTests -%} [testenv] commands = pytest extras = dev +{%- endif %} """ [tool.ruff] diff --git a/template/{% if AddContributing %}CONTRIBUTING.md{% endif %}.jinja b/template/{% if AddContributing %}CONTRIBUTING.md{% endif %}.jinja index 03296187..a3a845f2 100644 --- a/template/{% if AddContributing %}CONTRIBUTING.md{% endif %}.jinja +++ b/template/{% if AddContributing %}CONTRIBUTING.md{% endif %}.jinja @@ -34,8 +34,10 @@ The sections below outline the steps in each case. {% if AddDevDoc -%} 1. install dependencies (see the [development documentation](README.dev.md#development_install)); {%- endif %} +{% if AddLocalTests -%} 1. make sure the existing tests still work by running ``pytest``; 1. add your own tests (if necessary); +{%- endif %} 1. update or expand the documentation; {% if AddChangeLog -%} 1. update the `CHANGELOG.md` file with your change; diff --git a/template/tests/__init__.py b/template/{% if AddLocalTests %}tests{% endif %}/__init__.py similarity index 100% rename from template/tests/__init__.py rename to template/{% if AddLocalTests %}tests{% endif %}/__init__.py diff --git a/template/tests/test_my_module.py.jinja b/template/{% if AddLocalTests %}tests{% endif %}/test_my_module.py.jinja similarity index 100% rename from template/tests/test_my_module.py.jinja rename to template/{% if AddLocalTests %}tests{% endif %}/test_my_module.py.jinja From ff5a7e508c95f0dc458cc71a04e4433763e1043b Mon Sep 17 00:00:00 2001 From: Abel Soares Siqueira Date: Thu, 29 Aug 2024 16:42:06 +0200 Subject: [PATCH 278/285] Move AddGitHubActionDocumentation to features_documentation.yml Move AddGitHubActionDocumentation to features_documentation.yml to enable the flag AddLocalDocumentation when AddGitHubActionDocumentation is selected. Related to #593 --- copier/questions/features_code_quality.yml | 9 +-------- copier/questions/features_documentation.yml | 11 +++++++++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/copier/questions/features_code_quality.yml b/copier/questions/features_code_quality.yml index ea29397f..9d976718 100644 --- a/copier/questions/features_code_quality.yml +++ b/copier/questions/features_code_quality.yml @@ -37,7 +37,7 @@ SelectGitHubActions: type: yaml default: |- {% if template_profile == 'recommended' %} - [AddGitHubActionBuild_flag, AddGitHubActionDocumentation_flag] + [AddGitHubActionBuild_flag] {%- else -%} [] {%- endif %} @@ -47,9 +47,6 @@ SelectGitHubActions: Build: value: AddGitHubActionBuild_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" - Documentation: - value: AddGitHubActionDocumentation_flag - # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" Link checker (reports broken URLs): value: AddLinkCheck_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" @@ -60,10 +57,6 @@ AddGitHubActionBuild: type: bool default: "{{ 'AddGitHubActionBuild_flag' in SelectGitHubActions }}" when: false -AddGitHubActionDocumentation: - type: bool - default: "{{ 'AddGitHubActionDocumentation_flag' in SelectGitHubActions }}" - when: false AddLinkCheck: type: bool default: "{{ 'AddLinkCheck_flag' in SelectGitHubActions }}" diff --git a/copier/questions/features_documentation.yml b/copier/questions/features_documentation.yml index 53c02b85..6316ccbb 100644 --- a/copier/questions/features_documentation.yml +++ b/copier/questions/features_documentation.yml @@ -7,7 +7,7 @@ SelectDocumentationFeatures: type: yaml default: |- {% if template_profile == 'recommended' %} - [AddLocalDocumentation_flag, AddOnlineDocumentation_flag, AddDevDoc_flag] + [AddLocalDocumentation_flag, AddOnlineDocumentation_flag, AddDevDoc_flag, AddGitHubActionDocumentation_flag] {%- else -%} [] {%- endif %} @@ -23,11 +23,14 @@ SelectDocumentationFeatures: Developer documentation: value: AddDevDoc_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" + GitHub Action to build documentation: + value: AddGitHubActionDocumentation_flag + # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" # computed features AddLocalDocumentation: type: bool - default: "{{ 'AddLocalDocumentation_flag' in SelectDocumentationFeatures or 'AddOnlineDocumentation_flag' in SelectDocumentationFeatures }}" + default: "{{ 'AddLocalDocumentation_flag' in SelectDocumentationFeatures or 'AddOnlineDocumentation_flag' in SelectDocumentationFeatures or 'AddGitHubActionDocumentation_flag' in SelectDocumentationFeatures }}" when: false AddOnlineDocumentation: type: bool @@ -37,3 +40,7 @@ AddDevDoc: type: bool default: "{{ 'AddDevDoc_flag' in SelectDocumentationFeatures }}" when: false +AddGitHubActionDocumentation: + type: bool + default: "{{ 'AddGitHubActionDocumentation_flag' in SelectDocumentationFeatures }}" + when: false From f00781c200f05461d480c0ddd264ca1ad44a2310 Mon Sep 17 00:00:00 2001 From: Abel Soares Siqueira Date: Thu, 29 Aug 2024 16:55:33 +0200 Subject: [PATCH 279/285] Make code of conduct email conditional on AddCodeConduct Move the code_of_conduct_email question to features_community.yml and only ask it if the user selected AddCodeConduct. Related to #534 --- copier/questions/features_community.yml | 10 ++++++++++ copier/questions/package_details.yml | 8 -------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/copier/questions/features_community.yml b/copier/questions/features_community.yml index 60ffb645..36e6fb25 100644 --- a/copier/questions/features_community.yml +++ b/copier/questions/features_community.yml @@ -21,6 +21,16 @@ SelectCommunityFeatures: value: AddContributing_flag # validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}" +code_of_conduct_email: + when: "{{ 'AddCodeConduct_flag' in SelectCommunityFeatures }}" + type: str + default: "{{ email }}" + help: What is the email address to report code of conduct violations? + validator: >- + {% if not (code_of_conduct_email | regex_search('([A-Za-z0-9]+[.-_])*[A-Za-z0-9]+@[A-Za-z0-9-]+(\.[A-Z|a-z]{2,})+')) %} + Please enter a valid email address + {% endif %} + # computed features AddCodeConduct: type: bool diff --git a/copier/questions/package_details.yml b/copier/questions/package_details.yml index cd9637ed..334c9b53 100644 --- a/copier/questions/package_details.yml +++ b/copier/questions/package_details.yml @@ -35,14 +35,6 @@ email: {% if not (email | regex_search('([A-Za-z0-9]+[.-_])*[A-Za-z0-9]+@[A-Za-z0-9-]+(\.[A-Z|a-z]{2,})+')) %} Please enter a valid email address {% endif %} -code_of_conduct_email: - type: str - default: "{{ email }}" - help: What is the email address to report code of conduct violations? - validator: >- - {% if not (code_of_conduct_email | regex_search('([A-Za-z0-9]+[.-_])*[A-Za-z0-9]+@[A-Za-z0-9-]+(\.[A-Z|a-z]{2,})+')) %} - Please enter a valid email address - {% endif %} copyright_holder: type: str default: "{{ full_name }}" From f197531235a3c00aeb596830ee71c945b033ed6b Mon Sep 17 00:00:00 2001 From: Abel Soares Siqueira Date: Thu, 29 Aug 2024 17:26:15 +0200 Subject: [PATCH 280/285] Fix missing .jinja in build.yml workflow --- ...%} => {% if AddGitHubActionBuild %}build.yml{% endif %}.jinja} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename template/.github/workflows/{{% if AddGitHubActionBuild %}build.yml{% endif %} => {% if AddGitHubActionBuild %}build.yml{% endif %}.jinja} (100%) diff --git a/template/.github/workflows/{% if AddGitHubActionBuild %}build.yml{% endif %} b/template/.github/workflows/{% if AddGitHubActionBuild %}build.yml{% endif %}.jinja similarity index 100% rename from template/.github/workflows/{% if AddGitHubActionBuild %}build.yml{% endif %} rename to template/.github/workflows/{% if AddGitHubActionBuild %}build.yml{% endif %}.jinja From 2b0be3e5ee01544aa088650d5429e2a22f3db4b6 Mon Sep 17 00:00:00 2001 From: Abel Soares Siqueira Date: Thu, 29 Aug 2024 21:33:31 +0200 Subject: [PATCH 281/285] Don't add sphinx if local documentation is not selected Remove sphinx related packages from the dev list in pyproject if AddLocalDocumentation is false. Related to #593 --- template/pyproject.toml.jinja | 2 ++ 1 file changed, 2 insertions(+) diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index cb5a762c..0757ab6e 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -51,9 +51,11 @@ dev = [ "pytest-cov", {%- endif %} "ruff", + {%- if AddLocalDocumentation %} "sphinx", "sphinx_rtd_theme", "sphinx-autoapi", + {%- endif %} "tox", "myst_parser", ] From 2bd03e2e24467227e404ab0b1899e3afc8d8e993 Mon Sep 17 00:00:00 2001 From: Abel Soares Siqueira Date: Thu, 29 Aug 2024 21:44:26 +0200 Subject: [PATCH 282/285] Fix whitespace stripping in build.yml Related to #636 --- .../{% if AddGitHubActionBuild %}build.yml{% endif %}.jinja | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/template/.github/workflows/{% if AddGitHubActionBuild %}build.yml{% endif %}.jinja b/template/.github/workflows/{% if AddGitHubActionBuild %}build.yml{% endif %}.jinja index c05f29a1..bbc9d50a 100644 --- a/template/.github/workflows/{% if AddGitHubActionBuild %}build.yml{% endif %}.jinja +++ b/template/.github/workflows/{% if AddGitHubActionBuild %}build.yml{% endif %}.jinja @@ -38,7 +38,7 @@ jobs: - name: Verify that we can build the package run: python -m build -{%- if AddLinting -%} +{%- if AddLinting %} lint: name: Linting build runs-on: ubuntu-latest @@ -63,4 +63,4 @@ jobs: run: | ruff check ruff format --check -{%- endif -%} +{%- endif %} From 9716b575e8fe764f5795de848abda27159eae15a Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Fri, 30 Aug 2024 11:37:46 +0200 Subject: [PATCH 283/285] update the changelog for the release --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2555dfe0..55117537 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ ### Added +### Changed + +### Removed + +## [0.6.0] + +### Added + * Keep project_setup.md for all the profiles and remove from the menu [#576](https://github.com/NLeSC/python-template/pull/576) * Make contributing guidelines optional [#465](https://github.com/NLeSC/python-template/pull/465) * Make linting optional [#568](https://github.com/NLeSC/python-template/pull/568) From 3a7cc20f41080a0bdd439c2ceff20fb6736dd2d2 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Fri, 30 Aug 2024 11:41:38 +0200 Subject: [PATCH 284/285] update the CITATION.cff --- CITATION.cff | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CITATION.cff b/CITATION.cff index ca4e3295..93c10357 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -68,6 +68,22 @@ authors: family-names: Tjong Kim Sang given-names: Erik orcid: "https://orcid.org/0000-0002-8431-081X" + - given-names: Abel + family-names: Soares Siqueira + email: abel.s.siqueira@gmail.com + affiliation: Netherlands eScience Center + orcid: "https://orcid.org/0000-0003-4451-281X" + - given-names: Olga + family-names: Lyashevska + email: o.lyashevska@esciencecenter.nl + affiliation: Netherlands eScience Center + orcid: 'https://orcid.org/0000-0002-8686-8550' + - given-names: Sander + name-particle: van + family-names: Rijn + email: s.vanrijn@esciencecenter.nl + affiliation: Netherlands eScience Center + orcid: 'https://orcid.org/0000-0001-6159-041X' cff-version: "1.2.0" date-released: 2018-07-17 doi: 10.5281/zenodo.1310751 From 55b80edf67f781f4c92da1fe76deb7748238e644 Mon Sep 17 00:00:00 2001 From: "Faruk D." Date: Fri, 30 Aug 2024 11:43:15 +0200 Subject: [PATCH 285/285] update the version in CITATION.cff setup.cfg --- CITATION.cff | 2 +- setup.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index 93c10357..7cc7b192 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -95,4 +95,4 @@ license: Apache-2.0 message: "If you use this software, please cite it using these metadata." repository-code: "https://github.com/NLeSC/python-template" title: "Netherlands eScience Center Python Template" -version: "0.4.0" +version: "0.6.0" diff --git a/setup.cfg b/setup.cfg index ef1b53ab..18b76a6c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -22,7 +22,7 @@ name = Netherlands eScience Center Python Template project_urls = Bug Tracker = https://github.com/NLeSC/python-template/issues url = https://github.com/NLeSC/python-template -version = 0.4.0 +version = 0.6.0 [options]