Skip to content

Commit

Permalink
Migrate from cookiecutter to copier
Browse files Browse the repository at this point in the history
This migrates from cookiecutter template to copier while keeping all
features as they are. This was done by @sjvrijn and @lyashevska.

Closes #348
  • Loading branch information
lyashevska committed Jul 25, 2024
1 parent 780e6a4 commit 2014aa2
Show file tree
Hide file tree
Showing 65 changed files with 888 additions and 642 deletions.
File renamed without changes.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/10_generated_package.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<<<<<<< HEAD
---
name: Related to the generated package
about: Related to the generated package, as opposed to the template itself.
Expand All @@ -7,5 +8,5 @@ assignees: ''

---
<!--
Whatever you write here must have something to do with the code you get from running `cookiecutter`.
Whatever you write here must have something to do with the code you get from running `copier`.
-->
17 changes: 16 additions & 1 deletion .github/ISSUE_TEMPLATE/20_template.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<<<<<<< HEAD
---
name: Related to the template itself
about: Related to the template itself, as opposed to the generated package.
Expand All @@ -7,5 +8,19 @@ assignees: ''

---
<!--
Whatever you write here must have something to do with the code of the template itself, i.e. before you run `cookiecutter`.
Whatever you write here must have something to do with the code of the template itself, i.e. before you run `copier`.
-->
||||||| empty tree
=======
---
name: Related to the template itself
about: Related to the template itself, as opposed to the generated package.
title: ''
labels: template
assignees: ''

---
<!--
Whatever you write here must have something to do with the code of the template itself, i.e. before you run `copier`.
-->
>>>>>>> copier/main
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ env
env3
venv
venv3

.swp
.orig
166 changes: 166 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,172 @@
* Removed unit tests doing the linting


## 0.2.0

Released on July 17, 2019

### Added

