From 609adbefa7deed43431424b3ba3cea7b025afafd Mon Sep 17 00:00:00 2001 From: martonvago Date: Mon, 7 Jul 2025 11:45:37 +0100 Subject: [PATCH 01/11] feat: :sparkles: try minimal copier setup --- copier.yml | 28 ++++++++++++++++++++++++++++ pyproject.toml | 6 +++--- 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 copier.yml diff --git a/copier.yml b/copier.yml new file mode 100644 index 0000000..01c41f0 --- /dev/null +++ b/copier.yml @@ -0,0 +1,28 @@ +_template: + repo: https://github.com/seedcase-project/template-data-package.git + checkout: feat/copier + +project_name: + type: str + help: "Name of your new project" + default: "template-data-package" + +version: + type: str + help: "Version of your new project" + default: "0.1.0" + +description: + type: str + help: "Short description of your project" + default: "A template for structuring all the pieces for a data package." + +author_name: + type: str + help: "Author's name" + default: "Luke W. Johnston" + +author_email: + type: str + help: "Author's email" + default: "lwjohnst@gmail.com" diff --git a/pyproject.toml b/pyproject.toml index 17102b9..efac8a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] -name = "template-data-package" -version = "0.1.0" -description = "A template for structuring all the pieces for a data package." +name = "{{ project_name }}" +version = "{{ version }}" +description = "{{ description }}" authors = [ {name = "Luke W. Johnston", email = "lwjohnst@gmail.com" }, {name = "Kristiane Beicher", email = "kris.beicher@clin.au.dk" }, From 0e6eb5b1cc0d01f92e5887a02f54764cb75108a4 Mon Sep 17 00:00:00 2001 From: martonvago Date: Tue, 8 Jul 2025 10:29:46 +0100 Subject: [PATCH 02/11] feat: :sparkles: add variables for pyproject.toml --- copier.yml | 34 ++++++++++++++++++++-------------- pyproject.toml | 33 --------------------------------- pyproject.toml.jinja | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 47 deletions(-) delete mode 100644 pyproject.toml create mode 100644 pyproject.toml.jinja diff --git a/copier.yml b/copier.yml index 01c41f0..dc21d96 100644 --- a/copier.yml +++ b/copier.yml @@ -1,28 +1,34 @@ -_template: - repo: https://github.com/seedcase-project/template-data-package.git - checkout: feat/copier +repo_url: + type: str + help: URL to your project's repository project_name: type: str - help: "Name of your new project" - default: "template-data-package" + help: Name of your new project + default: "{{ _copier_conf.dst_path | basename }}" version: type: str - help: "Version of your new project" - default: "0.1.0" + help: Version of your new project + default: 0.1.0 description: type: str - help: "Short description of your project" - default: "A template for structuring all the pieces for a data package." + help: Short description of your project author_name: type: str - help: "Author's name" - default: "Luke W. Johnston" - + help: Name of project author author_email: type: str - help: "Author's email" - default: "lwjohnst@gmail.com" + help: Email address of project author + +maintainer_name: + type: str + help: Name of project maintainer + default: "{{ author_name }}" +maintainer_email: + type: str + help: Email address of project maintainer + default: "{{ author_email if maintainer_name == author_name else '' }}" + diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index efac8a8..0000000 --- a/pyproject.toml +++ /dev/null @@ -1,33 +0,0 @@ -[project] -name = "{{ project_name }}" -version = "{{ version }}" -description = "{{ description }}" -authors = [ - {name = "Luke W. Johnston", email = "lwjohnst@gmail.com" }, - {name = "Kristiane Beicher", email = "kris.beicher@clin.au.dk" }, -] -maintainers = [ - {name = "Luke W. Johnston", email = "lwjohnst@gmail.com" }, - {name = "Kristiane Beicher", email = "kris.beicher@clin.au.dk" }, -] -readme = "README.md" -license = "MIT" -license-files = ["LICENSE.md"] -requires-python = ">=3.12" -dependencies = [ - "polars>=1.27.0", - "pyjanitor>=0.31.0", - "seedcase-sprout>=0.46.3", -] - -[project.urls] -issues = "https://github.com/seedcase-project/REPO/issues" -repository = "https://github.com/seedcase-project/REPO" - -[dependency-groups] -dev = [ - "commitizen>=4.5.1", - "pre-commit>=4.2.0", - "ruff>=0.11.4", - "typos>=1.32.0", -] diff --git a/pyproject.toml.jinja b/pyproject.toml.jinja new file mode 100644 index 0000000..2eca6c0 --- /dev/null +++ b/pyproject.toml.jinja @@ -0,0 +1,33 @@ +[project] +name = "{{ project_name }}" +version = "{{ version }}" +description = "{{ description }}" +authors = [ + {name = "{{ author_name }}", email = "{{ author_email }}" }, + # Add more authors here if needed +] +maintainers = [ + {name = "{{ maintainer_name }}", email = "{{ maintainer_email }}" }, + # Add more maintainers here if needed +] +readme = "README.md" +license = "MIT" +license-files = ["LICENSE.md"] +requires-python = ">=3.12" +dependencies = [ + "polars>=1.27.0", + "pyjanitor>=0.31.0", + "seedcase-sprout>=0.46.3", +] + +[project.urls] +issues = "{{ repo_url }}/issues" +repository = "{{ repo_url }}" + +[dependency-groups] +dev = [ + "commitizen>=4.5.1", + "pre-commit>=4.2.0", + "ruff>=0.11.4", + "typos>=1.32.0", +] From 94b2398b82eb245d528c1c049d7c04746b5dd72c Mon Sep 17 00:00:00 2001 From: martonvago Date: Wed, 16 Jul 2025 12:42:26 +0100 Subject: [PATCH 03/11] refactor: :recycle: merge changes with existing changes --- copier.yaml | 2 ++ copier.yml | 34 ---------------------------------- pyproject.toml.jinja | 33 --------------------------------- 3 files changed, 2 insertions(+), 67 deletions(-) delete mode 100644 copier.yml delete mode 100644 pyproject.toml.jinja diff --git a/copier.yaml b/copier.yaml index 59254cd..3d0d41e 100644 --- a/copier.yaml +++ b/copier.yaml @@ -22,3 +22,5 @@ author_email: package_abbrev: type: str help: "What is the abbreviated name of the package? This could be the name of your GitHub repository and should be a short, lowercase name without spaces or special characters. For example, 'template-data-package'." + default: "{{ _copier_conf.dst_path | basename }}" + diff --git a/copier.yml b/copier.yml deleted file mode 100644 index dc21d96..0000000 --- a/copier.yml +++ /dev/null @@ -1,34 +0,0 @@ -repo_url: - type: str - help: URL to your project's repository - -project_name: - type: str - help: Name of your new project - default: "{{ _copier_conf.dst_path | basename }}" - -version: - type: str - help: Version of your new project - default: 0.1.0 - -description: - type: str - help: Short description of your project - -author_name: - type: str - help: Name of project author -author_email: - type: str - help: Email address of project author - -maintainer_name: - type: str - help: Name of project maintainer - default: "{{ author_name }}" -maintainer_email: - type: str - help: Email address of project maintainer - default: "{{ author_email if maintainer_name == author_name else '' }}" - diff --git a/pyproject.toml.jinja b/pyproject.toml.jinja deleted file mode 100644 index 2eca6c0..0000000 --- a/pyproject.toml.jinja +++ /dev/null @@ -1,33 +0,0 @@ -[project] -name = "{{ project_name }}" -version = "{{ version }}" -description = "{{ description }}" -authors = [ - {name = "{{ author_name }}", email = "{{ author_email }}" }, - # Add more authors here if needed -] -maintainers = [ - {name = "{{ maintainer_name }}", email = "{{ maintainer_email }}" }, - # Add more maintainers here if needed -] -readme = "README.md" -license = "MIT" -license-files = ["LICENSE.md"] -requires-python = ">=3.12" -dependencies = [ - "polars>=1.27.0", - "pyjanitor>=0.31.0", - "seedcase-sprout>=0.46.3", -] - -[project.urls] -issues = "{{ repo_url }}/issues" -repository = "{{ repo_url }}" - -[dependency-groups] -dev = [ - "commitizen>=4.5.1", - "pre-commit>=4.2.0", - "ruff>=0.11.4", - "typos>=1.32.0", -] From 468a9668becd81942dc91673e0984116da0a8c37 Mon Sep 17 00:00:00 2001 From: martonvago Date: Thu, 17 Jul 2025 12:04:07 +0100 Subject: [PATCH 04/11] refactor: :recycle: tweak copier.yaml --- copier.yaml | 6 +++++- template/.github/CODEOWNERS.jinja | 2 +- template/pyproject.toml.jinja | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/copier.yaml b/copier.yaml index 3d0d41e..e3e4b35 100644 --- a/copier.yaml +++ b/copier.yaml @@ -3,7 +3,6 @@ _subdirectory: template # Questions: package_github_repo: type: str - default: "NA" help: "What is the GitHub repository spec for the package (in the form of 'user/repo'))?" placeholder: "user/repo" @@ -24,3 +23,8 @@ package_abbrev: help: "What is the abbreviated name of the package? This could be the name of your GitHub repository and should be a short, lowercase name without spaces or special characters. For example, 'template-data-package'." default: "{{ _copier_conf.dst_path | basename }}" +review_team: + type: str + help: What GitHub team is responsible for reviewing pull requests? + default: >- + {{ "@%s/developers" % package_github_repo.split('/')[0] if package_github_repo else "" }} diff --git a/template/.github/CODEOWNERS.jinja b/template/.github/CODEOWNERS.jinja index 22da67d..f7e542d 100644 --- a/template/.github/CODEOWNERS.jinja +++ b/template/.github/CODEOWNERS.jinja @@ -1,5 +1,5 @@ # All members on Developers team get added to review PRs -* @seedcase-project/developers +* {{ review_team }} # Ignore these so we don't get added to sync PRs /.github/ diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index 998d740..209caa1 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -21,7 +21,7 @@ dependencies = [ "seedcase-sprout>=0.46.3", ] -{% if package_github_repo != "NA" %} +{% if package_github_repo %} [project.urls] issues = "https://github.com/{{ package_github_repo }}/issues" repository = "https://github.com/{{ package_github_repo }}" From 09813774b335ab3f2981f94d948ede28e8acec00 Mon Sep 17 00:00:00 2001 From: martonvago Date: Thu, 17 Jul 2025 15:41:33 +0100 Subject: [PATCH 05/11] fix: :bug: comment out lines referencing properties var --- template/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/template/main.py b/template/main.py index 1ffd986..b04b517 100644 --- a/template/main.py +++ b/template/main.py @@ -1,7 +1,7 @@ # import polars as pl import seedcase_sprout as sp -from scripts.properties import properties +# from scripts.properties import properties # from scripts.resource_properties import resource_properties @@ -26,14 +26,14 @@ def main(): # ) ## Save the properties to `datapackage.json`. - sp.write_properties(properties=properties) + # sp.write_properties(properties=properties) ## README ## Create the README text for the data package. - readme_text = sp.as_readme_text(properties) + # readme_text = sp.as_readme_text(properties) ## Write the README text to a `README.md` file. - sp.write_file(readme_text, package_path.readme()) + # sp.write_file(readme_text, package_path.readme()) ## BATCH DATA From 54d0512664b2ccff0702456ab61a14ae2f645dd6 Mon Sep 17 00:00:00 2001 From: martonvago Date: Thu, 17 Jul 2025 15:47:11 +0100 Subject: [PATCH 06/11] fix: :bug: fix copier var name --- template/CITATION.cff.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/CITATION.cff.jinja b/template/CITATION.cff.jinja index 6fb460e..c53c6eb 100644 --- a/template/CITATION.cff.jinja +++ b/template/CITATION.cff.jinja @@ -21,6 +21,6 @@ keywords: # TODO: Add a data license for the data package. license: "" message: "If you use this data package, please cite it using these metadata." -repository-code: "https://github.com/{{ package_github }}" +repository-code: "https://github.com/{{ package_github_repo }}" # TODO: Add a URL for any website for the data package. # url: "" From 3bcae808a1b0bd25f57783d179bd8b85fdc19872 Mon Sep 17 00:00:00 2001 From: martonvago Date: Thu, 17 Jul 2025 16:17:29 +0100 Subject: [PATCH 07/11] fix: :bug: add missing quotes --- template/pyproject.toml.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index 209caa1..d2a25f5 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -1,5 +1,5 @@ [project] -name = {{ package_abbrev }} +name = "{{ package_abbrev }}" version = "0.1.0" # TODO: Add a description of the package. description = "" From 3b65066dae3eaf21eecbcfa5041352e2d9837042 Mon Sep 17 00:00:00 2001 From: martonvago Date: Thu, 17 Jul 2025 16:36:53 +0100 Subject: [PATCH 08/11] refactor: :recycle: add review_team to justfile test --- justfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/justfile b/justfile index 1b9950f..dcbccaf 100644 --- a/justfile +++ b/justfile @@ -42,7 +42,8 @@ test: --data package_github_repo="first-last/${test_name}" \ --data author_given_name="First" \ --data author_family_name="Last" \ - --data author_email="first.last@example.com" + --data author_email="first.last@example.com" \ + --data review_team="@first-last/developers" # TODO: Other checks/tests? cleanup: From 6daa17b76604b6ae33f6338a356625dde6e89537 Mon Sep 17 00:00:00 2001 From: martonvago Date: Thu, 17 Jul 2025 17:03:51 +0100 Subject: [PATCH 09/11] feat: :sparkles: extract board_number as copier var --- copier.yaml | 4 ++++ justfile | 3 ++- template/.github/workflows/add-to-project.yml.jinja | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/copier.yaml b/copier.yaml index e3e4b35..6f8d47e 100644 --- a/copier.yaml +++ b/copier.yaml @@ -28,3 +28,7 @@ review_team: help: What GitHub team is responsible for reviewing pull requests? default: >- {{ "@%s/developers" % package_github_repo.split('/')[0] if package_github_repo else "" }} + +board_number: + type: int + help: "What is the number of the GitHub project board to add issues and PRs to?" diff --git a/justfile b/justfile index dcbccaf..9095a7a 100644 --- a/justfile +++ b/justfile @@ -43,7 +43,8 @@ test: --data author_given_name="First" \ --data author_family_name="Last" \ --data author_email="first.last@example.com" \ - --data review_team="@first-last/developers" + --data review_team="@first-last/developers" \ + --data board_number=22 # TODO: Other checks/tests? cleanup: diff --git a/template/.github/workflows/add-to-project.yml.jinja b/template/.github/workflows/add-to-project.yml.jinja index c2c5d94..8f5402d 100644 --- a/template/.github/workflows/add-to-project.yml.jinja +++ b/template/.github/workflows/add-to-project.yml.jinja @@ -18,7 +18,7 @@ jobs: add-to-project: uses: seedcase-project/.github/.github/workflows/reusable-add-to-project.yml@main with: - board-number: 18 + board-number: {{ board_number }} app-id: {{ '${{ vars.ADD_TO_BOARD_APP_ID }}' }} secrets: add-to-board-token: {{ '${{ secrets.ADD_TO_BOARD }}' }} From 774d1f807b889ca5ca43e0c268974b812155bd05 Mon Sep 17 00:00:00 2001 From: martonvago Date: Wed, 23 Jul 2025 10:25:22 +0100 Subject: [PATCH 10/11] refactor: :recycle: rename github_board_number --- copier.yaml | 9 +++++++-- justfile | 2 +- template/.github/workflows/add-to-project.yml.jinja | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/copier.yaml b/copier.yaml index 6f8d47e..1ad719a 100644 --- a/copier.yaml +++ b/copier.yaml @@ -29,6 +29,11 @@ review_team: default: >- {{ "@%s/developers" % package_github_repo.split('/')[0] if package_github_repo else "" }} -board_number: - type: int +github_board_number: + type: yaml help: "What is the number of the GitHub project board to add issues and PRs to?" + default: null + validator: | + {% if github_board_number is not none and github_board_number is not number %} + The board number must be an integer. + {% endif %} diff --git a/justfile b/justfile index 9095a7a..1c7fdc7 100644 --- a/justfile +++ b/justfile @@ -44,7 +44,7 @@ test: --data author_family_name="Last" \ --data author_email="first.last@example.com" \ --data review_team="@first-last/developers" \ - --data board_number=22 + --data github_board_number=22 # TODO: Other checks/tests? cleanup: diff --git a/template/.github/workflows/add-to-project.yml.jinja b/template/.github/workflows/add-to-project.yml.jinja index 8f5402d..6ecc2ac 100644 --- a/template/.github/workflows/add-to-project.yml.jinja +++ b/template/.github/workflows/add-to-project.yml.jinja @@ -18,7 +18,7 @@ jobs: add-to-project: uses: seedcase-project/.github/.github/workflows/reusable-add-to-project.yml@main with: - board-number: {{ board_number }} + board-number: {{ github_board_number }} app-id: {{ '${{ vars.ADD_TO_BOARD_APP_ID }}' }} secrets: add-to-board-token: {{ '${{ secrets.ADD_TO_BOARD }}' }} From 84224503444f40bd21b61928d238536e54f77d8c Mon Sep 17 00:00:00 2001 From: martonvago Date: Wed, 23 Jul 2025 10:32:12 +0100 Subject: [PATCH 11/11] refactor: :recycle: validate github_board_number --- copier.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/copier.yaml b/copier.yaml index 1ad719a..4689448 100644 --- a/copier.yaml +++ b/copier.yaml @@ -30,10 +30,9 @@ review_team: {{ "@%s/developers" % package_github_repo.split('/')[0] if package_github_repo else "" }} github_board_number: - type: yaml + type: str help: "What is the number of the GitHub project board to add issues and PRs to?" - default: null validator: | - {% if github_board_number is not none and github_board_number is not number %} + {% if github_board_number and not github_board_number.isdigit() %} The board number must be an integer. {% endif %}