Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 21 additions & 29 deletions copier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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
Expand All @@ -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) }}"
Expand Down
4 changes: 2 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down Expand Up @@ -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" \
Expand Down
2 changes: 1 addition & 1 deletion template/CITATION.cff.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
2 changes: 1 addition & 1 deletion template/LICENSE.md.jinja
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 6 additions & 6 deletions template/_quarto.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion template/docs/site-counter.html.jinja
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!-- TODO: Set up GoatCounter -->
<script data-goatcounter="https://{{ github_user }}-{{ package_name }}.goatcounter.com/count" async
<script data-goatcounter="https://{{ github_user }}-{{ github_repo }}.goatcounter.com/count" async
src="//gc.zgo.at/count.js"></script>
2 changes: 1 addition & 1 deletion template/justfile.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 4 additions & 6 deletions template/pyproject.toml.jinja
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "{{ package_name }}"
name = "{{ github_repo }}"
version = "0.1.0"
# TODO: Add a description of the package.
description = ""
Expand All @@ -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"]
Expand Down
Loading