From fdc58c075427093cf3afe102ae145686a52c4f62 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Wed, 14 Apr 2021 22:08:17 +0200 Subject: [PATCH 01/41] simplified usage of cookiecutter variables using derived variables in prehook --- README.md | 12 +- cookiecutter.json | 4 +- hooks/post_gen_project.py | 2 +- hooks/pre_gen_project.py | 11 +- pytest.ini | 2 +- .../.editorconfig | 0 .../.github/workflows/build.yml | 0 .../.github/workflows/cffconvert.yml | 0 .../.github/workflows/linting.yml | 0 .../.github/workflows/pypi.yml | 0 .../.gitignore | 0 .../.prospector.yml | 0 .../CHANGELOG.rst | 0 .../CITATION.cff | 4 +- .../CODE_OF_CONDUCT.rst | 0 .../CONTRIBUTING.rst | 6 +- .../LICENSE | 2 +- .../MANIFEST.in | 0 {{cookiecutter.project_name}}/NOTICE | 2 + {{cookiecutter.project_name}}/README.rst | 113 +++++++++++ .../docs/Makefile | 2 +- .../docs/_static/theme_overrides.css | 0 .../docs/_templates/.gitignore | 0 .../docs/conf.py | 22 +-- .../docs/index.rst | 6 +- .../docs/make.bat | 72 +++---- .../project_setup.rst | 6 +- .../setup.cfg | 12 +- .../setup.py | 0 .../tests/__init__.py | 0 .../tests/test_lint.py | 2 +- ...st_{{cookiecutter.derived.module_name}}.py | 6 +- .../__init__.py | 4 +- .../__version__.py | 2 +- .../{{cookiecutter.derived.module_name}}.py | 2 +- {{cookiecutter.project_slug}}/NOTICE | 2 - {{cookiecutter.project_slug}}/README.rst | 185 ------------------ ...).replace(' ', '_').replace('-', '_')}}.py | 27 --- 38 files changed, 209 insertions(+), 299 deletions(-) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/.editorconfig (100%) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/.github/workflows/build.yml (100%) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/.github/workflows/cffconvert.yml (100%) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/.github/workflows/linting.yml (100%) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/.github/workflows/pypi.yml (100%) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/.gitignore (100%) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/.prospector.yml (100%) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/CHANGELOG.rst (100%) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/CITATION.cff (72%) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/CODE_OF_CONDUCT.rst (100%) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/CONTRIBUTING.rst (86%) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/LICENSE (99%) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/MANIFEST.in (100%) create mode 100644 {{cookiecutter.project_name}}/NOTICE create mode 100644 {{cookiecutter.project_name}}/README.rst rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/docs/Makefile (91%) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/docs/_static/theme_overrides.css (100%) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/docs/_templates/.gitignore (100%) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/docs/conf.py (86%) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/docs/index.rst (66%) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/docs/make.bat (90%) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/project_setup.rst (96%) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/setup.cfg (78%) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/setup.py (100%) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/tests/__init__.py (100%) rename {{{cookiecutter.project_slug}} => {{cookiecutter.project_name}}}/tests/test_lint.py (96%) rename {{cookiecutter.project_slug}}/tests/test_{{cookiecutter.project_slug}}.py => {{cookiecutter.project_name}}/tests/test_{{cookiecutter.derived.module_name}}.py (58%) rename {{{cookiecutter.project_slug}}/{{cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}} => {{cookiecutter.project_name}}/{{cookiecutter.derived.package_name}}}/__init__.py (67%) rename {{{cookiecutter.project_slug}}/{{cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}} => {{cookiecutter.project_name}}/{{cookiecutter.derived.package_name}}}/__version__.py (78%) rename {{cookiecutter.project_slug}}/{{cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}/{{ cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}.py => {{cookiecutter.project_name}}/{{cookiecutter.derived.package_name}}/{{cookiecutter.derived.module_name}}.py (79%) delete mode 100644 {{cookiecutter.project_slug}}/NOTICE delete mode 100644 {{cookiecutter.project_slug}}/README.rst delete mode 100644 {{cookiecutter.project_slug}}/tests/test_{{ cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}.py diff --git a/README.md b/README.md index 14b0b537..352b8a6c 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,13 @@ Use this [Cookiecutter](https://cookiecutter.readthedocs.io) template to generat an empty Python package. Features include: - Boilerplate tests and documentation, -- [Python setup configuration]({{cookiecutter.project_slug}}/setup.py), +- [Python setup configuration]({{ cookiecutter.derived.project_name }}/setup.py), - Open source software license, -- [Default Github actions]({{cookiecutter.project_slug}}/.github/workflows) for building, testing and deployment +- [Default Github actions]({{ cookiecutter.derived.project_name }}/.github/workflows) for building, testing and deployment - Code style checking, -- [Editorconfig]({{cookiecutter.project_slug}}/.editorconfig), -- Miscellaneous files, such as [Change log]({{cookiecutter.project_slug}}/CHANGELOG.rst), [Code of Conduct]({{cookiecutter.project_slug}}/CODE_OF_CONDUCT.rst), and [Contributing guidelines]({{cookiecutter.project_slug}}/CONTRIBUTING.rst), -- A [README]({{cookiecutter.project_slug}}/README.rst) and [a separate document]({{cookiecutter.project_slug}}/project_setup.rst) with extensive documentation about project setup. +- [Editorconfig]({{ cookiecutter.derived.project_name }}/.editorconfig), +- Miscellaneous files, such as [Change log]({{ cookiecutter.derived.project_name }}/CHANGELOG.rst), [Code of Conduct]({{ cookiecutter.derived.project_name }}/CODE_OF_CONDUCT.rst), and [Contributing guidelines]({{ cookiecutter.derived.project_name }}/CONTRIBUTING.rst), +- A [README]({{ cookiecutter.derived.project_name }}/README.rst) and [a separate document]({{ cookiecutter.derived.project_name }}/project_setup.rst) with extensive documentation about project setup. ## Badges @@ -71,7 +71,7 @@ cookiecutter https://github.com/nlesc/python-template.git ### Step 3/3: Read about what was just generated -Good job! You have now generated the skeleton for your package. For an explanation of what's there, read on in the [project_setup.rst]({{cookiecutter.project_slug}}/project_setup.rst) file. +Good job! You have now generated the skeleton for your package. For an explanation of what's there, read on in the [project_setup.rst]({{ cookiecutter.derived.project_name }}/project_setup.rst) file. ## Examples diff --git a/cookiecutter.json b/cookiecutter.json index 35b78e2e..cc416b71 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -1,6 +1,6 @@ { - "project_name": "My Python Project", - "project_slug": "{{ cookiecutter.project_name.lower().replace(' ', '_') }}", + "project_name": "my-python-project", + "package_name": "my_python_package", "_copy_without_render": [".github/*"], "project_short_description": "", "version": "0.1.0", diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index ca8608a8..a182b0f2 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -1 +1 @@ -print("\nProject was successfully generated. For next steps, refer to file {{ cookiecutter.project_slug }}/project_setup.rst.\n") +print("\nProject was successfully generated. For next steps, refer to file {{ cookiecutter.project_name }}/project_setup.rst.\n") diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index 2ae28399..38a7d704 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -1 +1,10 @@ -pass +{{ cookiecutter.update({ + "derived": { + "project_name": cookiecutter.project_name.lower().replace("-", "_"), + "package_name": cookiecutter.package_name.lower().replace(" ", "_").replace("-", "_"), + "module_name": cookiecutter.package_name.lower().replace(" ", "_").replace("-", "_"), + "full_name": cookiecutter.full_name.replace('\"', '\\\"'), + "repository": "https://github.com/" + cookiecutter.github_organization + "/" + cookiecutter.project_name.lower().replace("-", "_"), + "project_short_description": cookiecutter.project_short_description.replace('\"', '\\\"') + } +}) }} diff --git a/pytest.ini b/pytest.ini index 654e568a..608fab57 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,2 +1,2 @@ [pytest] -norecursedirs = .git docs */{{cookiecutter.project_slug}}/* +norecursedirs = .git docs */{{cookiecutter.derived.project_name}}/* diff --git a/{{cookiecutter.project_slug}}/.editorconfig b/{{cookiecutter.project_name}}/.editorconfig similarity index 100% rename from {{cookiecutter.project_slug}}/.editorconfig rename to {{cookiecutter.project_name}}/.editorconfig diff --git a/{{cookiecutter.project_slug}}/.github/workflows/build.yml b/{{cookiecutter.project_name}}/.github/workflows/build.yml similarity index 100% rename from {{cookiecutter.project_slug}}/.github/workflows/build.yml rename to {{cookiecutter.project_name}}/.github/workflows/build.yml diff --git a/{{cookiecutter.project_slug}}/.github/workflows/cffconvert.yml b/{{cookiecutter.project_name}}/.github/workflows/cffconvert.yml similarity index 100% rename from {{cookiecutter.project_slug}}/.github/workflows/cffconvert.yml rename to {{cookiecutter.project_name}}/.github/workflows/cffconvert.yml diff --git a/{{cookiecutter.project_slug}}/.github/workflows/linting.yml b/{{cookiecutter.project_name}}/.github/workflows/linting.yml similarity index 100% rename from {{cookiecutter.project_slug}}/.github/workflows/linting.yml rename to {{cookiecutter.project_name}}/.github/workflows/linting.yml diff --git a/{{cookiecutter.project_slug}}/.github/workflows/pypi.yml b/{{cookiecutter.project_name}}/.github/workflows/pypi.yml similarity index 100% rename from {{cookiecutter.project_slug}}/.github/workflows/pypi.yml rename to {{cookiecutter.project_name}}/.github/workflows/pypi.yml diff --git a/{{cookiecutter.project_slug}}/.gitignore b/{{cookiecutter.project_name}}/.gitignore similarity index 100% rename from {{cookiecutter.project_slug}}/.gitignore rename to {{cookiecutter.project_name}}/.gitignore diff --git a/{{cookiecutter.project_slug}}/.prospector.yml b/{{cookiecutter.project_name}}/.prospector.yml similarity index 100% rename from {{cookiecutter.project_slug}}/.prospector.yml rename to {{cookiecutter.project_name}}/.prospector.yml diff --git a/{{cookiecutter.project_slug}}/CHANGELOG.rst b/{{cookiecutter.project_name}}/CHANGELOG.rst similarity index 100% rename from {{cookiecutter.project_slug}}/CHANGELOG.rst rename to {{cookiecutter.project_name}}/CHANGELOG.rst diff --git a/{{cookiecutter.project_slug}}/CITATION.cff b/{{cookiecutter.project_name}}/CITATION.cff similarity index 72% rename from {{cookiecutter.project_slug}}/CITATION.cff rename to {{cookiecutter.project_name}}/CITATION.cff index 42b2d040..328b52b9 100644 --- a/{{cookiecutter.project_slug}}/CITATION.cff +++ b/{{cookiecutter.project_name}}/CITATION.cff @@ -1,7 +1,7 @@ # YAML 1.2 --- cff-version: "1.1.0" -title: "{{ cookiecutter.project_name }}" +title: "{{ cookiecutter.derived.project_name }}" authors: - family-names: "{{ cookiecutter.full_name }}" @@ -10,7 +10,7 @@ authors: date-released: 20??-MM-DD doi: version: "{{ cookiecutter.version }}" -repository-code: "https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }}" +repository-code: "{{ cookiecutter.derived.repository }}" identifiers: keywords: message: "If you use this software, please cite it using these metadata." diff --git a/{{cookiecutter.project_slug}}/CODE_OF_CONDUCT.rst b/{{cookiecutter.project_name}}/CODE_OF_CONDUCT.rst similarity index 100% rename from {{cookiecutter.project_slug}}/CODE_OF_CONDUCT.rst rename to {{cookiecutter.project_name}}/CODE_OF_CONDUCT.rst diff --git a/{{cookiecutter.project_slug}}/CONTRIBUTING.rst b/{{cookiecutter.project_name}}/CONTRIBUTING.rst similarity index 86% rename from {{cookiecutter.project_slug}}/CONTRIBUTING.rst rename to {{cookiecutter.project_name}}/CONTRIBUTING.rst index 8519f108..1fe1308a 100644 --- a/{{cookiecutter.project_slug}}/CONTRIBUTING.rst +++ b/{{cookiecutter.project_name}}/CONTRIBUTING.rst @@ -15,14 +15,14 @@ The sections below outline the steps in each case. You have a question ******************* -#. use the search functionality `here `__ to see if someone already filed the same issue; +#. use the search functionality `here <{{ cookiecutter.derived.repository }}/issues>`__ to see if someone already filed the same issue; #. if your issue search did not yield any relevant results, make a new issue; #. apply the "Question" label; apply other labels when relevant. You think you may have found a bug ********************************** -#. use the search functionality `here `__ to see if someone already filed the same issue; +#. use the search functionality `here <{{ cookiecutter.derived.repository }}/issues>`__ to see if someone already filed the same issue; #. 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 `_ of the commit that is causing your problem; - some identifying information (name and version number) for dependencies you're using; @@ -38,7 +38,7 @@ You want to make some kind of change to the code base #. make sure the existing tests still work by running ``python setup.py test``; #. add your own tests (if necessary); #. update or expand the documentation; -#. `push `_ your feature branch to (your fork of) the {{ cookiecutter.project_name }} repository on GitHub; +#. `push `_ your feature branch to (your fork of) the {{ cookiecutter.derived.project_name }} repository on GitHub; #. create the pull request, e.g. following the instructions `here `__. 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. diff --git a/{{cookiecutter.project_slug}}/LICENSE b/{{cookiecutter.project_name}}/LICENSE similarity index 99% rename from {{cookiecutter.project_slug}}/LICENSE rename to {{cookiecutter.project_name}}/LICENSE index b90d2a92..6402ced5 100644 --- a/{{cookiecutter.project_slug}}/LICENSE +++ b/{{cookiecutter.project_name}}/LICENSE @@ -24,7 +24,7 @@ are permitted provided that the following conditions are met: list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -* Neither the name of {{ cookiecutter.project_name }} nor the names of its +* Neither the name of {{ cookiecutter.derived.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. diff --git a/{{cookiecutter.project_slug}}/MANIFEST.in b/{{cookiecutter.project_name}}/MANIFEST.in similarity index 100% rename from {{cookiecutter.project_slug}}/MANIFEST.in rename to {{cookiecutter.project_name}}/MANIFEST.in diff --git a/{{cookiecutter.project_name}}/NOTICE b/{{cookiecutter.project_name}}/NOTICE new file mode 100644 index 00000000..771a9a3a --- /dev/null +++ b/{{cookiecutter.project_name}}/NOTICE @@ -0,0 +1,2 @@ +This product includes {{ cookiecutter.derived.package_name }}, software developed by +{{ cookiecutter.copyright_holder }}. diff --git a/{{cookiecutter.project_name}}/README.rst b/{{cookiecutter.project_name}}/README.rst new file mode 100644 index 00000000..d39c3a15 --- /dev/null +++ b/{{cookiecutter.project_name}}/README.rst @@ -0,0 +1,113 @@ +.. list-table:: + :widths: 25 25 + :header-rows: 1 + + * - fair-software.nl recommendations + - Badges + * - \1. Code repository + - |GitHub Badge| + * - \2. License + - |License Badge| + * - \3. Community Registry + - |PyPI Badge| |Research Software Directory Badge| + * - \4. Enable Citation + - |Zenodo Badge| + * - \5. Checklist + - |CII Best Practices Badge| + * - **Other best practices** + - + * - Continuous integration + - |Python Build| |PyPI Publish| + * - Metadata consistency + - |metadata consistency| + +(Customize these badges with your own links, and check https://shields.io/ or https://badgen.net/ to see which other badges are available.) + +.. |GitHub Badge| image:: https://img.shields.io/badge/github-repo-000.svg?logo=github&labelColor=gray&color=blue + :target: {{ cookiecutter.derived.repository }} + :alt: GitHub Badge + +.. |License Badge| image:: https://img.shields.io/github/license/{{ cookiecutter.github_organization }}/{{ cookiecutter.derived.project_name }} + :target: {{ cookiecutter.derived.repository }} + :alt: License Badge + +.. |PyPI Badge| image:: https://img.shields.io/pypi/v/{{ cookiecutter.derived.project_name }}.svg?colorB=blue + :target: https://pypi.python.org/project/{{ cookiecutter.derived.project_name }}/ + :alt: PyPI Badge + +.. |Research Software Directory Badge| image:: https://img.shields.io/badge/rsd-{{ cookiecutter.derived.project_name }}-00a3e3.svg + :target: https://www.research-software.nl/software/{{ cookiecutter.derived.project_name }} + :alt: Research Software Directory Badge + +.. + Goto https://zenodo.org/account/settings/github/ to enable Zenodo/GitHub integration. + After creation of a GitHub release at {{ cookiecutter.derived.repository }}/releases + there will be a Zenodo upload created at https://zenodo.org/deposit with a DOI, this DOI can be put in the Zenodo badge urls. + In the README, we prefer to use the concept DOI over versioned DOI, see https://help.zenodo.org/#versioning. +.. |Zenodo Badge| image:: https://zenodo.org/badge/DOI/< replace with created DOI >.svg + :target: https://doi.org/ + :alt: Zenodo Badge + +.. + A CII Best Practices project can be created at https://bestpractices.coreinfrastructure.org/en/projects/new +.. |CII Best Practices Badge| image:: https://bestpractices.coreinfrastructure.org/projects/< replace with created project identifier >/badge + :target: https://bestpractices.coreinfrastructure.org/projects/< replace with created project identifier > + :alt: CII Best Practices Badge + +.. |Python Build| image:: {{ cookiecutter.derived.repository }}/workflows/Python/badge.svg + :target: {{ cookiecutter.derived.repository }}/actions?query=workflow%3A%22Python%22 + :alt: Python Build + +.. |PyPI Publish| image:: {{ cookiecutter.derived.repository }}/workflows/PyPI/badge.svg + :target: {{ cookiecutter.derived.repository }}/actions?query=workflow%3A%22PyPI%22 + :alt: PyPI Publish + +.. |metadata consistency| image:: {{ cookiecutter.derived.repository }}/workflows/cffconvert/badge.svg + :target: {{ cookiecutter.derived.repository }}/actions?query=workflow%3A%22cffconvert%22 + :alt: metadata consistency badge + +################################################################################ +{{ cookiecutter.derived.project_name }} +################################################################################ + +{{ cookiecutter.derived.project_short_description }} + + +The project setup is documented in `a separate document `_. Feel free to remove this document (and/or the link to this document) if you don't need it. + +Installation +------------ + +To install {{ cookiecutter.derived.project_name }}, do: + +.. code-block:: console + + git clone {{ cookiecutter.derived.repository }}.git + cd {{ cookiecutter.derived.project_name }} + python3 -m pip install . + + +Run tests (including coverage) with: + +.. code-block:: console + + python3 setup.py test + + +Documentation +************* + +.. _README: + +Include a link to your project's full documentation here. + +Contributing +************ + +If you want to contribute to the development of {{ cookiecutter.derived.project_name }}, +have a look at the `contribution guidelines `_. + +Credits +******* + +This package was created with `Cookiecutter `_ and the `NLeSC/python-template `_. diff --git a/{{cookiecutter.project_slug}}/docs/Makefile b/{{cookiecutter.project_name}}/docs/Makefile similarity index 91% rename from {{cookiecutter.project_slug}}/docs/Makefile rename to {{cookiecutter.project_name}}/docs/Makefile index c9bd5465..85ef3aa9 100644 --- a/{{cookiecutter.project_slug}}/docs/Makefile +++ b/{{cookiecutter.project_name}}/docs/Makefile @@ -4,7 +4,7 @@ # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build -SPHINXPROJ = {{ cookiecutter.project_slug }} +SPHINXPROJ = {{ cookiecutter.derived.project_name }} SOURCEDIR = . BUILDDIR = _build diff --git a/{{cookiecutter.project_slug}}/docs/_static/theme_overrides.css b/{{cookiecutter.project_name}}/docs/_static/theme_overrides.css similarity index 100% rename from {{cookiecutter.project_slug}}/docs/_static/theme_overrides.css rename to {{cookiecutter.project_name}}/docs/_static/theme_overrides.css diff --git a/{{cookiecutter.project_slug}}/docs/_templates/.gitignore b/{{cookiecutter.project_name}}/docs/_templates/.gitignore similarity index 100% rename from {{cookiecutter.project_slug}}/docs/_templates/.gitignore rename to {{cookiecutter.project_name}}/docs/_templates/.gitignore diff --git a/{{cookiecutter.project_slug}}/docs/conf.py b/{{cookiecutter.project_name}}/docs/conf.py similarity index 86% rename from {{cookiecutter.project_slug}}/docs/conf.py rename to {{cookiecutter.project_name}}/docs/conf.py index 8ac69f11..bec400d9 100644 --- a/{{cookiecutter.project_slug}}/docs/conf.py +++ b/{{cookiecutter.project_name}}/docs/conf.py @@ -1,4 +1,4 @@ -# {{ cookiecutter.project_slug }} documentation build configuration file, created by +# {{ cookiecutter.derived.project_name }} documentation build configuration file, created by # sphinx-quickstart on {% now "local", "%a %b %d %H:%M:%S %Y" %}. # # This file is execfile()d with the current directory set to its @@ -17,7 +17,7 @@ import os import sys -import {{ cookiecutter.project_slug.lower().replace(" ", "_").replace("-", "_")}} +import {{ cookiecutter.derived.project_name }} here = os.path.dirname(__file__) sys.path.insert(0, os.path.abspath(os.path.join(here, ".."))) @@ -56,9 +56,9 @@ # built documents. # # The short X.Y version. -version = {{ cookiecutter.project_slug.lower().replace(" ", "_").replace("-", "_")}}.__version__ +version = {{ cookiecutter.derived.project_name }}.__version__ # The full version, including alpha/beta/rc tags. -release = {{ cookiecutter.project_slug.lower().replace(" ", "_").replace("-", "_")}}.__version__ +release = {{ cookiecutter.derived.project_name }}.__version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -84,7 +84,7 @@ def run_apidoc(_): here = os.path.dirname(__file__) out = os.path.abspath(os.path.join(here, "apidocs")) - src = os.path.abspath(os.path.join(here, "..", "{{ cookiecutter.project_slug }}")) + src = os.path.abspath(os.path.join(here, "..", "{{ cookiecutter.derived.project_name }}")) ignore_paths = [] @@ -151,7 +151,7 @@ def setup(app): # -- Options for HTMLHelp output ------------------------------------------ # Output file base name for HTML help builder. -htmlhelp_basename = "{{ cookiecutter.project_slug}}_doc" +htmlhelp_basename = "{{ cookiecutter.derived.project_name }}_doc" # -- Options for LaTeX output --------------------------------------------- @@ -178,8 +178,8 @@ def setup(app): # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (main_doc, "{{ cookiecutter.project_slug }}.tex", u"{{ cookiecutter.project_name }} Documentation", - u"{{ cookiecutter.full_name.replace('\"', '\\\"') }}", "manual"), + (main_doc, "{{ cookiecutter.derived.project_name }}.tex", u"{{ cookiecutter.project_name }} Documentation", + u"{{ cookiecutter.derived.full_name }}", "manual"), ] @@ -188,7 +188,7 @@ def setup(app): # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (main_doc, "{{ cookiecutter.project_slug }}", u"{{ cookiecutter.project_name }} Documentation", + (main_doc, "{{ cookiecutter.derived.project_name }}", u"{{ cookiecutter.project_name }} Documentation", [author], 1) ] @@ -199,7 +199,7 @@ def setup(app): # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (main_doc, "{{ cookiecutter.project_slug }}", u"{{ cookiecutter.project_name }} Documentation", - author, "{{ cookiecutter.project_slug }}", "{{ cookiecutter.project_short_description.replace('\"', '\\\"') }}", + (main_doc, "{{ cookiecutter.derived.project_name }}", u"{{ cookiecutter.project_name }} Documentation", + author, "{{ cookiecutter.derived.project_name }}", "{{ cookiecutter.derived.project_short_description }}", "Miscellaneous"), ] diff --git a/{{cookiecutter.project_slug}}/docs/index.rst b/{{cookiecutter.project_name}}/docs/index.rst similarity index 66% rename from {{cookiecutter.project_slug}}/docs/index.rst rename to {{cookiecutter.project_name}}/docs/index.rst index 42699fa9..66d74ad3 100644 --- a/{{cookiecutter.project_slug}}/docs/index.rst +++ b/{{cookiecutter.project_name}}/docs/index.rst @@ -1,9 +1,9 @@ -.. {{ cookiecutter.project_name }} documentation main file, created by +.. {{ cookiecutter.derived.project_name }} documentation main file, created by sphinx-quickstart on Thu Jun 21 11:07:11 2018. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -Welcome to {{ cookiecutter.project_name }}'s documentation! +Welcome to {{ cookiecutter.derived.project_name }}'s documentation! ========================================================== .. toctree:: @@ -17,7 +17,7 @@ API Reference .. toctree:: :maxdepth: 2 - {{ cookiecutter.project_slug }} + {{ cookiecutter.derived.project_name }} {% endif %} Indices and tables diff --git a/{{cookiecutter.project_slug}}/docs/make.bat b/{{cookiecutter.project_name}}/docs/make.bat similarity index 90% rename from {{cookiecutter.project_slug}}/docs/make.bat rename to {{cookiecutter.project_name}}/docs/make.bat index 0b6441cc..9b8a936f 100644 --- a/{{cookiecutter.project_slug}}/docs/make.bat +++ b/{{cookiecutter.project_name}}/docs/make.bat @@ -1,36 +1,36 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=. -set BUILDDIR=_build -set SPHINXPROJ={{ cookiecutter.project_slug }} - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% - -:end -popd +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build +set SPHINXPROJ={{ cookiecutter.derived.project_name }} + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% + +:end +popd diff --git a/{{cookiecutter.project_slug}}/project_setup.rst b/{{cookiecutter.project_name}}/project_setup.rst similarity index 96% rename from {{cookiecutter.project_slug}}/project_setup.rst rename to {{cookiecutter.project_name}}/project_setup.rst index 3844d9d1..3bc75f42 100644 --- a/{{cookiecutter.project_slug}}/project_setup.rst +++ b/{{cookiecutter.project_name}}/project_setup.rst @@ -16,7 +16,7 @@ We recommend using `git `_ and `github `_ @@ -118,7 +118,7 @@ Package version number ---------------------- * We recommend using `semantic versioning `_. -* For convenience, the package version is stored in a single place: ``{{ cookiecutter.project_slug }}/__version__.py``. For updating the version number, you only have to change this file. +* For convenience, the package version is stored in a single place: ``{{ cookiecutter.derived.project_name }}/__version__.py``. For updating the version number, you only have to change this file. * Don't forget to update the version number before `making a release `_! diff --git a/{{cookiecutter.project_slug}}/setup.cfg b/{{cookiecutter.project_name}}/setup.cfg similarity index 78% rename from {{cookiecutter.project_slug}}/setup.cfg rename to {{cookiecutter.project_name}}/setup.cfg index fa4b721a..1a54a4e1 100644 --- a/{{cookiecutter.project_slug}}/setup.cfg +++ b/{{cookiecutter.project_name}}/setup.cfg @@ -22,13 +22,13 @@ classifiers = Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 -description = {{ cookiecutter.project_short_description }} +description = {{ cookiecutter.derived.project_short_description }} long_description = file: README.md long_description_content_type = text/markdown -name = {{ cookiecutter.project_slug.lower().replace(" ", "_").replace("-", "_")}} +name = {{ cookiecutter.derived.package_name }} project_urls = - Bug Tracker = https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug.lower().replace(" ", "_").replace("-", "_") }}/issues -url = "https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug.lower().replace(" ", "_").replace("-", "_") }} + Bug Tracker = {{ cookiecutter.derived.repository }}/issues +url = {{ cookiecutter.derived.repository }} version = {{ cookiecutter.version }} @@ -36,7 +36,7 @@ version = {{ cookiecutter.version }} zip_safe = False include_package_data = True packages = - {{ cookiecutter.project_slug.lower().replace(" ", "_").replace("-", "_")}} + {{ cookiecutter.derived.package_name }} install_requires = @@ -66,7 +66,7 @@ test=pytest [coverage:run] branch = True -source = {{ cookiecutter.project_slug }} +source = {{ cookiecutter.derived.package_name }} [tool:pytest] testpaths = tests diff --git a/{{cookiecutter.project_slug}}/setup.py b/{{cookiecutter.project_name}}/setup.py similarity index 100% rename from {{cookiecutter.project_slug}}/setup.py rename to {{cookiecutter.project_name}}/setup.py diff --git a/{{cookiecutter.project_slug}}/tests/__init__.py b/{{cookiecutter.project_name}}/tests/__init__.py similarity index 100% rename from {{cookiecutter.project_slug}}/tests/__init__.py rename to {{cookiecutter.project_name}}/tests/__init__.py diff --git a/{{cookiecutter.project_slug}}/tests/test_lint.py b/{{cookiecutter.project_name}}/tests/test_lint.py similarity index 96% rename from {{cookiecutter.project_slug}}/tests/test_lint.py rename to {{cookiecutter.project_name}}/tests/test_lint.py index 1dabe34c..5574fb71 100644 --- a/{{cookiecutter.project_slug}}/tests/test_lint.py +++ b/{{cookiecutter.project_name}}/tests/test_lint.py @@ -8,7 +8,7 @@ def test_pep8_conformance(): """Test that we conform to PEP-8.""" check_paths = [ - "{{ cookiecutter.project_slug }}", + "{{ cookiecutter.derived.project_name }}", "tests", ] exclude_paths = [] diff --git a/{{cookiecutter.project_slug}}/tests/test_{{cookiecutter.project_slug}}.py b/{{cookiecutter.project_name}}/tests/test_{{cookiecutter.derived.module_name}}.py similarity index 58% rename from {{cookiecutter.project_slug}}/tests/test_{{cookiecutter.project_slug}}.py rename to {{cookiecutter.project_name}}/tests/test_{{cookiecutter.derived.module_name}}.py index 787e4ed0..27e5065b 100644 --- a/{{cookiecutter.project_slug}}/tests/test_{{cookiecutter.project_slug}}.py +++ b/{{cookiecutter.project_name}}/tests/test_{{cookiecutter.derived.module_name}}.py @@ -1,10 +1,10 @@ #!/usr/bin/env python -"""Tests for the {{ cookiecutter.project_slug }} module. +"""Tests for the {{ cookiecutter.derived.package_name }} module. """ import pytest -from {{ cookiecutter.project_slug }} import {{ cookiecutter.project_slug }} +from {{ cookiecutter.derived.package_name }} import {{ cookiecutter.derived.package_name }} def test_something(): @@ -23,5 +23,5 @@ def an_object(): return {} -def test_{{ cookiecutter.project_slug }}(an_object): +def test_{{ cookiecutter.derived.package_name }}(an_object): assert an_object == {} diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}/__init__.py b/{{cookiecutter.project_name}}/{{cookiecutter.derived.package_name}}/__init__.py similarity index 67% rename from {{cookiecutter.project_slug}}/{{cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}/__init__.py rename to {{cookiecutter.project_name}}/{{cookiecutter.derived.package_name}}/__init__.py index 5662392c..d2d22c0e 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}/__init__.py +++ b/{{cookiecutter.project_name}}/{{cookiecutter.derived.package_name}}/__init__.py @@ -1,9 +1,9 @@ -{% if cookiecutter.apidoc == "yes" %}"""Documentation about {{ cookiecutter.project_name }}"""{% endif %} +{% if cookiecutter.apidoc == "yes" %}"""Documentation about {{ cookiecutter.derived.package_name }}"""{% endif %} import logging from .__version__ import __version__ logging.getLogger(__name__).addHandler(logging.NullHandler()) -__author__ = "{{ cookiecutter.full_name.replace('\"', '\\\"') }}" +__author__ = "{{ cookiecutter.derived.full_name }}" __email__ = "{{ cookiecutter.email }}" diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}/__version__.py b/{{cookiecutter.project_name}}/{{cookiecutter.derived.package_name}}/__version__.py similarity index 78% rename from {{cookiecutter.project_slug}}/{{cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}/__version__.py rename to {{cookiecutter.project_name}}/{{cookiecutter.derived.package_name}}/__version__.py index 166880b8..d3461fe2 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}/__version__.py +++ b/{{cookiecutter.project_name}}/{{cookiecutter.derived.package_name}}/__version__.py @@ -2,7 +2,7 @@ import sys # To update the package version number, edit CITATION.cff -citationfile = os.path.join(sys.exec_prefix, "citation/{{ cookiecutter.project_slug.lower().replace(" ", "_").replace("-", "_")}}", "CITATION.cff") +citationfile = os.path.join(sys.exec_prefix, "citation/{{ cookiecutter.derived.project_name }}", "CITATION.cff") with open(citationfile, "r") as cff: for line in cff: if "version:" in line: diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}/{{ cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}.py b/{{cookiecutter.project_name}}/{{cookiecutter.derived.package_name}}/{{cookiecutter.derived.module_name}}.py similarity index 79% rename from {{cookiecutter.project_slug}}/{{cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}/{{ cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}.py rename to {{cookiecutter.project_name}}/{{cookiecutter.derived.package_name}}/{{cookiecutter.derived.module_name}}.py index 688a51c6..fbfb2174 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}/{{ cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}.py +++ b/{{cookiecutter.project_name}}/{{cookiecutter.derived.package_name}}/{{cookiecutter.derived.module_name}}.py @@ -1,4 +1,4 @@ -{%-if cookiecutter.apidoc == "yes" %}"""Documentation about the {{ cookiecutter.project_name }} module."""{% endif %} +{%-if cookiecutter.apidoc == "yes" %}"""Documentation about the {{ cookiecutter.derived.package_name }} module."""{% endif %} import logging logger = logging.getLogger(__name__) diff --git a/{{cookiecutter.project_slug}}/NOTICE b/{{cookiecutter.project_slug}}/NOTICE deleted file mode 100644 index dee13fd5..00000000 --- a/{{cookiecutter.project_slug}}/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -This product includes {{ cookiecutter.project_name }}, software developed by -{{ cookiecutter.copyright_holder }}. diff --git a/{{cookiecutter.project_slug}}/README.rst b/{{cookiecutter.project_slug}}/README.rst deleted file mode 100644 index add1c986..00000000 --- a/{{cookiecutter.project_slug}}/README.rst +++ /dev/null @@ -1,185 +0,0 @@ -.. list-table:: - :widths: 25 25 - :header-rows: 1 - - * - fair-software.nl recommendations - - Badges - * - \1. Code repository - - |GitHub Badge| - * - \2. License - - |License Badge| - * - \3. Community Registry - - |PyPI Badge| |Research Software Directory Badge| - * - \4. Enable Citation - - |Zenodo Badge| - * - \5. Checklist - - |CII Best Practices Badge| - * - **Other best practices** - - - * - Continuous integration - - |Python Build| |PyPI Publish| - * - Metadata consistency - - |metadata consistency| - -(Customize these badges with your own links, and check https://shields.io/ or https://badgen.net/ to see which other badges are available.) - -.. |GitHub Badge| image:: https://img.shields.io/badge/github-repo-000.svg?logo=github&labelColor=gray&color=blue - :target: https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }} - :alt: GitHub Badge - -.. |License Badge| image:: https://img.shields.io/github/license/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }} - :target: https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }} - :alt: License Badge - -.. |PyPI Badge| image:: https://img.shields.io/pypi/v/{{ cookiecutter.project_slug }}.svg?colorB=blue - :target: https://pypi.python.org/project/{{ cookiecutter.project_slug }}/ - :alt: PyPI Badge -.. |Research Software Directory Badge| image:: https://img.shields.io/badge/rsd-{{ cookiecutter.project_slug }}-00a3e3.svg - :target: https://www.research-software.nl/software/{{ cookiecutter.project_slug }} - :alt: Research Software Directory Badge - -.. - Goto https://zenodo.org/account/settings/github/ to enable Zenodo/GitHub integration. - After creation of a GitHub release at https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }}/releases - there will be a Zenodo upload created at https://zenodo.org/deposit with a DOI, this DOI can be put in the Zenodo badge urls. - In the README, we prefer to use the concept DOI over versioned DOI, see https://help.zenodo.org/#versioning. -.. |Zenodo Badge| image:: https://zenodo.org/badge/DOI/< replace with created DOI >.svg - :target: https://doi.org/ - :alt: Zenodo Badge - -.. - A CII Best Practices project can be created at https://bestpractices.coreinfrastructure.org/en/projects/new -.. |CII Best Practices Badge| image:: https://bestpractices.coreinfrastructure.org/projects/< replace with created project identifier >/badge - :target: https://bestpractices.coreinfrastructure.org/projects/< replace with created project identifier > - :alt: CII Best Practices Badge - -.. |Python Build| image:: https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }}/workflows/Python/badge.svg - :target: https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }}/actions?query=workflow%3A%22Python%22 - :alt: Python Build - -.. |PyPI Publish| image:: https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }}/workflows/PyPI/badge.svg - :target: https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }}/actions?query=workflow%3A%22PyPI%22 - :alt: PyPI Publish - -.. |metadata consistency| image:: https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }}/workflows/cffconvert/badge.svg - :target: https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }}/actions?query=workflow%3A%22cffconvert%22 - :alt: metadata consistency badge - -################################################################################ -{{ cookiecutter.project_name }} -################################################################################ - -{{ cookiecutter.project_short_description }} - - -The project setup is documented in `a separate document `_. Feel free to remove this document (and/or the link to this document) if you don't need it. - -Installation ------------- - -To install {{ cookiecutter.project_slug }}, do: - -.. code-block:: console - - git clone https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }}.git - cd {{ cookiecutter.project_slug }} - pip3 install . - - -Run tests (including coverage) with: - -.. code-block:: console - - python setup.py test - - -Documentation -************* - -.. _README: - -Include a link to your project's full documentation here. - -Contributing -************ - -If you want to contribute to the development of {{ cookiecutter.project_name }}, -have a look at the `contribution guidelines `_. - -License -******* - -Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.copyright_holder }} -{% if cookiecutter.open_source_license == 'MIT license' %} -Licensed under the MIT License. - -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.open_source_license == 'BSD license' %} -Licensed under the 3-clause BSD License. - -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.copyright_holder }} 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.open_source_license == 'ISC license' %} -Licensed under the ISC License. - -Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -{% elif cookiecutter.open_source_license == 'Apache Software License 2.0' %} -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.open_source_license == 'GNU General Public License v3 or later' %} -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -{% endif %} - -Credits -******* - -This package was created with `Cookiecutter `_ and the `NLeSC/python-template `_. diff --git a/{{cookiecutter.project_slug}}/tests/test_{{ cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}.py b/{{cookiecutter.project_slug}}/tests/test_{{ cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}.py deleted file mode 100644 index 3af334fe..00000000 --- a/{{cookiecutter.project_slug}}/tests/test_{{ cookiecutter.project_slug.lower().replace(' ', '_').replace('-', '_')}}.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python - -"""Tests for the {{ cookiecutter.project_slug.lower().replace(" ", "_").replace("-", "_")}} module. -""" -import pytest - -from {{ cookiecutter.project_slug.lower().replace(" ", "_").replace("-", "_")}} import {{ cookiecutter.project_slug.lower().replace(" ", "_").replace("-", "_")}} - - -def test_something(): - assert True - - -def test_with_error(): - with pytest.raises(ValueError): - # Do something that raises a ValueError - raise(ValueError) - - -# Fixture example -@pytest.fixture -def an_object(): - return {} - - -def test_{{ cookiecutter.project_slug.lower().replace(" ", "_").replace("-", "_")}}(an_object): - assert an_object == {} From c22fbc66236a12b3e0b7543b6d683aae45817554 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Wed, 14 Apr 2021 23:25:21 +0200 Subject: [PATCH 02/41] all works except top level dirname uses pre-update value --- README.md | 12 +++--- cookiecutter.json | 2 +- hooks/pre_gen_project.py | 14 +++---- pytest.ini | 2 +- {{cookiecutter.project_name}}/CITATION.cff | 4 +- .../CONTRIBUTING.rst | 6 +-- {{cookiecutter.project_name}}/LICENSE | 2 +- {{cookiecutter.project_name}}/NOTICE | 2 +- {{cookiecutter.project_name}}/README.rst | 40 +++++++++---------- {{cookiecutter.project_name}}/docs/Makefile | 2 +- {{cookiecutter.project_name}}/docs/conf.py | 22 +++++----- {{cookiecutter.project_name}}/docs/index.rst | 6 +-- {{cookiecutter.project_name}}/docs/make.bat | 2 +- .../project_setup.rst | 6 +-- {{cookiecutter.project_name}}/setup.cfg | 12 +++--- .../tests/test_lint.py | 2 +- ...y => test_{{cookiecutter.module_name}}.py} | 6 +-- .../__init__.py | 4 +- .../__version__.py | 2 +- .../{{cookiecutter.module_name}}.py} | 2 +- 20 files changed, 74 insertions(+), 76 deletions(-) rename {{cookiecutter.project_name}}/tests/{test_{{cookiecutter.derived.module_name}}.py => test_{{cookiecutter.module_name}}.py} (58%) rename {{cookiecutter.project_name}}/{{{cookiecutter.derived.package_name}} => {{cookiecutter.package_name}}}/__init__.py (68%) rename {{cookiecutter.project_name}}/{{{cookiecutter.derived.package_name}} => {{cookiecutter.package_name}}}/__version__.py (86%) rename {{cookiecutter.project_name}}/{{{cookiecutter.derived.package_name}}/{{cookiecutter.derived.module_name}}.py => {{cookiecutter.package_name}}/{{cookiecutter.module_name}}.py} (79%) diff --git a/README.md b/README.md index 352b8a6c..e09a74f5 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,13 @@ Use this [Cookiecutter](https://cookiecutter.readthedocs.io) template to generat an empty Python package. Features include: - Boilerplate tests and documentation, -- [Python setup configuration]({{ cookiecutter.derived.project_name }}/setup.py), +- [Python setup configuration]({{ cookiecutter.project_name }}/setup.py), - Open source software license, -- [Default Github actions]({{ cookiecutter.derived.project_name }}/.github/workflows) for building, testing and deployment +- [Default Github actions]({{ cookiecutter.project_name }}/.github/workflows) for building, testing and deployment - Code style checking, -- [Editorconfig]({{ cookiecutter.derived.project_name }}/.editorconfig), -- Miscellaneous files, such as [Change log]({{ cookiecutter.derived.project_name }}/CHANGELOG.rst), [Code of Conduct]({{ cookiecutter.derived.project_name }}/CODE_OF_CONDUCT.rst), and [Contributing guidelines]({{ cookiecutter.derived.project_name }}/CONTRIBUTING.rst), -- A [README]({{ cookiecutter.derived.project_name }}/README.rst) and [a separate document]({{ cookiecutter.derived.project_name }}/project_setup.rst) with extensive documentation about project setup. +- [Editorconfig]({{ cookiecutter.project_name }}/.editorconfig), +- Miscellaneous files, such as [Change log]({{ cookiecutter.project_name }}/CHANGELOG.rst), [Code of Conduct]({{ cookiecutter.project_name }}/CODE_OF_CONDUCT.rst), and [Contributing guidelines]({{ cookiecutter.project_name }}/CONTRIBUTING.rst), +- A [README]({{ cookiecutter.project_name }}/README.rst) and [a separate document]({{ cookiecutter.project_name }}/project_setup.rst) with extensive documentation about project setup. ## Badges @@ -71,7 +71,7 @@ cookiecutter https://github.com/nlesc/python-template.git ### Step 3/3: Read about what was just generated -Good job! You have now generated the skeleton for your package. For an explanation of what's there, read on in the [project_setup.rst]({{ cookiecutter.derived.project_name }}/project_setup.rst) file. +Good job! You have now generated the skeleton for your package. For an explanation of what's there, read on in the [project_setup.rst]({{ cookiecutter.project_name }}/project_setup.rst) file. ## Examples diff --git a/cookiecutter.json b/cookiecutter.json index cc416b71..164915fe 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -1,5 +1,5 @@ { - "project_name": "my-python-project", + "project_name": "my-python-projecT", "package_name": "my_python_package", "_copy_without_render": [".github/*"], "project_short_description": "", diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index 38a7d704..1f07492a 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -1,10 +1,8 @@ {{ cookiecutter.update({ - "derived": { - "project_name": cookiecutter.project_name.lower().replace("-", "_"), - "package_name": cookiecutter.package_name.lower().replace(" ", "_").replace("-", "_"), - "module_name": cookiecutter.package_name.lower().replace(" ", "_").replace("-", "_"), - "full_name": cookiecutter.full_name.replace('\"', '\\\"'), - "repository": "https://github.com/" + cookiecutter.github_organization + "/" + cookiecutter.project_name.lower().replace("-", "_"), - "project_short_description": cookiecutter.project_short_description.replace('\"', '\\\"') - } + "project_name": cookiecutter.project_name.lower().replace(" ", "-"), + "package_name": cookiecutter.package_name.lower().replace(" ", "_").replace("-", "_"), + "module_name": cookiecutter.package_name.lower().replace(" ", "_").replace("-", "_"), + "full_name": cookiecutter.full_name.replace('\"', '\\\"'), + "repository": "https://github.com/" + cookiecutter.github_organization + "/" + cookiecutter.project_name.lower().replace("-", "_"), + "project_short_description": cookiecutter.project_short_description.replace('\"', '\\\"') }) }} diff --git a/pytest.ini b/pytest.ini index 608fab57..d0815e0f 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,2 +1,2 @@ [pytest] -norecursedirs = .git docs */{{cookiecutter.derived.project_name}}/* +norecursedirs = .git docs */{{cookiecutter.project_name}}/* diff --git a/{{cookiecutter.project_name}}/CITATION.cff b/{{cookiecutter.project_name}}/CITATION.cff index 328b52b9..19eebe54 100644 --- a/{{cookiecutter.project_name}}/CITATION.cff +++ b/{{cookiecutter.project_name}}/CITATION.cff @@ -1,7 +1,7 @@ # YAML 1.2 --- cff-version: "1.1.0" -title: "{{ cookiecutter.derived.project_name }}" +title: "{{ cookiecutter.project_name }}" authors: - family-names: "{{ cookiecutter.full_name }}" @@ -10,7 +10,7 @@ authors: date-released: 20??-MM-DD doi: version: "{{ cookiecutter.version }}" -repository-code: "{{ cookiecutter.derived.repository }}" +repository-code: "{{ cookiecutter.repository }}" identifiers: keywords: message: "If you use this software, please cite it using these metadata." diff --git a/{{cookiecutter.project_name}}/CONTRIBUTING.rst b/{{cookiecutter.project_name}}/CONTRIBUTING.rst index 1fe1308a..3166d760 100644 --- a/{{cookiecutter.project_name}}/CONTRIBUTING.rst +++ b/{{cookiecutter.project_name}}/CONTRIBUTING.rst @@ -15,14 +15,14 @@ The sections below outline the steps in each case. You have a question ******************* -#. use the search functionality `here <{{ cookiecutter.derived.repository }}/issues>`__ to see if someone already filed the same issue; +#. use the search functionality `here <{{ cookiecutter.repository }}/issues>`__ to see if someone already filed the same issue; #. if your issue search did not yield any relevant results, make a new issue; #. apply the "Question" label; apply other labels when relevant. You think you may have found a bug ********************************** -#. use the search functionality `here <{{ cookiecutter.derived.repository }}/issues>`__ to see if someone already filed the same issue; +#. use the search functionality `here <{{ cookiecutter.repository }}/issues>`__ to see if someone already filed the same issue; #. 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 `_ of the commit that is causing your problem; - some identifying information (name and version number) for dependencies you're using; @@ -38,7 +38,7 @@ You want to make some kind of change to the code base #. make sure the existing tests still work by running ``python setup.py test``; #. add your own tests (if necessary); #. update or expand the documentation; -#. `push `_ your feature branch to (your fork of) the {{ cookiecutter.derived.project_name }} repository on GitHub; +#. `push `_ your feature branch to (your fork of) the {{ cookiecutter.project_name }} repository on GitHub; #. create the pull request, e.g. following the instructions `here `__. 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. diff --git a/{{cookiecutter.project_name}}/LICENSE b/{{cookiecutter.project_name}}/LICENSE index 6402ced5..c55e8d0d 100644 --- a/{{cookiecutter.project_name}}/LICENSE +++ b/{{cookiecutter.project_name}}/LICENSE @@ -24,7 +24,7 @@ are permitted provided that the following conditions are met: list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -* Neither the name of {{ cookiecutter.derived.package_name }} nor the names of its +* 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. diff --git a/{{cookiecutter.project_name}}/NOTICE b/{{cookiecutter.project_name}}/NOTICE index 771a9a3a..3ddc2d32 100644 --- a/{{cookiecutter.project_name}}/NOTICE +++ b/{{cookiecutter.project_name}}/NOTICE @@ -1,2 +1,2 @@ -This product includes {{ cookiecutter.derived.package_name }}, software developed by +This product includes {{ cookiecutter.package_name }}, software developed by {{ cookiecutter.copyright_holder }}. diff --git a/{{cookiecutter.project_name}}/README.rst b/{{cookiecutter.project_name}}/README.rst index d39c3a15..c090d722 100644 --- a/{{cookiecutter.project_name}}/README.rst +++ b/{{cookiecutter.project_name}}/README.rst @@ -24,24 +24,24 @@ (Customize these badges with your own links, and check https://shields.io/ or https://badgen.net/ to see which other badges are available.) .. |GitHub Badge| image:: https://img.shields.io/badge/github-repo-000.svg?logo=github&labelColor=gray&color=blue - :target: {{ cookiecutter.derived.repository }} + :target: {{ cookiecutter.repository }} :alt: GitHub Badge -.. |License Badge| image:: https://img.shields.io/github/license/{{ cookiecutter.github_organization }}/{{ cookiecutter.derived.project_name }} - :target: {{ cookiecutter.derived.repository }} +.. |License Badge| image:: https://img.shields.io/github/license/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_name }} + :target: {{ cookiecutter.repository }} :alt: License Badge -.. |PyPI Badge| image:: https://img.shields.io/pypi/v/{{ cookiecutter.derived.project_name }}.svg?colorB=blue - :target: https://pypi.python.org/project/{{ cookiecutter.derived.project_name }}/ +.. |PyPI Badge| image:: https://img.shields.io/pypi/v/{{ cookiecutter.project_name }}.svg?colorB=blue + :target: https://pypi.python.org/project/{{ cookiecutter.project_name }}/ :alt: PyPI Badge -.. |Research Software Directory Badge| image:: https://img.shields.io/badge/rsd-{{ cookiecutter.derived.project_name }}-00a3e3.svg - :target: https://www.research-software.nl/software/{{ cookiecutter.derived.project_name }} +.. |Research Software Directory Badge| image:: https://img.shields.io/badge/rsd-{{ cookiecutter.project_name }}-00a3e3.svg + :target: https://www.research-software.nl/software/{{ cookiecutter.project_name }} :alt: Research Software Directory Badge .. Goto https://zenodo.org/account/settings/github/ to enable Zenodo/GitHub integration. - After creation of a GitHub release at {{ cookiecutter.derived.repository }}/releases + After creation of a GitHub release at {{ cookiecutter.repository }}/releases there will be a Zenodo upload created at https://zenodo.org/deposit with a DOI, this DOI can be put in the Zenodo badge urls. In the README, we prefer to use the concept DOI over versioned DOI, see https://help.zenodo.org/#versioning. .. |Zenodo Badge| image:: https://zenodo.org/badge/DOI/< replace with created DOI >.svg @@ -54,23 +54,23 @@ :target: https://bestpractices.coreinfrastructure.org/projects/< replace with created project identifier > :alt: CII Best Practices Badge -.. |Python Build| image:: {{ cookiecutter.derived.repository }}/workflows/Python/badge.svg - :target: {{ cookiecutter.derived.repository }}/actions?query=workflow%3A%22Python%22 +.. |Python Build| image:: {{ cookiecutter.repository }}/workflows/Python/badge.svg + :target: {{ cookiecutter.repository }}/actions?query=workflow%3A%22Python%22 :alt: Python Build -.. |PyPI Publish| image:: {{ cookiecutter.derived.repository }}/workflows/PyPI/badge.svg - :target: {{ cookiecutter.derived.repository }}/actions?query=workflow%3A%22PyPI%22 +.. |PyPI Publish| image:: {{ cookiecutter.repository }}/workflows/PyPI/badge.svg + :target: {{ cookiecutter.repository }}/actions?query=workflow%3A%22PyPI%22 :alt: PyPI Publish -.. |metadata consistency| image:: {{ cookiecutter.derived.repository }}/workflows/cffconvert/badge.svg - :target: {{ cookiecutter.derived.repository }}/actions?query=workflow%3A%22cffconvert%22 +.. |metadata consistency| image:: {{ cookiecutter.repository }}/workflows/cffconvert/badge.svg + :target: {{ cookiecutter.repository }}/actions?query=workflow%3A%22cffconvert%22 :alt: metadata consistency badge ################################################################################ -{{ cookiecutter.derived.project_name }} +{{ cookiecutter.project_name }} ################################################################################ -{{ cookiecutter.derived.project_short_description }} +{{ cookiecutter.project_short_description }} The project setup is documented in `a separate document `_. Feel free to remove this document (and/or the link to this document) if you don't need it. @@ -78,12 +78,12 @@ The project setup is documented in `a separate document `_. F Installation ------------ -To install {{ cookiecutter.derived.project_name }}, do: +To install {{ cookiecutter.project_name }}, do: .. code-block:: console - git clone {{ cookiecutter.derived.repository }}.git - cd {{ cookiecutter.derived.project_name }} + git clone {{ cookiecutter.repository }}.git + cd {{ cookiecutter.project_name }} python3 -m pip install . @@ -104,7 +104,7 @@ Include a link to your project's full documentation here. Contributing ************ -If you want to contribute to the development of {{ cookiecutter.derived.project_name }}, +If you want to contribute to the development of {{ cookiecutter.project_name }}, have a look at the `contribution guidelines `_. Credits diff --git a/{{cookiecutter.project_name}}/docs/Makefile b/{{cookiecutter.project_name}}/docs/Makefile index 85ef3aa9..02b326f2 100644 --- a/{{cookiecutter.project_name}}/docs/Makefile +++ b/{{cookiecutter.project_name}}/docs/Makefile @@ -4,7 +4,7 @@ # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build -SPHINXPROJ = {{ cookiecutter.derived.project_name }} +SPHINXPROJ = {{ cookiecutter.project_name }} SOURCEDIR = . BUILDDIR = _build diff --git a/{{cookiecutter.project_name}}/docs/conf.py b/{{cookiecutter.project_name}}/docs/conf.py index bec400d9..b7bc7f0a 100644 --- a/{{cookiecutter.project_name}}/docs/conf.py +++ b/{{cookiecutter.project_name}}/docs/conf.py @@ -1,4 +1,4 @@ -# {{ cookiecutter.derived.project_name }} documentation build configuration file, created by +# {{ cookiecutter.project_name }} documentation build configuration file, created by # sphinx-quickstart on {% now "local", "%a %b %d %H:%M:%S %Y" %}. # # This file is execfile()d with the current directory set to its @@ -17,7 +17,7 @@ import os import sys -import {{ cookiecutter.derived.project_name }} +import {{ cookiecutter.project_name }} here = os.path.dirname(__file__) sys.path.insert(0, os.path.abspath(os.path.join(here, ".."))) @@ -56,9 +56,9 @@ # built documents. # # The short X.Y version. -version = {{ cookiecutter.derived.project_name }}.__version__ +version = {{ cookiecutter.project_name }}.__version__ # The full version, including alpha/beta/rc tags. -release = {{ cookiecutter.derived.project_name }}.__version__ +release = {{ cookiecutter.project_name }}.__version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -84,7 +84,7 @@ def run_apidoc(_): here = os.path.dirname(__file__) out = os.path.abspath(os.path.join(here, "apidocs")) - src = os.path.abspath(os.path.join(here, "..", "{{ cookiecutter.derived.project_name }}")) + src = os.path.abspath(os.path.join(here, "..", "{{ cookiecutter.project_name }}")) ignore_paths = [] @@ -151,7 +151,7 @@ def setup(app): # -- Options for HTMLHelp output ------------------------------------------ # Output file base name for HTML help builder. -htmlhelp_basename = "{{ cookiecutter.derived.project_name }}_doc" +htmlhelp_basename = "{{ cookiecutter.project_name }}_doc" # -- Options for LaTeX output --------------------------------------------- @@ -178,8 +178,8 @@ def setup(app): # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (main_doc, "{{ cookiecutter.derived.project_name }}.tex", u"{{ cookiecutter.project_name }} Documentation", - u"{{ cookiecutter.derived.full_name }}", "manual"), + (main_doc, "{{ cookiecutter.project_name }}.tex", u"{{ cookiecutter.project_name }} Documentation", + u"{{ cookiecutter.full_name }}", "manual"), ] @@ -188,7 +188,7 @@ def setup(app): # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (main_doc, "{{ cookiecutter.derived.project_name }}", u"{{ cookiecutter.project_name }} Documentation", + (main_doc, "{{ cookiecutter.project_name }}", u"{{ cookiecutter.project_name }} Documentation", [author], 1) ] @@ -199,7 +199,7 @@ def setup(app): # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (main_doc, "{{ cookiecutter.derived.project_name }}", u"{{ cookiecutter.project_name }} Documentation", - author, "{{ cookiecutter.derived.project_name }}", "{{ cookiecutter.derived.project_short_description }}", + (main_doc, "{{ cookiecutter.project_name }}", u"{{ cookiecutter.project_name }} Documentation", + author, "{{ cookiecutter.project_name }}", "{{ cookiecutter.project_short_description }}", "Miscellaneous"), ] diff --git a/{{cookiecutter.project_name}}/docs/index.rst b/{{cookiecutter.project_name}}/docs/index.rst index 66d74ad3..f2b005ae 100644 --- a/{{cookiecutter.project_name}}/docs/index.rst +++ b/{{cookiecutter.project_name}}/docs/index.rst @@ -1,9 +1,9 @@ -.. {{ cookiecutter.derived.project_name }} documentation main file, created by +.. {{ cookiecutter.project_name }} documentation main file, created by sphinx-quickstart on Thu Jun 21 11:07:11 2018. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -Welcome to {{ cookiecutter.derived.project_name }}'s documentation! +Welcome to {{ cookiecutter.project_name }}'s documentation! ========================================================== .. toctree:: @@ -17,7 +17,7 @@ API Reference .. toctree:: :maxdepth: 2 - {{ cookiecutter.derived.project_name }} + {{ cookiecutter.project_name }} {% endif %} Indices and tables diff --git a/{{cookiecutter.project_name}}/docs/make.bat b/{{cookiecutter.project_name}}/docs/make.bat index 9b8a936f..f74b2920 100644 --- a/{{cookiecutter.project_name}}/docs/make.bat +++ b/{{cookiecutter.project_name}}/docs/make.bat @@ -9,7 +9,7 @@ if "%SPHINXBUILD%" == "" ( ) set SOURCEDIR=. set BUILDDIR=_build -set SPHINXPROJ={{ cookiecutter.derived.project_name }} +set SPHINXPROJ={{ cookiecutter.project_name }} if "%1" == "" goto help diff --git a/{{cookiecutter.project_name}}/project_setup.rst b/{{cookiecutter.project_name}}/project_setup.rst index 3bc75f42..2ca56e4b 100644 --- a/{{cookiecutter.project_name}}/project_setup.rst +++ b/{{cookiecutter.project_name}}/project_setup.rst @@ -16,7 +16,7 @@ We recommend using `git `_ and `github `_ @@ -118,7 +118,7 @@ Package version number ---------------------- * We recommend using `semantic versioning `_. -* For convenience, the package version is stored in a single place: ``{{ cookiecutter.derived.project_name }}/__version__.py``. For updating the version number, you only have to change this file. +* For convenience, the package version is stored in a single place: ``{{ cookiecutter.project_name }}/__version__.py``. For updating the version number, you only have to change this file. * Don't forget to update the version number before `making a release `_! diff --git a/{{cookiecutter.project_name}}/setup.cfg b/{{cookiecutter.project_name}}/setup.cfg index 1a54a4e1..0bba4390 100644 --- a/{{cookiecutter.project_name}}/setup.cfg +++ b/{{cookiecutter.project_name}}/setup.cfg @@ -22,13 +22,13 @@ classifiers = Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 -description = {{ cookiecutter.derived.project_short_description }} +description = {{ cookiecutter.project_short_description }} long_description = file: README.md long_description_content_type = text/markdown -name = {{ cookiecutter.derived.package_name }} +name = {{ cookiecutter.package_name }} project_urls = - Bug Tracker = {{ cookiecutter.derived.repository }}/issues -url = {{ cookiecutter.derived.repository }} + Bug Tracker = {{ cookiecutter.repository }}/issues +url = {{ cookiecutter.repository }} version = {{ cookiecutter.version }} @@ -36,7 +36,7 @@ version = {{ cookiecutter.version }} zip_safe = False include_package_data = True packages = - {{ cookiecutter.derived.package_name }} + {{ cookiecutter.package_name }} install_requires = @@ -66,7 +66,7 @@ test=pytest [coverage:run] branch = True -source = {{ cookiecutter.derived.package_name }} +source = {{ cookiecutter.package_name }} [tool:pytest] testpaths = tests diff --git a/{{cookiecutter.project_name}}/tests/test_lint.py b/{{cookiecutter.project_name}}/tests/test_lint.py index 5574fb71..30b4639b 100644 --- a/{{cookiecutter.project_name}}/tests/test_lint.py +++ b/{{cookiecutter.project_name}}/tests/test_lint.py @@ -8,7 +8,7 @@ def test_pep8_conformance(): """Test that we conform to PEP-8.""" check_paths = [ - "{{ cookiecutter.derived.project_name }}", + "{{ cookiecutter.project_name }}", "tests", ] exclude_paths = [] diff --git a/{{cookiecutter.project_name}}/tests/test_{{cookiecutter.derived.module_name}}.py b/{{cookiecutter.project_name}}/tests/test_{{cookiecutter.module_name}}.py similarity index 58% rename from {{cookiecutter.project_name}}/tests/test_{{cookiecutter.derived.module_name}}.py rename to {{cookiecutter.project_name}}/tests/test_{{cookiecutter.module_name}}.py index 27e5065b..b8d4f4db 100644 --- a/{{cookiecutter.project_name}}/tests/test_{{cookiecutter.derived.module_name}}.py +++ b/{{cookiecutter.project_name}}/tests/test_{{cookiecutter.module_name}}.py @@ -1,10 +1,10 @@ #!/usr/bin/env python -"""Tests for the {{ cookiecutter.derived.package_name }} module. +"""Tests for the {{ cookiecutter.package_name }} module. """ import pytest -from {{ cookiecutter.derived.package_name }} import {{ cookiecutter.derived.package_name }} +from {{ cookiecutter.package_name }} import {{ cookiecutter.package_name }} def test_something(): @@ -23,5 +23,5 @@ def an_object(): return {} -def test_{{ cookiecutter.derived.package_name }}(an_object): +def test_{{ cookiecutter.package_name }}(an_object): assert an_object == {} diff --git a/{{cookiecutter.project_name}}/{{cookiecutter.derived.package_name}}/__init__.py b/{{cookiecutter.project_name}}/{{cookiecutter.package_name}}/__init__.py similarity index 68% rename from {{cookiecutter.project_name}}/{{cookiecutter.derived.package_name}}/__init__.py rename to {{cookiecutter.project_name}}/{{cookiecutter.package_name}}/__init__.py index d2d22c0e..4bf16cd9 100644 --- a/{{cookiecutter.project_name}}/{{cookiecutter.derived.package_name}}/__init__.py +++ b/{{cookiecutter.project_name}}/{{cookiecutter.package_name}}/__init__.py @@ -1,9 +1,9 @@ -{% if cookiecutter.apidoc == "yes" %}"""Documentation about {{ cookiecutter.derived.package_name }}"""{% endif %} +{% if cookiecutter.apidoc == "yes" %}"""Documentation about {{ cookiecutter.package_name }}"""{% endif %} import logging from .__version__ import __version__ logging.getLogger(__name__).addHandler(logging.NullHandler()) -__author__ = "{{ cookiecutter.derived.full_name }}" +__author__ = "{{ cookiecutter.full_name }}" __email__ = "{{ cookiecutter.email }}" diff --git a/{{cookiecutter.project_name}}/{{cookiecutter.derived.package_name}}/__version__.py b/{{cookiecutter.project_name}}/{{cookiecutter.package_name}}/__version__.py similarity index 86% rename from {{cookiecutter.project_name}}/{{cookiecutter.derived.package_name}}/__version__.py rename to {{cookiecutter.project_name}}/{{cookiecutter.package_name}}/__version__.py index d3461fe2..d904f15b 100644 --- a/{{cookiecutter.project_name}}/{{cookiecutter.derived.package_name}}/__version__.py +++ b/{{cookiecutter.project_name}}/{{cookiecutter.package_name}}/__version__.py @@ -2,7 +2,7 @@ import sys # To update the package version number, edit CITATION.cff -citationfile = os.path.join(sys.exec_prefix, "citation/{{ cookiecutter.derived.project_name }}", "CITATION.cff") +citationfile = os.path.join(sys.exec_prefix, "citation/{{ cookiecutter.project_name }}", "CITATION.cff") with open(citationfile, "r") as cff: for line in cff: if "version:" in line: diff --git a/{{cookiecutter.project_name}}/{{cookiecutter.derived.package_name}}/{{cookiecutter.derived.module_name}}.py b/{{cookiecutter.project_name}}/{{cookiecutter.package_name}}/{{cookiecutter.module_name}}.py similarity index 79% rename from {{cookiecutter.project_name}}/{{cookiecutter.derived.package_name}}/{{cookiecutter.derived.module_name}}.py rename to {{cookiecutter.project_name}}/{{cookiecutter.package_name}}/{{cookiecutter.module_name}}.py index fbfb2174..141f56ca 100644 --- a/{{cookiecutter.project_name}}/{{cookiecutter.derived.package_name}}/{{cookiecutter.derived.module_name}}.py +++ b/{{cookiecutter.project_name}}/{{cookiecutter.package_name}}/{{cookiecutter.module_name}}.py @@ -1,4 +1,4 @@ -{%-if cookiecutter.apidoc == "yes" %}"""Documentation about the {{ cookiecutter.derived.package_name }} module."""{% endif %} +{%-if cookiecutter.apidoc == "yes" %}"""Documentation about the {{ cookiecutter.package_name }} module."""{% endif %} import logging logger = logging.getLogger(__name__) From 90d8948c8a35146a7bff5c28228e3704b22ce991 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Wed, 14 Apr 2021 23:43:02 +0200 Subject: [PATCH 03/41] no longer using package name for module --- cookiecutter.json | 2 +- hooks/pre_gen_project.py | 5 ++++- ...est_{{cookiecutter.module_name}}.py => test_my_module.py} | 2 +- .../{{{cookiecutter.module_name}}.py => my_module.py} | 0 4 files changed, 6 insertions(+), 3 deletions(-) rename {{cookiecutter.project_name}}/tests/{test_{{cookiecutter.module_name}}.py => test_my_module.py} (84%) rename {{cookiecutter.project_name}}/{{cookiecutter.package_name}}/{{{cookiecutter.module_name}}.py => my_module.py} (100%) diff --git a/cookiecutter.json b/cookiecutter.json index 164915fe..cc416b71 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -1,5 +1,5 @@ { - "project_name": "my-python-projecT", + "project_name": "my-python-project", "package_name": "my_python_package", "_copy_without_render": [".github/*"], "project_short_description": "", diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index 1f07492a..d6556a98 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -1,8 +1,11 @@ +import sys + {{ cookiecutter.update({ "project_name": cookiecutter.project_name.lower().replace(" ", "-"), "package_name": cookiecutter.package_name.lower().replace(" ", "_").replace("-", "_"), - "module_name": cookiecutter.package_name.lower().replace(" ", "_").replace("-", "_"), "full_name": cookiecutter.full_name.replace('\"', '\\\"'), "repository": "https://github.com/" + cookiecutter.github_organization + "/" + cookiecutter.project_name.lower().replace("-", "_"), "project_short_description": cookiecutter.project_short_description.replace('\"', '\\\"') }) }} + +sys.exit(0) diff --git a/{{cookiecutter.project_name}}/tests/test_{{cookiecutter.module_name}}.py b/{{cookiecutter.project_name}}/tests/test_my_module.py similarity index 84% rename from {{cookiecutter.project_name}}/tests/test_{{cookiecutter.module_name}}.py rename to {{cookiecutter.project_name}}/tests/test_my_module.py index b8d4f4db..3728247a 100644 --- a/{{cookiecutter.project_name}}/tests/test_{{cookiecutter.module_name}}.py +++ b/{{cookiecutter.project_name}}/tests/test_my_module.py @@ -4,7 +4,7 @@ """ import pytest -from {{ cookiecutter.package_name }} import {{ cookiecutter.package_name }} +from {{ cookiecutter.package_name }} import my_module def test_something(): diff --git a/{{cookiecutter.project_name}}/{{cookiecutter.package_name}}/{{cookiecutter.module_name}}.py b/{{cookiecutter.project_name}}/{{cookiecutter.package_name}}/my_module.py similarity index 100% rename from {{cookiecutter.project_name}}/{{cookiecutter.package_name}}/{{cookiecutter.module_name}}.py rename to {{cookiecutter.project_name}}/{{cookiecutter.package_name}}/my_module.py From 670224d4dd1e034b6d1ccf904ec0af8727b7eb1d Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 15 Apr 2021 00:05:43 +0200 Subject: [PATCH 04/41] updated table entries and fixed broken link --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0ca89958..6aad089f 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,8 @@ cookiecutter https://github.com/nlesc/python-template.git | Name | Default value | Explanation | | ------------------------- | ------------- | ----------- | -| project_name | My Python Project | Full project/package name. | -| project_slug | my_python_project | This will be the name of the directory to be created and the git repository. It is safest not to use dashes (-) or spaces in this name. | +| project_name | my-python-project | Full project name. | +| package_slug | my_python_package | This will be the name of the directory to be created and the git repository. It is safest not to use dashes (-) or spaces in this name. | | project_short_description | | The information that you enter here will end up in the README, documentation, license, and setup.py, so it may be a good idea to prepare something in advance. | | version | 0.1.0 | | | github_organization | | GitHub organization that will contain this project's repository. This can also be your github user name. | @@ -71,7 +71,7 @@ cookiecutter https://github.com/nlesc/python-template.git ### Step 3/3: Read about what was just generated -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]({{cookiecutter.project_slug}}/project_setup.md) file. +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]({{cookiecutter.project_name}}/project_setup.md) file. ## Examples From 115bda4b8ea95cd0d6630d8082b768389918f1d4 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 15 Apr 2021 00:06:31 +0200 Subject: [PATCH 05/41] fixed broken link --- README.dev.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.dev.md b/README.dev.md index 0c719d77..74d5149c 100644 --- a/README.dev.md +++ b/README.dev.md @@ -37,7 +37,7 @@ path/to/package/ * Code (existing or new) should be placed in `path/to/package/package/` (please choose a better name for your software!). * Add documentation by editing `path/to/package/docs/index.rst` * Tests go in the `path/to/package/tests/` directory -* The generated [project setup document]({{cookiecutter.project_slug}}/project_setup.md) contains extensive documentation about the project setup and provides further instructions on what to do. +* The generated [project setup document]({{cookiecutter.project_name}}/project_setup.md) contains extensive documentation about the project setup and provides further instructions on what to do. ### Step 3: Create and activate a Python environment From 44253557677b171838e3dfba54f2a87a64e05a64 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 15 Apr 2021 00:16:29 +0200 Subject: [PATCH 06/41] was using the wrong property in hook --- hooks/post_gen_project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 5a7ea509..cd0ef8c1 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -1 +1 @@ -print("\nProject was successfully generated. For next steps, refer to file {{ cookiecutter.project_slug }}/project_setup.md.\n") +print("\nProject was successfully generated. For next steps, refer to file {{ cookiecutter.project_name }}/project_setup.md.\n") From 816bee6d96a0d0e0891e468e2e5dfd308b8c101e Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 15 Apr 2021 08:49:09 +0200 Subject: [PATCH 07/41] changed project_short_description to package_short_description --- README.md | 2 +- cookiecutter.json | 4 ++-- hooks/pre_gen_project.py | 7 +++++-- tests/test_lint.py | 8 ++++---- tests/test_values.py | 6 +++--- {{cookiecutter.project_name}}/README.rst | 2 +- {{cookiecutter.project_name}}/docs/conf.py | 2 +- {{cookiecutter.project_name}}/setup.cfg | 2 +- 8 files changed, 18 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 6aad089f..12603cee 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ cookiecutter https://github.com/nlesc/python-template.git | ------------------------- | ------------- | ----------- | | project_name | my-python-project | Full project name. | | package_slug | my_python_package | This will be the name of the directory to be created and the git repository. It is safest not to use dashes (-) or spaces in this name. | -| project_short_description | | The information that you enter here will end up in the README, documentation, license, and setup.py, so it may be a good idea to prepare something in advance. | +| package_short_description | | The information that you enter here will end up in the README, documentation, license, and setup.cfg, so it may be a good idea to prepare something in advance. | | version | 0.1.0 | | | github_organization | | GitHub organization that will contain this project's repository. This can also be your github user name. | | open_source_license | Apache 2.0 (1) | The software license under which the code is made available. | diff --git a/cookiecutter.json b/cookiecutter.json index cc416b71..73073a56 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -1,8 +1,8 @@ { - "project_name": "my-python-project", "package_name": "my_python_package", + "project_name": "my-python-project", "_copy_without_render": [".github/*"], - "project_short_description": "", + "package_short_description": "", "version": "0.1.0", "github_organization": "", "open_source_license": ["Apache Software License 2.0", "MIT license", "BSD license", "ISC license", "GNU General Public License v3 or later", "Not open source"], diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index d6556a98..1e0affb7 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -1,11 +1,14 @@ import sys +# Note: cookiecutter first makes the main level directory using +# _project_name from cookiecutter.json before running this hook + {{ cookiecutter.update({ - "project_name": cookiecutter.project_name.lower().replace(" ", "-"), "package_name": cookiecutter.package_name.lower().replace(" ", "_").replace("-", "_"), + "project_name": cookiecutter.project_name.lower().replace(" ", "-"), "full_name": cookiecutter.full_name.replace('\"', '\\\"'), "repository": "https://github.com/" + cookiecutter.github_organization + "/" + cookiecutter.project_name.lower().replace("-", "_"), - "project_short_description": cookiecutter.project_short_description.replace('\"', '\\\"') + "package_short_description": cookiecutter.package_short_description.replace('\"', '\\\"') }) }} sys.exit(0) diff --git a/tests/test_lint.py b/tests/test_lint.py index b15feeab..d76c5939 100644 --- a/tests/test_lint.py +++ b/tests/test_lint.py @@ -7,15 +7,15 @@ def test_pep8_conformance(cookies): """Test that we conform to PEP-8.""" check_paths = [ - 'my_python_project', - 'tests', + "my_python_project", + "tests", ] exclude_paths = [] project = cookies.bake(extra_context={ - 'project_short_description': 'short description'}) + "package_short_description": "short description"}) - print("PEP8 check of directories: {}\n".format(', '.join(check_paths))) + print("PEP8 check of directories: {}\n".format(", ".join(check_paths))) # Get paths wrt package root package_root = str(project.project) diff --git a/tests/test_values.py b/tests/test_values.py index 5cb2f35e..0f90d4e7 100644 --- a/tests/test_values.py +++ b/tests/test_values.py @@ -11,7 +11,7 @@ @pytest.mark.skipif(sys.platform.startswith('win'), reason='Skipping test with sh-module on Windows') def test_double_quotes_in_name_and_description(cookies): - ctx = {'project_short_description': '"double quotes"', + ctx = {'package_short_description': '"double quotes"', 'full_name': '"name"name'} project = cookies.bake(extra_context=ctx) @@ -35,8 +35,8 @@ def test_double_quotes_in_name_and_description(cookies): @pytest.mark.skipif(sys.platform.startswith('win'), reason='Skipping test with sh-module on Windows') def test_single_quotes_in_name_and_description(cookies): - ctx = {'project_short_description': "'single quotes'", - 'full_name': "Mr. O'Keeffe"} + ctx = {'package_short_description': "'single quotes'", + 'full_name': "Mr. O'Keefe"} project = cookies.bake(extra_context=ctx) assert project.exit_code == 0 diff --git a/{{cookiecutter.project_name}}/README.rst b/{{cookiecutter.project_name}}/README.rst index c090d722..223dff29 100644 --- a/{{cookiecutter.project_name}}/README.rst +++ b/{{cookiecutter.project_name}}/README.rst @@ -70,7 +70,7 @@ {{ cookiecutter.project_name }} ################################################################################ -{{ cookiecutter.project_short_description }} +{{ cookiecutter.package_short_description }} The project setup is documented in `a separate document `_. Feel free to remove this document (and/or the link to this document) if you don't need it. diff --git a/{{cookiecutter.project_name}}/docs/conf.py b/{{cookiecutter.project_name}}/docs/conf.py index b7bc7f0a..e0c341b0 100644 --- a/{{cookiecutter.project_name}}/docs/conf.py +++ b/{{cookiecutter.project_name}}/docs/conf.py @@ -200,6 +200,6 @@ def setup(app): # dir menu entry, description, category) texinfo_documents = [ (main_doc, "{{ cookiecutter.project_name }}", u"{{ cookiecutter.project_name }} Documentation", - author, "{{ cookiecutter.project_name }}", "{{ cookiecutter.project_short_description }}", + author, "{{ cookiecutter.project_name }}", "{{ cookiecutter.package_short_description }}", "Miscellaneous"), ] diff --git a/{{cookiecutter.project_name}}/setup.cfg b/{{cookiecutter.project_name}}/setup.cfg index 0bba4390..00a51e42 100644 --- a/{{cookiecutter.project_name}}/setup.cfg +++ b/{{cookiecutter.project_name}}/setup.cfg @@ -22,7 +22,7 @@ classifiers = Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 -description = {{ cookiecutter.project_short_description }} +description = {{ cookiecutter.package_short_description }} long_description = file: README.md long_description_content_type = text/markdown name = {{ cookiecutter.package_name }} From dd492a42bc68bba89f9031efa92b6b7373f84a68 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 15 Apr 2021 09:08:08 +0200 Subject: [PATCH 08/41] edits to the table that explains the properties --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 12603cee..2184df68 100644 --- a/README.md +++ b/README.md @@ -57,17 +57,17 @@ cookiecutter https://github.com/nlesc/python-template.git | Name | Default value | Explanation | | ------------------------- | ------------- | ----------- | -| project_name | my-python-project | Full project name. | -| package_slug | my_python_package | This will be the name of the directory to be created and the git repository. It is safest not to use dashes (-) or spaces in this name. | -| package_short_description | | The information that you enter here will end up in the README, documentation, license, and setup.cfg, so it may be a good idea to prepare something in advance. | -| version | 0.1.0 | | -| github_organization | | GitHub organization that will contain this project's repository. This can also be your github user name. | -| open_source_license | Apache 2.0 (1) | The software license under which the code is made available. | -| apidoc | no (1) | Add support for automatically generating a module index from the `docstrings` in your Python package (look at the [scriptcwl package](http://scriptcwl.readthedocs.io/en/latest/apidocs/scriptcwl.html) for an example). -| full_name | John Smith | Your full name, e.g. _John Smith_. | -| email | yourname@esciencecenter.nl | Your (work) email address | -| copyright_holder | | Name(s) of the organization(s) or person(s) who hold the copyright of the software (e.g., Netherlands eScience Center). | -| 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. | +| package_name | my_python_package | Name of the package. It is safest not to use dashes (-) or spaces in this name. | +| project_name | my-python-project | Name of the project that contains the package. | +| package_short_description |   | The information that you enter here will end up in the README, documentation, license, and setup.cfg, so it may be a good idea to prepare something in advance. | +| 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. | +| open_source_license | Apache Software License 2.0 | The software license under which the code is made available. | +| apidoc | no | Add support for automatically generating a module index from the `docstrings` in your Python package (look at the [scriptcwl package](http://scriptcwl.readthedocs.io/en/latest/apidocs/scriptcwl.html) for an example). +| full_name | John Smith | Your full name, e.g. _John Smith_. | +| email | yourname@esciencecenter.nl | Your (work) email address | +| copyright_holder |   | Name(s) of the organization(s) or person(s) who hold the copyright of the software (e.g., Netherlands eScience Center). | +| 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. | ### Step 3/3: Read about what was just generated From 62c38744f4a5bf0fa00815aff88e3182e42e36fc Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 15 Apr 2021 09:12:02 +0200 Subject: [PATCH 09/41] renamed property open_source_license to license --- README.md | 2 +- cookiecutter.json | 2 +- {{cookiecutter.project_name}}/CITATION.cff | 2 +- {{cookiecutter.project_name}}/LICENSE | 10 +++++----- {{cookiecutter.project_name}}/setup.cfg | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 2184df68..8e41a43e 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ cookiecutter https://github.com/nlesc/python-template.git | package_short_description |   | The information that you enter here will end up in the README, documentation, license, and setup.cfg, so it may be a good idea to prepare something in advance. | | 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. | -| open_source_license | Apache Software License 2.0 | The software license under which the code is made available. | +| license | Apache Software License 2.0 | The software license under which the code is made available. | | apidoc | no | Add support for automatically generating a module index from the `docstrings` in your Python package (look at the [scriptcwl package](http://scriptcwl.readthedocs.io/en/latest/apidocs/scriptcwl.html) for an example). | full_name | John Smith | Your full name, e.g. _John Smith_. | | email | yourname@esciencecenter.nl | Your (work) email address | diff --git a/cookiecutter.json b/cookiecutter.json index 73073a56..7830ed87 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -5,7 +5,7 @@ "package_short_description": "", "version": "0.1.0", "github_organization": "", - "open_source_license": ["Apache Software License 2.0", "MIT license", "BSD license", "ISC license", "GNU General Public License v3 or later", "Not open source"], + "license": ["Apache Software License 2.0", "MIT license", "BSD license", "ISC license", "GNU General Public License v3 or later", "Not open source"], "apidoc": ["no", "yes"], "full_name": "John Smith", "email": "yourname@esciencecenter.nl", diff --git a/{{cookiecutter.project_name}}/CITATION.cff b/{{cookiecutter.project_name}}/CITATION.cff index 19eebe54..f4d8b9ee 100644 --- a/{{cookiecutter.project_name}}/CITATION.cff +++ b/{{cookiecutter.project_name}}/CITATION.cff @@ -14,4 +14,4 @@ repository-code: "{{ cookiecutter.repository }}" identifiers: keywords: message: "If you use this software, please cite it using these metadata." -license: "{{ cookiecutter.open_source_license }}" +license: "{{ cookiecutter.license }}" diff --git a/{{cookiecutter.project_name}}/LICENSE b/{{cookiecutter.project_name}}/LICENSE index c55e8d0d..00bfbf25 100644 --- a/{{cookiecutter.project_name}}/LICENSE +++ b/{{cookiecutter.project_name}}/LICENSE @@ -1,4 +1,4 @@ -{% if cookiecutter.open_source_license == 'MIT license' %} +{% if cookiecutter.license == 'MIT license' %} MIT License Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.copyright_holder }} @@ -8,7 +8,7 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of 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.open_source_license == 'BSD license' %} +{% elif cookiecutter.license == 'BSD license' %} BSD License Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.copyright_holder }} @@ -38,7 +38,7 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -{% elif cookiecutter.open_source_license == 'ISC license' %} +{% elif cookiecutter.license == 'ISC license' %} ISC License Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.copyright_holder }} @@ -46,7 +46,7 @@ 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.open_source_license == 'Apache Software License 2.0' %} +{% elif cookiecutter.license == 'Apache Software License 2.0' %} Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -249,7 +249,7 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH RE See the License for the specific language governing permissions and limitations under the License. -{% elif cookiecutter.open_source_license == 'GNU General Public License v3 or later' %} +{% elif cookiecutter.license == 'GNU General Public License v3 or later' %} GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 diff --git a/{{cookiecutter.project_name}}/setup.cfg b/{{cookiecutter.project_name}}/setup.cfg index 00a51e42..c32321c9 100644 --- a/{{cookiecutter.project_name}}/setup.cfg +++ b/{{cookiecutter.project_name}}/setup.cfg @@ -15,7 +15,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.open_source_license] }} + }[cookiecutter.license] }} Natural Language :: English Programming Language :: Python :: 3 Programming Language :: Python :: 3.6 From b8ebb5c767c4cafa68730a2dc94672ae7e538938 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 15 Apr 2021 09:14:33 +0200 Subject: [PATCH 10/41] updated the tests to use project_name instead of project_slug --- tests/test_values.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_values.py b/tests/test_values.py index 0f90d4e7..a8642c50 100644 --- a/tests/test_values.py +++ b/tests/test_values.py @@ -58,8 +58,8 @@ def test_single_quotes_in_name_and_description(cookies): @pytest.mark.skipif(sys.platform.startswith('win'), reason='Skipping test with sh-module on Windows') -def test_dash_in_project_slug(cookies): - ctx = {'project_slug': "my-package"} +def test_dash_in_project_name(cookies): + ctx = {'project_name': "my-package"} project = cookies.bake(extra_context=ctx) assert project.exit_code == 0 @@ -82,8 +82,8 @@ def test_dash_in_project_slug(cookies): @pytest.mark.skipif(sys.platform.startswith('win'), reason='Skipping test with sh-module on Windows') -def test_space_in_project_slug(cookies): - ctx = {'project_slug': "my package"} +def test_space_in_project_name(cookies): + ctx = {'project_name': "my package"} project = cookies.bake(extra_context=ctx) assert project.exit_code == 0 From e823b56999fd4f3e88cdabeb35830ed2ed3758af Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 15 Apr 2021 09:18:02 +0200 Subject: [PATCH 11/41] updated comment in hook --- hooks/pre_gen_project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index 1e0affb7..e808e866 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -1,7 +1,7 @@ import sys # Note: cookiecutter first makes the main level directory using -# _project_name from cookiecutter.json before running this hook +# project_name from cookiecutter.json before running this hook {{ cookiecutter.update({ "package_name": cookiecutter.package_name.lower().replace(" ", "_").replace("-", "_"), From cb379204a37c3633ed2c38c852a3af57298067ea Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 15 Apr 2021 09:33:33 +0200 Subject: [PATCH 12/41] minor updates to the tests --still fails overall though --- tests/test_project.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_project.py b/tests/test_project.py index 03450358..2de303b1 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -24,7 +24,7 @@ def test_project(cookies): assert project.exit_code == 0 assert project.exception is None - assert project.project.basename == 'my_python_project' + assert project.project.basename == 'my-python-project' assert project.project.isdir() @@ -105,5 +105,5 @@ def test_building_documentation_apidocs(cookies): apidocs = project.project.join('docs', '_build', 'html', 'apidocs') - assert apidocs.join('my_python_project.html').isfile() - assert apidocs.join('my_python_project.my_python_project.html').isfile() + assert apidocs.join('my-python-project.html').isfile() + assert apidocs.join('my-python-project.my-python-package.html').isfile() From b5aaea657251db7df776e1ac1d71c375fee053d7 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 15 Apr 2021 13:07:56 +0200 Subject: [PATCH 13/41] removed test_lint file in generated package --- .../tests/test_lint.py | 43 ------------------- 1 file changed, 43 deletions(-) delete mode 100644 {{cookiecutter.project_name}}/tests/test_lint.py diff --git a/{{cookiecutter.project_name}}/tests/test_lint.py b/{{cookiecutter.project_name}}/tests/test_lint.py deleted file mode 100644 index 30b4639b..00000000 --- a/{{cookiecutter.project_name}}/tests/test_lint.py +++ /dev/null @@ -1,43 +0,0 @@ -""" Lint tests """ -import os -import textwrap - -import pycodestyle # formerly known as pep8 - - -def test_pep8_conformance(): - """Test that we conform to PEP-8.""" - check_paths = [ - "{{ cookiecutter.project_name }}", - "tests", - ] - exclude_paths = [] - - print("PEP8 check of directories: {}\n".format(", ".join(check_paths))) - - # Get paths wrt package root - package_root = os.path.dirname(os.path.dirname(__file__)) - for paths in (check_paths, exclude_paths): - for i, path in enumerate(paths): - paths[i] = os.path.join(package_root, path) - - style = pycodestyle.StyleGuide() - style.options.exclude.extend(exclude_paths) - - success = style.check_files(check_paths).total_errors == 0 - - if not success: - print(textwrap.dedent(""" - Your Python code does not conform to the official Python style - guide (PEP8), see https://www.python.org/dev/peps/pep-0008 - - A list of warning and error messages can be found above, - prefixed with filename:line number:column number. - - Run `yapf -i yourfile.py` to automatically fix most errors. - Run `yapf -d yourfile.py` to preview what would be changed. - Run `pip install --upgrade yapf` to install the latest version - of yapf. - """)) - - assert success, "Your code does not conform to PEP8" From fd5818aa10c62efbea02d9998b053f1365b8f19c Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 15 Apr 2021 13:08:21 +0200 Subject: [PATCH 14/41] simplified version file --- .../{{cookiecutter.package_name}}/__version__.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/{{cookiecutter.project_name}}/{{cookiecutter.package_name}}/__version__.py b/{{cookiecutter.project_name}}/{{cookiecutter.package_name}}/__version__.py index d904f15b..a955058c 100644 --- a/{{cookiecutter.project_name}}/{{cookiecutter.package_name}}/__version__.py +++ b/{{cookiecutter.project_name}}/{{cookiecutter.package_name}}/__version__.py @@ -1,9 +1 @@ -import os -import sys - -# To update the package version number, edit CITATION.cff -citationfile = os.path.join(sys.exec_prefix, "citation/{{ cookiecutter.project_name }}", "CITATION.cff") -with open(citationfile, "r") as cff: - for line in cff: - if "version:" in line: - __version__ = line.replace("version:", "").strip().strip('"') +__version__ = "{{ cookiecutter.version }}" From cf174ca4436b9dbf652549c9edc89cfdc4649af5 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 15 Apr 2021 13:09:02 +0200 Subject: [PATCH 15/41] switched to using package_name throughout all of docs/conf.py --- {{cookiecutter.project_name}}/docs/conf.py | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/{{cookiecutter.project_name}}/docs/conf.py b/{{cookiecutter.project_name}}/docs/conf.py index e0c341b0..5853e879 100644 --- a/{{cookiecutter.project_name}}/docs/conf.py +++ b/{{cookiecutter.project_name}}/docs/conf.py @@ -1,4 +1,4 @@ -# {{ cookiecutter.project_name }} documentation build configuration file, created by +# {{ cookiecutter.package_name }} documentation build configuration file, created by # sphinx-quickstart on {% now "local", "%a %b %d %H:%M:%S %Y" %}. # # This file is execfile()d with the current directory set to its @@ -17,11 +17,11 @@ import os import sys -import {{ cookiecutter.project_name }} - here = os.path.dirname(__file__) sys.path.insert(0, os.path.abspath(os.path.join(here, ".."))) +import {{ cookiecutter.package_name }} + # -- General configuration ------------------------------------------------ @@ -47,7 +47,7 @@ main_doc = "index" # General information about the project. -project = u"{{ cookiecutter.project_name }}" +project = u"{{ cookiecutter.package_name }}" copyright = u"{% now "local", "%Y" %}, {{ cookiecutter.copyright_holder }}" author = u"{{ cookiecutter.full_name.replace('\"', '\\\"') }}" @@ -56,9 +56,9 @@ # built documents. # # The short X.Y version. -version = {{ cookiecutter.project_name }}.__version__ +version = {{ cookiecutter.package_name }}.__version__ # The full version, including alpha/beta/rc tags. -release = {{ cookiecutter.project_name }}.__version__ +release = {{ cookiecutter.package_name }}.__version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -84,7 +84,7 @@ def run_apidoc(_): here = os.path.dirname(__file__) out = os.path.abspath(os.path.join(here, "apidocs")) - src = os.path.abspath(os.path.join(here, "..", "{{ cookiecutter.project_name }}")) + src = os.path.abspath(os.path.join(here, "..", "{{ cookiecutter.package_name }}")) ignore_paths = [] @@ -151,7 +151,7 @@ def setup(app): # -- Options for HTMLHelp output ------------------------------------------ # Output file base name for HTML help builder. -htmlhelp_basename = "{{ cookiecutter.project_name }}_doc" +htmlhelp_basename = "{{ cookiecutter.package_name }}_doc" # -- Options for LaTeX output --------------------------------------------- @@ -178,7 +178,7 @@ def setup(app): # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (main_doc, "{{ cookiecutter.project_name }}.tex", u"{{ cookiecutter.project_name }} Documentation", + (main_doc, "{{ cookiecutter.package_name }}.tex", u"{{ cookiecutter.package_name }} Documentation", u"{{ cookiecutter.full_name }}", "manual"), ] @@ -188,7 +188,7 @@ def setup(app): # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (main_doc, "{{ cookiecutter.project_name }}", u"{{ cookiecutter.project_name }} Documentation", + (main_doc, "{{ cookiecutter.package_name }}", u"{{ cookiecutter.package_name }} Documentation", [author], 1) ] @@ -199,7 +199,7 @@ def setup(app): # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (main_doc, "{{ cookiecutter.project_name }}", u"{{ cookiecutter.project_name }} Documentation", - author, "{{ cookiecutter.project_name }}", "{{ cookiecutter.package_short_description }}", + (main_doc, "{{ cookiecutter.package_name }}", u"{{ cookiecutter.package_name }} Documentation", + author, "{{ cookiecutter.package_name }}", "{{ cookiecutter.package_short_description }}", "Miscellaneous"), ] From 28f6c611a9e0979cbd374380b1265647e8cfa78f Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 15 Apr 2021 13:13:40 +0200 Subject: [PATCH 16/41] removed template's test_lint as well --- tests/test_lint.py | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 tests/test_lint.py diff --git a/tests/test_lint.py b/tests/test_lint.py deleted file mode 100644 index d76c5939..00000000 --- a/tests/test_lint.py +++ /dev/null @@ -1,31 +0,0 @@ -""" Lint tests """ -import os - -import pycodestyle # formerly known as pep8 - - -def test_pep8_conformance(cookies): - """Test that we conform to PEP-8.""" - check_paths = [ - "my_python_project", - "tests", - ] - exclude_paths = [] - - project = cookies.bake(extra_context={ - "package_short_description": "short description"}) - - print("PEP8 check of directories: {}\n".format(", ".join(check_paths))) - - # Get paths wrt package root - package_root = str(project.project) - for paths in (check_paths, exclude_paths): - for i, path in enumerate(paths): - paths[i] = os.path.join(package_root, path) - - style = pycodestyle.StyleGuide() - style.options.exclude.extend(exclude_paths) - - success = style.check_files(check_paths).total_errors == 0 - - assert success, "The generated code does not conform to PEP8" From 63d2b3477d004710ac5517b68881236bed3afa13 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 15 Apr 2021 13:43:02 +0200 Subject: [PATCH 17/41] test now uses 'project' / 'package' more consistently --- tests/test_values.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_values.py b/tests/test_values.py index a8642c50..649fa63f 100644 --- a/tests/test_values.py +++ b/tests/test_values.py @@ -59,7 +59,7 @@ def test_single_quotes_in_name_and_description(cookies): @pytest.mark.skipif(sys.platform.startswith('win'), reason='Skipping test with sh-module on Windows') def test_dash_in_project_name(cookies): - ctx = {'project_name': "my-package"} + ctx = {'project_name': "my-project"} project = cookies.bake(extra_context=ctx) assert project.exit_code == 0 @@ -83,7 +83,7 @@ def test_dash_in_project_name(cookies): @pytest.mark.skipif(sys.platform.startswith('win'), reason='Skipping test with sh-module on Windows') def test_space_in_project_name(cookies): - ctx = {'project_name': "my package"} + ctx = {'project_name': "my project"} project = cookies.bake(extra_context=ctx) assert project.exit_code == 0 From b5afc3ba581e0929c56ab01efb92b0cc24d9210e Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 15 Apr 2021 17:53:05 +0200 Subject: [PATCH 18/41] updated sphinx docs such that it describes the package, not the project --- {{cookiecutter.project_name}}/docs/index.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/{{cookiecutter.project_name}}/docs/index.rst b/{{cookiecutter.project_name}}/docs/index.rst index f2b005ae..dd757bc4 100644 --- a/{{cookiecutter.project_name}}/docs/index.rst +++ b/{{cookiecutter.project_name}}/docs/index.rst @@ -1,9 +1,9 @@ -.. {{ cookiecutter.project_name }} documentation main file, created by +.. {{ cookiecutter.package_name }} documentation main file, created by sphinx-quickstart on Thu Jun 21 11:07:11 2018. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -Welcome to {{ cookiecutter.project_name }}'s documentation! +Welcome to {{ cookiecutter.package_name }}'s documentation! ========================================================== .. toctree:: @@ -17,7 +17,7 @@ API Reference .. toctree:: :maxdepth: 2 - {{ cookiecutter.project_name }} + {{ cookiecutter.package_name }} {% endif %} Indices and tables From 1b1176ade20d2179887ccde93b6a3c67c37671e2 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 15 Apr 2021 17:59:39 +0200 Subject: [PATCH 19/41] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8e41a43e..b5e997a9 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ cookiecutter https://github.com/nlesc/python-template.git | Name | Default value | Explanation | | ------------------------- | ------------- | ----------- | | package_name | my_python_package | Name of the package. It is safest not to use dashes (-) or spaces in this name. | -| project_name | my-python-project | Name of the project that contains the package. | +| project_name | my-python-project | Name of the project that contains the package. Avoid using spaces or uppercase letters for the best experience across operating systems | | package_short_description |   | The information that you enter here will end up in the README, documentation, license, and setup.cfg, so it may be a good idea to prepare something in advance. | | 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. | From a8b326f621e5850b7b8b1e54f2fbf7ab60589f41 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 15 Apr 2021 18:01:04 +0200 Subject: [PATCH 20/41] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b5e997a9..6369a7f0 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ cookiecutter https://github.com/nlesc/python-template.git | Name | Default value | Explanation | | ------------------------- | ------------- | ----------- | -| package_name | my_python_package | Name of the package. It is safest not to use dashes (-) or spaces in this name. | +| package_name | my_python_package | Name of the package. Avoid using spaces, dashes, or uppercase letters for the best experience across operating systems. | | project_name | my-python-project | Name of the project that contains the package. Avoid using spaces or uppercase letters for the best experience across operating systems | | package_short_description |   | The information that you enter here will end up in the README, documentation, license, and setup.cfg, so it may be a good idea to prepare something in advance. | | version | 0.1.0 |   | From a7599dcee87f9792745c9a67ec09cc980a20e7b7 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 15 Apr 2021 18:14:56 +0200 Subject: [PATCH 21/41] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6369a7f0..f1e31a8e 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,13 @@ Use this [Cookiecutter](https://cookiecutter.readthedocs.io) template to generat an empty Python package. Features include: - Boilerplate tests and documentation, -- [Python setup configuration]({{ cookiecutter.project_name }}/setup.py), +- [Python setup configuration]({{cookiecutter.project_name}}/setup.py), - Open source software license, -- [Default Github actions]({{ cookiecutter.project_name }}/.github/workflows) for building, testing and deployment +- [Default Github actions]({{cookiecutter.project_name}}/.github/workflows) for building, testing and deployment - Code style checking, -- [Editorconfig]({{ cookiecutter.project_name }}/.editorconfig), -- Miscellaneous files, such as [Change log]({{ cookiecutter.project_name }}/CHANGELOG.rst), [Code of Conduct]({{ cookiecutter.project_name }}/CODE_OF_CONDUCT.rst), and [Contributing guidelines]({{ cookiecutter.project_name }}/CONTRIBUTING.rst), -- A [README]({{ cookiecutter.project_name }}/README.rst) and [a separate document]({{ cookiecutter.project_name }}/project_setup.md) with extensive documentation about project setup. +- [Editorconfig]({{cookiecutter.project_name}}/.editorconfig), +- Miscellaneous files, such as [Change log]({{cookiecutter.project_name}}/CHANGELOG.rst), [Code of Conduct]({{cookiecutter.project_name}}/CODE_OF_CONDUCT.rst), and [Contributing guidelines]({{ cookiecutter.project_name }}/CONTRIBUTING.rst), +- A [README]({{cookiecutter.project_name}}/README.rst) and [a separate document]({{cookiecutter.project_name}}/project_setup.md) with extensive documentation about project setup. ## Badges From 184dc728b8fdb610d0fa118c9bcf7459330ee32f Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 15 Apr 2021 18:15:14 +0200 Subject: [PATCH 22/41] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f1e31a8e..963cd9a7 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ an empty Python package. Features include: - [Default Github actions]({{cookiecutter.project_name}}/.github/workflows) for building, testing and deployment - Code style checking, - [Editorconfig]({{cookiecutter.project_name}}/.editorconfig), -- Miscellaneous files, such as [Change log]({{cookiecutter.project_name}}/CHANGELOG.rst), [Code of Conduct]({{cookiecutter.project_name}}/CODE_OF_CONDUCT.rst), and [Contributing guidelines]({{ cookiecutter.project_name }}/CONTRIBUTING.rst), +- Miscellaneous files, such as [Change log]({{cookiecutter.project_name}}/CHANGELOG.rst), [Code of Conduct]({{cookiecutter.project_name}}/CODE_OF_CONDUCT.rst), and [Contributing guidelines]({{cookiecutter.project_name}}/CONTRIBUTING.rst), - A [README]({{cookiecutter.project_name}}/README.rst) and [a separate document]({{cookiecutter.project_name}}/project_setup.md) with extensive documentation about project setup. ## Badges From 72ac6634f044d3204238125d6d9b991ce9b5c8e6 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 15 Apr 2021 18:16:39 +0200 Subject: [PATCH 23/41] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 963cd9a7..5691f115 100644 --- a/README.md +++ b/README.md @@ -58,14 +58,14 @@ cookiecutter https://github.com/nlesc/python-template.git | 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. | -| project_name | my-python-project | Name of the project that contains the package. Avoid using spaces or uppercase letters for the best experience across operating systems | +| project_name | my-python-project | Name of the project that contains the package. Avoid using spaces or uppercase letters for the best experience across operating systems. | | package_short_description |   | The information that you enter here will end up in the README, documentation, license, and setup.cfg, so it may be a good idea to prepare something in advance. | | 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. | | apidoc | no | Add support for automatically generating a module index from the `docstrings` in your Python package (look at the [scriptcwl package](http://scriptcwl.readthedocs.io/en/latest/apidocs/scriptcwl.html) for an example). | full_name | John Smith | Your full name, e.g. _John Smith_. | -| email | yourname@esciencecenter.nl | Your (work) email address | +| email | yourname@esciencecenter.nl | Your (work) email address. | | copyright_holder |   | Name(s) of the organization(s) or person(s) who hold the copyright of the software (e.g., Netherlands eScience Center). | | 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. | From 6b39b90fa26ea891e65717f5f9fbbf8d9a5dc1c6 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 15 Apr 2021 18:17:46 +0200 Subject: [PATCH 24/41] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5691f115..b007016c 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ cookiecutter https://github.com/nlesc/python-template.git | apidoc | no | Add support for automatically generating a module index from the `docstrings` in your Python package (look at the [scriptcwl package](http://scriptcwl.readthedocs.io/en/latest/apidocs/scriptcwl.html) for an example). | full_name | John Smith | Your full name, e.g. _John Smith_. | | email | yourname@esciencecenter.nl | Your (work) email address. | -| copyright_holder |   | Name(s) of the organization(s) or person(s) who hold the copyright of the software (e.g., Netherlands eScience Center). | +| 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. | ### Step 3/3: Read about what was just generated From f31b7e8565ec62e4c2484405796df98a5ba0e613 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Thu, 15 Apr 2021 18:19:21 +0200 Subject: [PATCH 25/41] Update README.md --- README.md | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b007016c..0f971a92 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,39 @@ cookiecutter https://github.com/nlesc/python-template.git ### Step 3/3: Read about what was just generated -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]({{cookiecutter.project_name}}/project_setup.md) file. +Good job! You have now generated the skeleton for your package: + +```text +my-python-project/ +├── CHANGELOG.rst +├── CITATION.cff +├── CODE_OF_CONDUCT.rst +├── CONTRIBUTING.rst +├── docs +│ ├── conf.py +│ ├── index.rst +│ ├── make.bat +│ ├── Makefile +│ ├── _static +│ │ └── theme_overrides.css +│ └── _templates +├── LICENSE +├── MANIFEST.in +├── my_python_package +│ ├── __init__.py +│ ├── my_module.py +│ └── __version__.py +├── NOTICE +├── project_setup.md +├── README.rst +├── setup.cfg +├── setup.py +└── tests + ├── __init__.py + └── test_my_module.py +``` + +For an explanation of what's there, read on in the [project_setup.md]({{cookiecutter.project_name}}/project_setup.md) file. ## Examples From 95dc1e7b06c422de32d509fd7cf6ebcde40f1491 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Mon, 19 Apr 2021 11:22:05 +0200 Subject: [PATCH 26/41] Update hooks/pre_gen_project.py Co-authored-by: Faruk D. --- hooks/pre_gen_project.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index e808e866..b0e713d4 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -1,5 +1,3 @@ -import sys - # Note: cookiecutter first makes the main level directory using # project_name from cookiecutter.json before running this hook @@ -10,5 +8,3 @@ "repository": "https://github.com/" + cookiecutter.github_organization + "/" + cookiecutter.project_name.lower().replace("-", "_"), "package_short_description": cookiecutter.package_short_description.replace('\"', '\\\"') }) }} - -sys.exit(0) From a43e4071f0f84f8cc249b5d827504733a6a5ca25 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Mon, 19 Apr 2021 11:26:30 +0200 Subject: [PATCH 27/41] Update pytest.ini Co-authored-by: Faruk D. --- pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest.ini b/pytest.ini index d0815e0f..9ef83dca 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,2 +1,2 @@ [pytest] -norecursedirs = .git docs */{{cookiecutter.project_name}}/* +norecursedirs = .git .github hooks /{{cookiecutter.project_name}}/* From 451eb73e1a1601efd6b1f7590e409eaf8602b98e Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Mon, 19 Apr 2021 11:38:49 +0200 Subject: [PATCH 28/41] Update {{cookiecutter.project_name}}/README.rst Co-authored-by: Faruk D. --- {{cookiecutter.project_name}}/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_name}}/README.rst b/{{cookiecutter.project_name}}/README.rst index cc188a41..cff17bae 100644 --- a/{{cookiecutter.project_name}}/README.rst +++ b/{{cookiecutter.project_name}}/README.rst @@ -90,7 +90,7 @@ The project setup is documented in `a separate document `_. F Installation ------------ -To install {{ cookiecutter.project_name }}, do: +To install {{ cookiecutter.package_name }}, do: .. code-block:: console From a006a418b8bc82831988027dde03cc70d13e7af5 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Mon, 19 Apr 2021 11:40:29 +0200 Subject: [PATCH 29/41] Update {{cookiecutter.project_name}}/docs/Makefile Co-authored-by: Faruk D. --- {{cookiecutter.project_name}}/docs/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_name}}/docs/Makefile b/{{cookiecutter.project_name}}/docs/Makefile index 02b326f2..48ea1625 100644 --- a/{{cookiecutter.project_name}}/docs/Makefile +++ b/{{cookiecutter.project_name}}/docs/Makefile @@ -4,7 +4,7 @@ # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build -SPHINXPROJ = {{ cookiecutter.project_name }} +SPHINXPROJ = {{ cookiecutter.package_name }} SOURCEDIR = . BUILDDIR = _build From 7bffc8716fb804c26b8e6bf72c334a6dd2a39ef1 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Mon, 19 Apr 2021 11:49:42 +0200 Subject: [PATCH 30/41] Update {{cookiecutter.project_name}}/docs/make.bat Co-authored-by: Faruk D. --- {{cookiecutter.project_name}}/docs/make.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_name}}/docs/make.bat b/{{cookiecutter.project_name}}/docs/make.bat index f74b2920..8176c5be 100644 --- a/{{cookiecutter.project_name}}/docs/make.bat +++ b/{{cookiecutter.project_name}}/docs/make.bat @@ -9,7 +9,7 @@ if "%SPHINXBUILD%" == "" ( ) set SOURCEDIR=. set BUILDDIR=_build -set SPHINXPROJ={{ cookiecutter.project_name }} +set SPHINXPROJ={{ cookiecutter.package_name }} if "%1" == "" goto help From 3d2484ab6d00f7dc57597a94daeb9c420b1c0ceb Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Mon, 19 Apr 2021 11:52:05 +0200 Subject: [PATCH 31/41] Update {{cookiecutter.project_name}}/project_setup.md Co-authored-by: Faruk D. --- {{cookiecutter.project_name}}/project_setup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_name}}/project_setup.md b/{{cookiecutter.project_name}}/project_setup.md index 121fc59d..a07e3885 100644 --- a/{{cookiecutter.project_name}}/project_setup.md +++ b/{{cookiecutter.project_name}}/project_setup.md @@ -56,7 +56,7 @@ help you decide which tool to use for packaging. - Tests should be put in the `tests` folder. - The `tests` folder contains: - Example tests that you should replace with your own meaningful tests (file: - `test_{{ cookiecutter.project_name }}`) + `test_my_module.py`) - A test that checks whether your code conforms to the Python style guide (PEP 8) (file: `test_lint.py`) - The testing framework used is [PyTest](https://pytest.org) - [PyTest introduction](http://pythontesting.net/framework/pytest/pytest-introduction/) From aad53bad3f9763c25084ac24a3685cc207448729 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Mon, 19 Apr 2021 11:52:43 +0200 Subject: [PATCH 32/41] Update {{cookiecutter.project_name}}/project_setup.md Co-authored-by: Faruk D. --- {{cookiecutter.project_name}}/project_setup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_name}}/project_setup.md b/{{cookiecutter.project_name}}/project_setup.md index a07e3885..afe83135 100644 --- a/{{cookiecutter.project_name}}/project_setup.md +++ b/{{cookiecutter.project_name}}/project_setup.md @@ -121,7 +121,7 @@ help you decide which tool to use for packaging. - 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.project_name }}/__version__.py`. For updating the + `{{ cookiecutter.package_name }}/__version__.py`. For updating the version number, you only have to change this file. - Don't forget to update the version number before [making a release](https://guide.esciencecenter.nl/#/best_practices/releases)! From 4cf974c72fbd0acb4ca1dcb655e2f63e897e947e Mon Sep 17 00:00:00 2001 From: Faruk D Date: Mon, 19 Apr 2021 12:36:41 +0200 Subject: [PATCH 33/41] replace project_slug with project_name --- tests/test_values.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_values.py b/tests/test_values.py index 2aa95d83..22001147 100644 --- a/tests/test_values.py +++ b/tests/test_values.py @@ -14,25 +14,25 @@ def test_double_quotes_in_name_and_description(cookies): def test_single_quotes_in_name_and_description(cookies): ctx = { "project_short_description": "'single quotes'", - "full_name": "Mr. O'Keeffe" + "full_name": "Mr. O'Keefe" } project = cookies.bake(extra_context=ctx) assert project.exit_code == 0 -def test_dash_in_project_slug(cookies): +def test_dash_in_project_name(cookies): ctx = { - "project_slug": "my-package" + "project_name": "my-python-project" } project = cookies.bake(extra_context=ctx) assert project.exit_code == 0 -def test_space_in_project_slug(cookies): +def test_space_in_project_name(cookies): ctx = { - "project_slug": "my package" + "project_name": "my python project" } project = cookies.bake(extra_context=ctx) From 322d193a4b9f3cd6f28381d7d8225b9c4d652559 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Mon, 19 Apr 2021 12:37:22 +0200 Subject: [PATCH 34/41] fix project_slug repository --- {{cookiecutter.project_name}}/project_setup.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/{{cookiecutter.project_name}}/project_setup.md b/{{cookiecutter.project_name}}/project_setup.md index afe83135..5c4ea292 100644 --- a/{{cookiecutter.project_name}}/project_setup.md +++ b/{{cookiecutter.project_name}}/project_setup.md @@ -112,9 +112,9 @@ help you decide which tool to use for packaging. 2. login with your GitHub account 3. add organization or reuse existing 4. setup repository - 5. go to [new code definition administration page](https://sonarcloud.io/project/new_code?id={{ cookiecutter.github_organization }}_{{ cookiecutter.project_slug }}) and select `Number of days` option + 5. go to [new code definition administration page](https://sonarcloud.io/project/new_code?id={{ cookiecutter.github_organization }}_{{ cookiecutter.project_name }}) and select `Number of days` option - The analysis will be run by [GitHub Action workflow](.github/workflows/quality.yml) -- To be able to run the analysis, a token must be created at [Sonarcloud account](https://sonarcloud.io/account/security/) and this token must be added as `SONAR_TOKEN` to [secrets on GitHub](https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }}/settings/secrets/actions) +- To be able to run the analysis, a token must be created at [Sonarcloud account](https://sonarcloud.io/account/security/) and this token must be added as `SONAR_TOKEN` to [secrets on GitHub](https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_name }}/settings/secrets/actions) ## Package version number @@ -129,9 +129,9 @@ help you decide which tool to use for packaging. ## Publish on Python Package Index (PyPI) To publish your package on PyPI, you need to create a [PyPI API token](https://pypi.org/help#apitoken) and -save it as a secret called `PYPI_TOKEN` on [Settings page](https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }}/settings/secrets/actions) +save it as a secret called `PYPI_TOKEN` on [Settings page]({{cookiecutter.repository}}/settings/secrets/actions) -[Creating a release](https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }}/releases/new) on GitHub +[Creating a release]({{cookiecutter.repository}}/releases/new) on GitHub will trigger a [GitHub action workflow](.github/workflows/pypi.yml) to publish the release on PyPI for you. ## Logging @@ -147,7 +147,7 @@ will trigger a [GitHub action workflow](.github/workflows/pypi.yml) to publish t - Document changes to your software package - [Relevant section in the guide](https://guide.esciencecenter.nl/#/best_practices/releases?id=changelogmd) - + ## CITATION.cff From f58065381f229fb96429f73d95454e958f0c8916 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Mon, 19 Apr 2021 12:37:54 +0200 Subject: [PATCH 35/41] replace open_source_license with license --- {{cookiecutter.project_name}}/README.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/{{cookiecutter.project_name}}/README.rst b/{{cookiecutter.project_name}}/README.rst index cff17bae..a4b94c05 100644 --- a/{{cookiecutter.project_name}}/README.rst +++ b/{{cookiecutter.project_name}}/README.rst @@ -123,7 +123,7 @@ License ******* Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.copyright_holder }} -{% if cookiecutter.open_source_license == 'MIT license' %} +{% if cookiecutter.license == 'MIT license' %} Licensed under the MIT License. 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: @@ -131,7 +131,7 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of 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.open_source_license == 'BSD license' %} +{% elif cookiecutter.license == 'BSD license' %} Licensed under the 3-clause BSD License. Redistribution and use in source and binary forms, with or without modification, @@ -158,13 +158,13 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -{% elif cookiecutter.open_source_license == 'ISC license' %} +{% elif cookiecutter.license == 'ISC license' %} Licensed under the ISC License. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -{% elif cookiecutter.open_source_license == 'Apache Software License 2.0' %} +{% elif cookiecutter.license == 'Apache Software License 2.0' %} 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 @@ -177,7 +177,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -{% elif cookiecutter.open_source_license == 'GNU General Public License v3 or later' %} +{% elif cookiecutter.license == 'GNU General Public License v3 or later' %} This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or From 79e095c4b1c21c387560da0b6cea56184c69a0b8 Mon Sep 17 00:00:00 2001 From: Faruk D Date: Mon, 19 Apr 2021 12:38:22 +0200 Subject: [PATCH 36/41] fix project_slug and repository --- .../sonar-project.properties | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/{{cookiecutter.project_name}}/sonar-project.properties b/{{cookiecutter.project_name}}/sonar-project.properties index e8ead930..5adf322d 100644 --- a/{{cookiecutter.project_name}}/sonar-project.properties +++ b/{{cookiecutter.project_name}}/sonar-project.properties @@ -1,12 +1,12 @@ sonar.organization={{ cookiecutter.github_organization }} -sonar.projectKey={{ cookiecutter.github_organization }}_{{ cookiecutter.project_slug }} +sonar.projectKey={{ cookiecutter.github_organization }}_{{ cookiecutter.project_name }} sonar.host.url=https://sonarcloud.io -sonar.sources={{ cookiecutter.project_slug.lower().replace(" ", "_").replace("-", "_")}}/ +sonar.sources={{ cookiecutter.package_name }}/ sonar.tests=tests/ -sonar.links.homepage=https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }} -sonar.links.scm=https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }} -sonar.links.issue=https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }}/issues -sonar.links.ci=https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }}/actions +sonar.links.homepage={{ cookiecutter.repository }} +sonar.links.scm={{ cookiecutter.repository }} +sonar.links.issue={{ cookiecutter.repository }}/issues +sonar.links.ci={{ cookiecutter.repository }}/actions sonar.python.coverage.reportPaths=coverage.xml sonar.python.xunit.reportPath=xunit-result.xml sonar.python.pylint.reportPaths=pylint-report.txt From c7b14bf78028b4cf450db3df2777049c27679818 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Mon, 19 Apr 2021 12:52:52 +0200 Subject: [PATCH 37/41] Update {{cookiecutter.project_name}}/tests/test_my_module.py --- {{cookiecutter.project_name}}/tests/test_my_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_name}}/tests/test_my_module.py b/{{cookiecutter.project_name}}/tests/test_my_module.py index 3728247a..97f5b045 100644 --- a/{{cookiecutter.project_name}}/tests/test_my_module.py +++ b/{{cookiecutter.project_name}}/tests/test_my_module.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -"""Tests for the {{ cookiecutter.package_name }} module. +"""Tests for the {{ cookiecutter.package_name }}.my_module module. """ import pytest From 99556697a2c190c90cc5eafab3baff09a15a47f7 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Mon, 19 Apr 2021 12:53:36 +0200 Subject: [PATCH 38/41] Update {{cookiecutter.project_name}}/tests/test_my_module.py --- {{cookiecutter.project_name}}/tests/test_my_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_name}}/tests/test_my_module.py b/{{cookiecutter.project_name}}/tests/test_my_module.py index 97f5b045..c4b47a4d 100644 --- a/{{cookiecutter.project_name}}/tests/test_my_module.py +++ b/{{cookiecutter.project_name}}/tests/test_my_module.py @@ -23,5 +23,5 @@ def an_object(): return {} -def test_{{ cookiecutter.package_name }}(an_object): +def test_my_module(an_object): assert an_object == {} From 74ab09a6769b0d3128af4e1b422dd1d6e40ee657 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Mon, 19 Apr 2021 12:59:13 +0200 Subject: [PATCH 39/41] just testing Update {{cookiecutter.project_name}}/tests/test_my_module.py Co-authored-by: Faruk D. --- {{cookiecutter.project_name}}/tests/test_my_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_name}}/tests/test_my_module.py b/{{cookiecutter.project_name}}/tests/test_my_module.py index c4b47a4d..b229a7d4 100644 --- a/{{cookiecutter.project_name}}/tests/test_my_module.py +++ b/{{cookiecutter.project_name}}/tests/test_my_module.py @@ -4,7 +4,7 @@ """ import pytest -from {{ cookiecutter.package_name }} import my_module +from {{cookiecutter.package_name}} import my_module def test_something(): From e507f4c1df79100f716874cfc9e43d419da28fda Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Mon, 19 Apr 2021 14:26:24 +0200 Subject: [PATCH 40/41] Update pytest.ini --- pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest.ini b/pytest.ini index 9ef83dca..f250df17 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,2 +1,2 @@ [pytest] -norecursedirs = .git .github hooks /{{cookiecutter.project_name}}/* +norecursedirs = .git .github hooks {{cookiecutter.project_name}} From f6e4453845de1ae3602a7aa80a76127e87893c80 Mon Sep 17 00:00:00 2001 From: "Jurriaan H. Spaaks" Date: Mon, 19 Apr 2021 14:27:22 +0200 Subject: [PATCH 41/41] Update test_my_module.py --- {{cookiecutter.project_name}}/tests/test_my_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_name}}/tests/test_my_module.py b/{{cookiecutter.project_name}}/tests/test_my_module.py index b229a7d4..c4b47a4d 100644 --- a/{{cookiecutter.project_name}}/tests/test_my_module.py +++ b/{{cookiecutter.project_name}}/tests/test_my_module.py @@ -4,7 +4,7 @@ """ import pytest -from {{cookiecutter.package_name}} import my_module +from {{ cookiecutter.package_name }} import my_module def test_something():