Skip to content

Commit

Permalink
Merge pull request #547 from NLeSC/535_menu_and_profiles
Browse files Browse the repository at this point in the history
535-menu and profiles
  • Loading branch information
fdiblen committed Aug 27, 2024
2 parents 7621d1c + 17e4d1f commit ec6a235
Show file tree
Hide file tree
Showing 13 changed files with 281 additions and 83 deletions.
16 changes: 14 additions & 2 deletions copier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,20 @@
!include copier/questions/package_details.yml

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

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

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

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

---
# User messages
Expand Down
18 changes: 15 additions & 3 deletions copier/questions/essential.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,28 @@ package_name:
{% endif %}
version:
type: str
placeholder: 0.1.0
default: 0.1.0
help: Enter the version of the Python package
validator: >-
{% if not (version | regex_search('^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$')) %}
Package version should use Semantic Versioning 2.0.0 (MAJOR.MINOR.PATCH)
{% endif %}
full_name:
type: str
placeholder: Jane Smith
help: Enter your full name
validator: >-
{% if not full_name %}
Name cannot be empty
{% endif %}
license:
type: str
choices:
- "Apache Software License 2.0"
- "Apache-2.0"
- "MIT license"
- "BSD license"
- "ISC license"
- "GNU General Public License v3 or later"
- "GNU Lesser General Public License v3 or later"
- "Not open source"
default: "Apache Software License 2.0"
default: "Apache-2.0"
62 changes: 0 additions & 62 deletions copier/questions/features.yml

This file was deleted.

82 changes: 82 additions & 0 deletions copier/questions/features_code_quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
# Questions for code quality features

# the main menu
SelectCodeQualityFeatures:
when: "{{ template_profile != 'minimum' }}"
type: yaml
default: |-
{% if template_profile == 'recommended' %}
[SelectGitHubActions_flag, not_implemented_linting, AddSonarCloud_flag, not_implemented_editor_config]
{%- else -%}
[]
{%- endif %}
help: Select code quality features
multiselect: true
choices:
GitHub Actions:
value: SelectGitHubActions_flag
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"
Linting (using ruff NOT_IMPLEMENTED):
value: not_implemented_linting
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"
Pre-commit:
value: AddPreCommit_flag
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"
Code analysis (using SonarCloud):
value: AddSonarCloud_flag
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"
Editorconfig (NOT_IMPLEMENTED):
value: not_implemented_editor_config
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"


# Sub-menus
SelectGitHubActions:
when: "{{ 'SelectGitHubActions_flag' in SelectCodeQualityFeatures }}"
type: yaml
default: |-
{% if template_profile == 'recommended' %}
[AddGitHubActionBuild_flag, AddGitHubActionDocumentation_flag]
{%- else -%}
[]
{%- endif %}
help: Select GitHub Action workflows
multiselect: true
choices:
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:
type: bool
default: "{{ 'AddGitHubActionBuild_flag' in SelectGitHubActions }}"
when: false

AddGitHubActionDocumentation:
type: bool
default: "{{ 'AddGitHubActionDocumentation_flag' in SelectGitHubActions }}"
when: false

AddLinkCheck:
type: bool
default: "{{ 'AddLinkCheck_flag' in SelectGitHubActions }}"
when: false

AddPreCommit:
type: bool
default: "{{ 'AddPreCommit_flag' in SelectCodeQualityFeatures }}"
when: false

AddSonarCloud:
type: bool
default: "{{ 'AddSonarCloud_flag' in SelectCodeQualityFeatures }}"
when: false
33 changes: 33 additions & 0 deletions copier/questions/features_community.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
# Questions for community features

# the main menu
SelectCommunityFeatures:
when: "{{ template_profile != 'minimum' }}"
type: yaml
default: |-
{% if template_profile == 'recommended' %}
[AddCodeConduct_flag, AddContributing_flag]
{%- else -%}
[]
{%- endif %}
help: Select community features
multiselect: true
choices:
Code of conduct:
value: AddCodeConduct_flag
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"
Contributing guidelines:
value: AddContributing_flag
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"

# computed features
AddCodeConduct:
type: bool
default: "{{ 'AddCodeConduct_flag' in SelectCommunityFeatures }}"
when: false

AddContributing:
type: bool
default: "{{ 'AddContributing_flag' in SelectCommunityFeatures }}"
when: false
36 changes: 36 additions & 0 deletions copier/questions/features_documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
# Questions for documentation features

# the main menu
SelectDocumentationFeatures:
when: "{{ template_profile != 'minimum' }}"
type: yaml
default: |-
{% if template_profile == 'recommended' %}
[AddOnlineDocumentation_flag, AddDevDoc_flag, not_implemented_project_setup]
{%- else -%}
[]
{%- endif %}
help: Select documentation features
multiselect: true
choices:
Online documentation (using Read the Docs):
value: AddOnlineDocumentation_flag
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"
Developer documentation:
value: AddDevDoc_flag
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"
Project setup description (NOT_IMPLEMENTED):
value: not_implemented_project_setup
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"

# computed features
AddOnlineDocumentation:
type: bool
default: "{{ 'AddOnlineDocumentation_flag' in SelectDocumentationFeatures }}"
when: false

AddDevDoc:
type: bool
default: "{{ 'AddDevDoc_flag' in SelectDocumentationFeatures }}"
when: false
72 changes: 72 additions & 0 deletions copier/questions/features_publish_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
# Questions for publishing and releasing features

# the main menu
SelectPublishReleaseFeatures:
when: "{{ template_profile != 'minimum' }}"
type: yaml
default: |-
{% if template_profile == 'recommended' %}
[SelectCitation_flag, AddZenodo_flag]
{%- else -%}
[]
{%- endif %}
help: Select publish and release features
multiselect: true
choices:
Citation:
value: SelectCitation_flag
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"
Changelog:
value: AddChangeLog_flag
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"
Zenodo integration instructions:
value: AddZenodo_flag
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"
Package keywords(NOT_IMPLEMENTED):
value: not_implemented_keywords
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"


# Sub-menus
# split AddCitation --> enable_citation_file and enable_cffconvert
SelectCitation:
when: "{{ 'SelectCitation_flag' in SelectPublishReleaseFeatures }}"
type: yaml
default: |-
{% if template_profile == 'recommended' %}
[AddCitationFile_flag, AddCFFConvert_flag]
{%- else -%}
[]
{%- endif %}
help: Select citation features
multiselect: true
choices:
CITATION.cff file:
value: AddCitationFile_flag
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"
cffconvert GitHub Action (to validate CITATION.cff files):
value: AddCFFConvert_flag
# validator: "{% if something != 'AnotherThing' %}BlaBla{% endif %}"


# computed features
AddCitation:
type: bool
default: "{{ 'AddCitationFile_flag' in SelectCitation }}"
when: false

AddCFFConvert:
type: bool
default: "{{ 'AddCFFConvert_flag' in SelectCitation }}"
when: false

AddChangeLog:
type: bool
default: "{{ 'AddChangeLog_flag' in SelectPublishReleaseFeatures }}"
when: false

AddZenodo:
type: bool
default: "{{ 'AddZenodo_flag' in SelectPublishReleaseFeatures }}"
when: false
Loading

0 comments on commit ec6a235

Please sign in to comment.