diff --git a/copier.yaml b/copier.yaml index 7bcd79b..f666f02 100644 --- a/copier.yaml +++ b/copier.yaml @@ -9,7 +9,7 @@ _tasks: # Message to show after generating or regenerating the project successfully _message_after_copy: | - Your project "{{ package_name }}" has been created successfully! + Your project "{{ github_repo }}" has been created successfully! Next steps: @@ -40,43 +40,25 @@ _message_after_copy: | $ just list-todos # Questions: -package_github_repo: - type: str - help: "What is or will be the GitHub repository spec for the project?" - placeholder: "user/repo" - validator: | - {% if package_github_repo and not (package_github_repo | regex_search('^[\w.-]+\/[\w.-]+$')) %} - Must be in the format `user/repo` and contain only alphanumeric characters and `_`, `-`, or `.`. - {% endif %} +is_seedcase_project: + type: bool + help: "Is this package part of the Seedcase Project?" + default: true -github_user: +github_repo: type: str - default: "{{ package_github_repo.split('/')[0] if package_github_repo else '' }}" + default: "{{ _copier_conf.dst_path | realpath | basename }}" when: false -package_name: +github_user: type: str - help: "What is the name of the package?" - default: "{{ _copier_conf.dst_path | basename }}" - validator: | - {% if package_name and not (package_name | regex_search('^[\w.-]+$')) %} - Must contain only alphanumeric characters and `_`, `-`, or `.`. - {% endif %} - -package_name_snake_case: - type: str - default: "{{package_name | replace('-', '_') | replace('.', '_')}}" - when: false - -is_seedcase_project: - type: bool - help: "Is this package part of the Seedcase Project?" - default: "{{ github_user == 'seedcase-project' }}" + help: "What is the name of the GitHub user or organisation where the repository will be or is stored?" + default: "{{ 'seedcase-project' if is_seedcase_project else '' }}" homepage: type: str help: "What is the homepage of your project?" - default: "{{ 'https://%s.seedcase-project.org' % package_name if is_seedcase_project else '' }}" + default: "{{ 'https://%s.seedcase-project.org' % github_repo if is_seedcase_project else '' }}" author_given_name: type: str @@ -103,6 +85,16 @@ github_board_number: The board number must be an integer. {% endif %} +github_repo_snake_case: + type: str + default: "{{github_repo | replace('-', '_') | replace('.', '_')}}" + when: false + +github_repo_spec: + type: str + default: "{{ github_user }}/{{ github_repo }}" + when: false + copyright_year: type: str default: "{{ copyright_year | default('%Y' | strftime) }}" diff --git a/justfile b/justfile index 21924a5..67a05cb 100644 --- a/justfile +++ b/justfile @@ -60,8 +60,8 @@ test is_seedcase_project: --vcs-ref=$commit \ --defaults \ --trust \ - --data package_github_repo="first-last/repo" \ --data is_seedcase_project={{ is_seedcase_project }} \ + --data github_user="first-last" \ --data author_given_name="First" \ --data author_family_name="Last" \ --data author_email="first.last@example.com" \ @@ -94,8 +94,8 @@ test is_seedcase_project: --defaults \ --trust \ --overwrite \ - --data package_github_repo="first-last/repo" \ --data is_seedcase_project={{ is_seedcase_project }} \ + --data github_user="first-last" \ --data author_given_name="First" \ --data author_family_name="Last" \ --data author_email="first.last@example.com" \ diff --git a/template/CITATION.cff.jinja b/template/CITATION.cff.jinja index c03cb5b..0293166 100644 --- a/template/CITATION.cff.jinja +++ b/template/CITATION.cff.jinja @@ -20,5 +20,5 @@ keywords: - "" license: MIT message: "If you use this Python package, please cite it using these metadata." -repository-code: "https://github.com/{{ package_github_repo }}" +repository-code: "https://github.com/{{ github_repo_spec }}" url: "{{ homepage }}" diff --git a/template/LICENSE.md.jinja b/template/LICENSE.md.jinja index 8b1ba0a..898f71b 100644 --- a/template/LICENSE.md.jinja +++ b/template/LICENSE.md.jinja @@ -1,6 +1,6 @@ # MIT License -Copyright (c) {{ copyright_year }} {{ package_name }} authors +Copyright (c) {{ copyright_year }} {{ github_repo }} authors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/template/_quarto.yml.jinja b/template/_quarto.yml.jinja index 2dd1d7c..ce8fc8a 100644 --- a/template/_quarto.yml.jinja +++ b/template/_quarto.yml.jinja @@ -12,18 +12,18 @@ website: # TODO: Fill in the title of the website. title: "" site-url: "{{ homepage }}" - repo-url: "https://github.com/{{ package_github_repo }}" + repo-url: "https://github.com/{{ github_repo_spec }}" page-navigation: true navbar: pinned: true title: false {%- if is_seedcase_project %} - logo: "_extensions/seedcase-project/seedcase-theme/logos/navbar-logo-{{ package_name }}.svg" - logo-alt: "{{ package_name }} logo: Main page" + logo: "_extensions/seedcase-project/seedcase-theme/logos/navbar-logo-{{ github_repo }}.svg" + logo-alt: "{{ github_repo }} logo: Main page" {%- else %} # TODO: add logo logo: "" - logo-alt: "{{ package_name }} logo: Main page" + logo-alt: "{{ github_repo }} logo: Main page" {%- endif %} left: - text: "Guide" @@ -32,7 +32,7 @@ website: href: docs/design/index.qmd tools: - icon: github - href: "https://github.com/{{ package_github_repo }}" + href: "https://github.com/{{ github_repo_spec }}" aria-label: "GitHub icon: Source code" {%- if is_seedcase_project %} - icon: house @@ -55,7 +55,7 @@ quartodoc: sidebar: "docs/reference/_sidebar.yml" style: "pkgdown" dir: "docs/reference" - package: "{{ package_name_snake_case }}" + package: "{{ github_repo_snake_case }}" parser: google dynamic: true renderer: diff --git a/template/docs/site-counter.html.jinja b/template/docs/site-counter.html.jinja index b92291e..acb5f7b 100644 --- a/template/docs/site-counter.html.jinja +++ b/template/docs/site-counter.html.jinja @@ -1,3 +1,3 @@ - diff --git a/template/justfile.jinja b/template/justfile.jinja index 8e45742..d7c2aed 100644 --- a/template/justfile.jinja +++ b/template/justfile.jinja @@ -112,7 +112,7 @@ build-readme: # Generate a Quarto include file with the contributors build-contributors: - sh ./tools/get-contributors.sh {{ package_github_repo }} + sh ./tools/get-contributors.sh {{ github_repo_spec }} # Check for and apply updates from the template update-from-template: diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index a12e4c8..d56d951 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -1,5 +1,5 @@ [project] -name = "{{ package_name }}" +name = "{{ github_repo }}" version = "0.1.0" # TODO: Add a description of the package. description = "" @@ -19,11 +19,9 @@ dependencies = [] [project.urls] homepage = "{{ homepage }}" -{%- if package_github_repo %} -repository = "https://github.com/{{ package_github_repo }}" -changelog = "https://github.com/{{ package_github_repo }}/blob/main/CHANGELOG.md" -issues = "https://github.com/{{ package_github_repo }}/issues" -{% endif %} +repository = "https://github.com/{{ github_repo_spec }}" +changelog = "https://github.com/{{ github_repo_spec }}/blob/main/CHANGELOG.md" +issues = "https://github.com/{{ github_repo_spec }}/issues" [build-system] requires = ["hatchling"] diff --git a/template/src/{{package_name_snake_case}}/__init__.py b/template/src/{{github_repo_snake_case}}/__init__.py similarity index 100% rename from template/src/{{package_name_snake_case}}/__init__.py rename to template/src/{{github_repo_snake_case}}/__init__.py diff --git a/template/src/{{package_name_snake_case}}/py.typed b/template/src/{{github_repo_snake_case}}/py.typed similarity index 100% rename from template/src/{{package_name_snake_case}}/py.typed rename to template/src/{{github_repo_snake_case}}/py.typed