Skip to content

Commit

Permalink
Merge branch 'main' of github.com:NLeSC/python-template into line-length
Browse files Browse the repository at this point in the history
  • Loading branch information
bouweandela committed Sep 2, 2024
2 parents 3e89571 + 6df50e1 commit 6d41fb7
Show file tree
Hide file tree
Showing 53 changed files with 281 additions and 138 deletions.
57 changes: 37 additions & 20 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
## [Unreleased]

### Added

### Changed

### Removed

## [0.6.0]

### Added

* Keep project_setup.md for all the profiles and remove from the menu [#576](https://github.com/NLeSC/python-template/pull/576)
* Make contributing guidelines optional [#465](https://github.com/NLeSC/python-template/pull/465)
* Make linting optional [#568](https://github.com/NLeSC/python-template/pull/568)
Expand All @@ -15,8 +24,17 @@
* Make SonarCloud optional [#515](https://github.com/NLeSC/python-template/pull/515)
* Make citation optional [#471](https://github.com/NLeSC/python-template/pull/471)
* Make online documentation optional [#476](https://github.com/NLeSC/python-template/pull/476)
* Make local documentation optional [#593](https://github.com/NLeSC/python-template/pull/593)
* Make local test optional [#594](https://github.com/NLeSC/python-template/pull/594)

### Changed

* Update the user documentation (README.md) of the template [#575](https://github.com/NLeSC/python-template/pull/623)
* Updated .gitignore [#622](https://github.com/NLeSC/python-template/pull/622)
* add extra info for sub-menus [#628](https://github.com/NLeSC/python-template/pull/628)
* skip merging CHANGELOG.md and CODE_OF_CONDUCT.md if they exist [#628](https://github.com/NLeSC/python-template/pull/628)
* added value field to license options [#617](https://github.com/NLeSC/python-template/pull/617)
* fix filename typo of githooks [#611](https://github.com/NLeSC/python-template/pull/609)
* next_steps.md is shown as a copier message [#609](https://github.com/NLeSC/python-template/pull/609)
* Change the default profile to 'recommended' [#598](https://github.com/NLeSC/python-template/pull/598)
* Updated the user documentation (README.md) of the template [#569](https://github.com/NLeSC/python-template/pull/569)
Expand All @@ -27,6 +45,7 @@
* Restored default line-length of 79 characters, as recommended by [PEP-8](https://peps.python.org/pep-0008/#maximum-line-length) [#389](https://github.com/NLeSC/python-template/pull/389)

### Removed

* Remove the configuration of isort ([#591](https://github.com/NLeSC/python-template/pull/591)), which is no longer used since [#347](https://github.com/NLeSC/python-template/issues/347).

## [0.5.0]
Expand Down Expand Up @@ -144,7 +163,6 @@ Released on Apr 22, 2021
* Drop Python 3.5 support
* Removed unit tests doing the linting


## [0.2.0]

Released on July 17, 2019
Expand All @@ -170,14 +188,14 @@ Released on July 17, 2019
* 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
* 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
* Project setup
* Setup instructions
* NOTICE file

### Removed

Expand All @@ -190,20 +208,19 @@ 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

* Tests,
* Documentation,
* Code style checking
* Editorconfig
* Default Travis configuration
* Change log
* Code of Conduct
* Contributing guidelines
* License
* Manifest.in
* README
* Requirements.txt
* Setup configuration

[Unreleased]: https://github.com/NLeSC/python-template//compare/0.5.0...HEAD
[0.5.0]: https://github.com/NLeSC/python-template/releases/tag/0.5.0
Expand Down
18 changes: 17 additions & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,22 @@ authors:
family-names: Tjong Kim Sang
given-names: Erik
orcid: "https://orcid.org/0000-0002-8431-081X"
- given-names: Abel
family-names: Soares Siqueira
email: [email protected]
affiliation: Netherlands eScience Center
orcid: "https://orcid.org/0000-0003-4451-281X"
- given-names: Olga
family-names: Lyashevska
email: [email protected]
affiliation: Netherlands eScience Center
orcid: 'https://orcid.org/0000-0002-8686-8550'
- given-names: Sander
name-particle: van
family-names: Rijn
email: [email protected]
affiliation: Netherlands eScience Center
orcid: 'https://orcid.org/0000-0001-6159-041X'
cff-version: "1.2.0"
date-released: 2018-07-17
doi: 10.5281/zenodo.1310751
Expand All @@ -79,4 +95,4 @@ license: Apache-2.0
message: "If you use this software, please cite it using these metadata."
repository-code: "https://github.com/NLeSC/python-template"
title: "Netherlands eScience Center Python Template"
version: "0.4.0"
version: "0.6.0"
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
# Netherlands eScience Center Python Template

Spend less time setting up and configuring your new Python packages which includes research software good practices from the start.
Spend less time setting up and configuring your new Python packages by using this template. This [Copier](https://copier.readthedocs.io) template includes best practices for research software so your new package will include these practices from the start.

Use this [Copier](https://copier.readthedocs.io) template to generate an empty Python package. Features include:
You can choose from various user profiles, each offering a range of features to suit your needs.

## User profiles

The template profiles for a Python package offer varying levels of customization to cater to different user needs. Below are the profiles the template offers.

### Minimum

This profile offers the essential features to begin developing a Python package, making it ideal for first-time research software developers. Additional features can be added as needed.

### Recommended

This option provides a pre-selected set of features for research software, which users can fully customize.

### Let me choose

This fully customizable profile enables you to selectively include or exclude features in your Python package.

## Features

- Boilerplate unit tests and documentation,
- [Python static setup configuration](template/pyproject.toml.jinja),
Expand All @@ -14,7 +32,7 @@ Use this [Copier](https://copier.readthedocs.io) template to generate an empty P
- [README.md](template/README.md.jinja) for package users,
- [README.dev.md](template/README.dev.md.jinja) for package developer,
- [project_setup.md](template/project_setup.md.jinja) with extensive documentation about project setup,
- [Change log](template/%7B%25%20if%20AddChangeLog%20%25%7DCHANGELOG.md%7B%25%20endif%20%25%7D),
- [Changelog](template/%7B%25%20if%20AddChangeLog%20%25%7DCHANGELOG.md%7B%25%20endif%20%25%7D),
- [Code of Conduct](template/CODE_OF_CONDUCT.md.jinja),
- [Contributing guidelines](template/CONTRIBUTING.md.jinja),
- Continuous code quality and code coverage reporting using [Sonarcloud](https://sonarcloud.io/),
Expand Down
12 changes: 8 additions & 4 deletions copier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,25 @@
!include copier/questions/package_details.yml

---
# code quality
# code quality features
!include copier/questions/features_code_quality.yml

---
# publish and release
# publish and release features
!include copier/questions/features_publish_release.yml

---
# publish and release
# publish and release features
!include copier/questions/features_documentation.yml

---
# community
# community features
!include copier/questions/features_community.yml

---
# global flags
!include copier/global_flags.yml

---
# User messages
!include copier/messages.yml
16 changes: 16 additions & 0 deletions copier/global_flags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
# Computed values that depend on multiple values

HasWorkflows:
type: bool
default: "{{
AddGitHubActionBuild
or AddGitHubActionDocumentation
or AddLinkCheck
or AddCFFConvert
or AddCitation
or AddOnlineDocumentation
or AddSonarCloud
or AddZenodo
or AddLinting }}"
when: false
8 changes: 3 additions & 5 deletions copier/messages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,19 @@ _message_after_copy: |
git add --all
git commit -m "first commit"
git branch -M main
git remote add origin {{ repository }}
git remote add origin {{ repository }}.git
- Push the initial commit to a new repo on GitHub
Go to https://github.com/organizations/{{github_organization}}/repositories/new
and create a new repository named `{{ package_name }}` as an empty repository, then push your commits to GitHub:
git push --set-upstream origin main
{% if AddDevDoc -%}
{% if AddDevDoc %}
- Project development documentation
The README.dev.md contains developer documentation
{%- endif %}
{% endif %}
- Project layout explained
For an explanation of what files are there, and what each of these do, please refer to {{ _copier_conf.dst_path }}/project_setup.md
Expand Down
30 changes: 19 additions & 11 deletions copier/questions/essential.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# Essential questions
package_name:
type: str
placeholder: my_python_package
help: Enter the name of the Python package.
placeholder: your_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
Expand All @@ -22,16 +22,24 @@ full_name:
help: Enter your full name
validator: >-
{% if not full_name %}
Name cannot be empty
Full name cannot be empty!
{% endif %}
license:
type: str
default: "Apachev2"
help: "Select a license (see: https://choosealicense.com)"
choices:
- "Apache-2.0"
- "MIT license"
- "BSD license"
- "ISC license"
- "GNU General Public License v3 or later"
- "GNU Lesser General Public License v3 or later"
- "Not open source"
default: "Apache-2.0"
Apache License, Version 2.0:
value: Apachev2
MIT license:
value: MIT
BSD license:
value: BSD
ISC license:
value: ISC
GNU General Public License v3 or later:
value: GNUv3
GNU Lesser General Public License v3 or later:
value: GNULesserv3
Other (add your own license):
value: Other
23 changes: 13 additions & 10 deletions copier/questions/features_code_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@ SelectCodeQualityFeatures:
type: yaml
default: |-
{% if template_profile == 'recommended' %}
[SelectGitHubActions_flag, AddLinting_flag, AddSonarCloud_flag, AddEditorConfig_flag]
[AddLocalTests_flag, SelectGitHubActions_flag, AddLinting_flag, AddSonarCloud_flag, AddEditorConfig_flag]
{%- else -%}
[]
{%- endif %}
help: Select code quality features
multiselect: true
choices:
GitHub Actions:
Unit tests (using pytest):
value: AddLocalTests_flag
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"
GitHub Actions (select in the next step):
value: SelectGitHubActions_flag
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"
Linting:
Expand All @@ -37,7 +40,7 @@ SelectGitHubActions:
type: yaml
default: |-
{% if template_profile == 'recommended' %}
[AddGitHubActionBuild_flag, AddGitHubActionDocumentation_flag]
[AddGitHubActionBuild_flag]
{%- else -%}
[]
{%- endif %}
Expand All @@ -47,22 +50,22 @@ SelectGitHubActions:
Build:
value: AddGitHubActionBuild_flag
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"
Documentation:
value: AddGitHubActionDocumentation_flag
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"
Link checker (reports broken URLs):
value: AddLinkCheck_flag
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"


# computed features
AddGitHubActionBuild:
AddLocalTests:
type: bool
default: "{{ 'AddGitHubActionBuild_flag' in SelectGitHubActions }}"
default: "{{
'AddLocalTests_flag' in SelectCodeQualityFeatures
or 'AddGitHubActionBuild_flag' in SelectGitHubActions
or 'AddSonarCloud_flag' in SelectCodeQualityFeatures }}"
when: false
AddGitHubActionDocumentation:
AddGitHubActionBuild:
type: bool
default: "{{ 'AddGitHubActionDocumentation_flag' in SelectGitHubActions }}"
default: "{{ 'AddGitHubActionBuild_flag' in SelectGitHubActions }}"
when: false
AddLinkCheck:
type: bool
Expand Down
11 changes: 10 additions & 1 deletion copier/questions/features_community.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,21 @@ SelectCommunityFeatures:
value: AddContributing_flag
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"

code_of_conduct_email:
when: "{{ 'AddCodeConduct_flag' in SelectCommunityFeatures }}"
type: str
default: "{{ email }}"
help: What is the email address to report code of conduct violations?
validator: >-
{% if not (code_of_conduct_email | regex_search('([A-Za-z0-9]+[.-_])*[A-Za-z0-9]+@[A-Za-z0-9-]+(\.[A-Z|a-z]{2,})+')) %}
Please enter a valid email address
{% endif %}
# computed features
AddCodeConduct:
type: bool
default: "{{ 'AddCodeConduct_flag' in SelectCommunityFeatures }}"
when: false

AddContributing:
type: bool
default: "{{ 'AddContributing_flag' in SelectCommunityFeatures }}"
Expand Down
Loading

0 comments on commit 6d41fb7

Please sign in to comment.