* Set up logging and provide a logging example (#9)
* Fix for displaying wide tables in the documentation (#37)
* Single source version number (+ documentation) (#29)
* Cookiecutter tests (#15)
* Linter test for the generated project
* CITATION.cff
* Support for pypi deployment using travis (#36)

### Changed

* Replace dashes and spaces in project_slug with underscore (#33)
* Put project setup documentation in a separate document (#39)
* Fix numbered lists in .rst files (#40)
* Added rst, y(a)ml and cwl to .editorconfig (#35)
* Default documentation theme is `sphinx_rtd_theme` (#34)
* Improve licensing
* Fix example tests that failed to run (#28)
* Remove quotes from project name and project description (#27)
* Update prospector configuration (#26)
- Make prospector less strict
- Have prospector ignore the docs directory
* Add `install_requires` to `setup.py` (#21)
* Improved .gitignore (#22)
* More detailed documentation about
- Project setup
- Setup instructions
- NOTICE file

### Removed

* Python 2 support

## 0.1.0

Released on July 12, 2018.

### Added

* First version of the Python project template that follows the Netherlands eScience Center software development guide, containing:
- Tests,
- Documentation,
- Code style checking
- Editorconfig
- Default Travis configuration
- Change log
- Code of Conduct
- Contributing guidelines
- License
- Manifest.in
- README
- Requirements.txt
- Setup configuration
||||||| empty tree
=======
# Change Log

## Unreleased

### Added

* Added Python 3.12 support [#356](https://github.com/NLeSC/python-template/issues/356)
* Template unit tests for documentation generation, linting and version bumping
* Docstring for function
* Intersphinx to documentation
* Coverage and doctest commands for documentation [#97](https://github.com/NLeSC/python-template/issues/97)

### Changed

* Moved to src/ based layout for generated packages
* Moved from setup.cfg/.py to pyproject.toml [#351](https://github.com/NLeSC/python-template/issues/351)
* Moved from prospector to ruff [#336](https://github.com/NLeSC/python-template/issues/336)
* Renamed `project_name` to `directory_name` in cookiecutter questionnaire
* Initial linting is error free [#227](https://github.com/NLeSC/python-template/issues/227)
* Consolidated test/lint/build/docs into single matrix workflow [#270](https://github.com/NLeSC/python-template/issues/276)
* Enforce isort configuration
* Default for `package_short_description` in cookiecutter questionnaire
* Link checker ignores GH private pages and test pypi site [#288](https://github.com/NLeSC/python-template/issues/288)
* In CI build workflow make prospector die if there are errors [#275](https://github.com/NLeSC/python-template/issues/275)
* All example tests make use of example function
* Use bumpversion for version in Sphinx config [#44](https://github.com/NLeSC/python-template/issues/44)
* Regenerated docs/conf.py with sphinx-quickstart v3.5.4 + enabled built-in extensions [#44](https://github.com/NLeSC/python-template/issues/44)
* Generate api rst files with extension instead of custom function [#95](https://github.com/NLeSC/python-template/issues/95)
* Change from bump2version (unmaintained) to bump-my-version.

### Removed

* Removed Python 3.7 support [#343](https://github.com/NLeSC/python-template/issues/343)
* `.pylintrc` file, was too strict, too soon [#267](https://github.com/NLeSC/python-template/issues/267)
* Unused development dependencies [#167](https://github.com/NLeSC/python-template/issues/167)
* Statements in project_setup.md already mentioned in README.dev.md
* .zenodo.json is no longer necessary, CITATION.cff also works with Zenodo.

## 0.4.0

### Added

* Instructions to add your existing code to directory generated by the NLeSC Python template [#202](https://github.com/NLeSC/python-template/issues/202)
* Keywords to questionnaire [#270](https://github.com/NLeSC/python-template/issues/270)
* Next step issue generation workflow [#228](https://github.com/NLeSC/python-template/issues/228)
* Next step issue for SonarCloud integration [#234](https://github.com/NLeSC/python-template/issues/234)
* Next step issue for Zenodo integration [#235](https://github.com/NLeSC/python-template/issues/235)
* Next step issue for Read the Docs [#236](https://github.com/NLeSC/python-template/issues/236)
* Next step issue for citation data [#237](https://github.com/NLeSC/python-template/issues/237)
* Next step issue for linting [#238](https://github.com/NLeSC/python-template/issues/238)
* Next steps documentation [#240](https://github.com/NLeSC/python-template/issues/240)
* Support for sub packages in distro [#160](https://github.com/NLeSC/python-template/issues/160)
* Tests for api doc generation [#213](https://github.com/NLeSC/python-template/issues/213)
* CI Tests on Windows [#140](https://github.com/NLeSC/python-template/issues/140) [#223](https://github.com/NLeSC/python-template/issues/223)
* `.pylintrc` file
* Valid license name and first author name in `CITATION.cff`
* SonarCloud integration for code quality and coverage [#89](https://github.com/NLeSC/python-template/issues/89)
* Read the Docs [#78](https://github.com/NLeSC/python-template/issues/78)

### Changed

* Always generate API docs [#176](https://github.com/NLeSC/python-template/issues/176)
* Have 100% test coverage in generated code [#88](https://github.com/NLeSC/python-template/issues/88)

### Removed

* Automatic publish to PyPi after GitHub release [#196](https://github.com/NLeSC/python-template/issues/196)

## 0.3.0

### Added

* Added Python 3.9 support
* Template is being tested for Python 3.6, 3.7, 3.8, 3.9
* Added extra badges such as fair-software.eu badges and SonarCloud, GitHub Actions [#52](https://github.com/NLeSC/python-template/issues/52) [#57](https://github.com/NLeSC/python-template/issues/57)
* Added issue templates [#159](https://github.com/NLeSC/python-template/issues/159)
* Added cffconvert GitHub action [#91](https://github.com/NLeSC/python-template/issues/91)
* Added Markdown Link Checker GitHub action
* Added Developer documentation
* Added cookiecutter post-hook to point to document with more information
* Migrated to static setup.cfg as per the recommended practice [#84](https://github.com/NLeSC/python-template/issues/84)
* Added Pre-commit githook to automatically run the linters before committing to GitHub [#82](https://github.com/NLeSC/python-template/issues/82)
* Added Sonarcloud integration for static analysis and code coverage [#172](https://github.com/NLeSC/python-template/issues/172)
* Added badges to the generated package

### Changed

* Moved requirements.txt dependencies to setup.cfg and removed requirements.txt [#67](https://github.com/NLeSC/python-template/issues/67)
* Replaced all ReStructuredText (rst) files by Markdown [#190](https://github.com/NLeSC/python-template/issues/190) [#162](https://github.com/NLeSC/python-template/issues/162)
* Use matrix build for generated project to support all current Python versions on Windows, Linux, Mac [#160](https://github.com/NLeSC/python-template/issues/160)
* Updated CITATION.cff, .zenodo.json; removed codemeta.json [#127](https://github.com/NLeSC/python-template/issues/127) [#137](https://github.com/NLeSC/python-template/issues/137)
* Updated Code of Conduct of the template
* Simplified templating variables using cookiecutter pre-hook [#82](https://github.com/NLeSC/python-template/issues/82)
* Consolidated pytest.ini into setup.cfg [#155](https://github.com/NLeSC/python-template/issues/155)
* Versioning now handled with bump2version [#192](https://github.com/NLeSC/python-template/issues/192)
* Updated project_setup.md [#165](https://github.com/NLeSC/python-template/issues/165)
* Updated Code of Conduct for generated package
* Improved the documentation for the generated package and template itself

## Removed
* Dropped appveyor [#160](https://github.com/NLeSC/python-template/issues/160)
* Dropped everything Conda related
* Drop Python 3.5 support
* Removed unit tests doing the linting


## 0.2.0

Released on July 17, 2019
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ cff-version: "1.2.0"
date-released: 2018-07-17
doi: 10.5281/zenodo.1310751
keywords:
- cookiecutter
- copier
- template
- Python
license: Apache-2.0
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Netherlands eScience Center Python Template

|[![Copier](https://img.shields.io/endpoint?url=https://github.com/raw/copier-org/copier/master/img/badge/badge-grayscale-inverted-border-purple.json)](https://github.com/copier-org/copier)

Spend less time setting up and configuring your new Python packages and comply with the
[Netherlands eScience Center Software Development Guide](https://guide.esciencecenter.nl/)
from the start.
Expand Down Expand Up @@ -162,3 +164,12 @@ list below:
## How to contribute

Suggestions/improvements/edits are most welcome. Please read the [contribution guidelines](CONTRIBUTING.md) before creating an issue or a pull request.




<!-- To generate a project from the template:
```
pip install copier
copier copy path/to/project/template path/to/destination
``` -->
14 changes: 0 additions & 14 deletions cookiecutter.json

This file was deleted.

70 changes: 70 additions & 0 deletions copier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Essential questions

package_name:
type: str
default: my_python_package
help: Enter the name of the Python package.
validator: >-
{% if not (package_name | regex_search('^[a-z][a-z0-9\_]+$')) %}
package_name must start with a letter, followed one or more letters, digits or underscores all lowercase.
{% endif %}
package_short_description:
type: str
default: Short description of package
# validator: >-
# {% if '"' in package_short_description %}
# package_short_description must not contain unescaped double quotes. Use \\" for double quotes.
# {% endif %}
keyword1:
type: str
default: keyword1
keyword2:
type: str
default: keyword2
version:
type: str
default: 0.1.0
github_organization:
type: str
default: "<my-github-organization>"
license:
type: str
choices:
- "Apache Software License 2.0"
- "MIT license"
- "BSD license"
- "ISC license"
- "GNU General Public License v3 or later"
- "GNU Lesser General Public License v3 or later"
- "Not open source"
default: "MIT license"
full_name:
type: str
default: Jane Smith
help: Enter your full name.
# validator: >-
# {% if '"' in full_name %}
# full_name must not contain unescaped double quotes. Use \\" for double quotes.
# {% endif %}
email:
type: str
default: yourname@esciencecenter.nl
copyright_holder:
type: str
default: Netherlands eScience Center
code_of_conduct_email:
type: str
default: "{{ email }}"

_subdirectory: template

repository:
default: git@github.com:{{ github_organization }}/{{ directory_name }}
when: false

repository_url:
default: https://github.com/{{ github_organization }}/{{ directory_name }}
when: false


# Optional questions
1 change: 0 additions & 1 deletion hooks/post_gen_project.py

This file was deleted.

11 changes: 0 additions & 11 deletions hooks/pre_gen_project.py

This file was deleted.

7 changes: 4 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ include_package_data = True
python_requires = >=3.8
packages =
install_requires =
cookiecutter==1.7.2
copier==9.2.0

[options.data_files]
# This section requires setuptools>=40.6.0
Expand All @@ -45,9 +45,10 @@ install_requires =
dev =
coverage [toml]
pytest
pytest-cookies
pytest-copie
pyprojroot


[tool:pytest]
testpaths = tests
norecursedirs = .git .github hooks {{cookiecutter.directory_name}}
norecursedirs = .git .github hooks template
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ title: 'Next step: Sonarcloud integration'

Continuous code quality can be handled by [Sonarcloud](https://sonarcloud.io/). This repository is configured to use Sonarcloud to perform quality analysis and code coverage report on each push.

In order to configure Sonarcloud analysis [GitHub Action workflow]({{cookiecutter.repository_url}}/blob/main/.github/workflows/sonarcloud.yml) you must follow the steps below:
In order to configure Sonarcloud analysis [GitHub Action workflow]({{repository_url}}/blob/main/.github/workflows/sonarcloud.yml) you must follow the steps below:

1. go to [Sonarcloud](https://sonarcloud.io/projects/create) to create a new Sonarcloud project
1. login with your GitHub account
1. add Sonarcloud organization or reuse existing one
1. set up a repository
1. go to [new code definition administration page](https://sonarcloud.io/project/new_code?id={{cookiecutter.github_organization}}_{{cookiecutter.directory_name}}) and select `Number of days` option
1. go to [new code definition administration page](https://sonarcloud.io/project/new_code?id={{github_organization}}_{{directory_name}}) and select `Number of days` option
1. To be able to run the analysis:
1. a token must be created at [Sonarcloud account](https://sonarcloud.io/account/security/)
1. the created token must be added as `SONAR_TOKEN` to [secrets on GitHub](https://github.com/{{cookiecutter.github_organization}}/{{cookiecutter.directory_name}}/settings/secrets/actions)
1. the created token must be added as `SONAR_TOKEN` to [secrets on GitHub](https://github.com/{{github_organization}}/{{directory_name}}/settings/secrets/actions)
Loading

0 comments on commit 2014aa2

Please sign in to comment.