From bca5ffbde01b12e16f18e160d48c6a01155ab63a Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Mon, 17 Feb 2025 14:45:45 +0100 Subject: [PATCH 01/12] docs: :memo: add an emoji to commit message of commitizen --- .cz.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cz.toml b/.cz.toml index 0394a9a..5de657e 100644 --- a/.cz.toml +++ b/.cz.toml @@ -1,5 +1,5 @@ [tool.commitizen] -bump_message = "build(version): update version from $current_version to $new_version [skip ci]" +bump_message = "build(version): :bookmark: update version from $current_version to $new_version [skip ci]" update_changelog_on_bump = true version_provider = "poetry" version_files = [ From a7abb1735968b304f209d09f57dee38f1d2cbed3 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Mon, 17 Feb 2025 14:47:13 +0100 Subject: [PATCH 02/12] build: :pushpin: use latest commitizen version --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0385ab2..2c9b346 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,6 +12,6 @@ repos: - id: end-of-file-fixer - repo: https://github.com/commitizen-tools/commitizen - rev: v4.1.0 + rev: v4.2.1 hooks: - id: commitizen From 704e6fcbb581bb2474ab4b6ea8c3f600533adf96 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Mon, 17 Feb 2025 14:47:31 +0100 Subject: [PATCH 03/12] docs: :memo: use a generic package name, not Sprout, for index --- index.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.qmd b/index.qmd index f667600..a1ec6f8 100644 --- a/index.qmd +++ b/index.qmd @@ -1,5 +1,5 @@ --- -title: "Welcome to Seedcase Sprout!" +title: "Welcome to {{PACKAGE-NAME}}!" --- {{< include /docs/includes/_wip.qmd >}} From f1f900922f6eb4cc70945e9ea13470ae92f05687 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Mon, 17 Feb 2025 14:48:36 +0100 Subject: [PATCH 04/12] build: :fire: remove plantuml recipes and extensions --- .vscode/extensions.json | 1 - justfile | 8 -------- 2 files changed, 9 deletions(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 17d7aa4..10535a9 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -3,7 +3,6 @@ // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp // List of extensions which should be recommended for users of this workspace. "recommendations": [ - "jebbs.plantuml", "donjayamanne.githistory", "felipecaputo.git-project-manager", "GitHub.vscode-pull-request-github", diff --git a/justfile b/justfile index 98391bb..9f58894 100644 --- a/justfile +++ b/justfile @@ -8,14 +8,6 @@ run-all: install-deps format-python check-python test-python check-commits build install-deps: poetry install -# Generate SVG images from all PlantUML files -generate-puml-all: - docker run --rm -v $(pwd):/puml -w /puml ghcr.io/plantuml/plantuml:latest -tsvg "**/*.puml" - -# Generate SVG image from specific PlantUML file -generate-puml name: - docker run --rm -v $(pwd):/puml -w /puml ghcr.io/plantuml/plantuml:latest -tsvg "**/{{name}}.puml" - # Run the Python tests test-python: poetry run pytest From b71251ba4f301573a0aec3fd0fc07d68a8c31711 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Mon, 17 Feb 2025 14:49:30 +0100 Subject: [PATCH 05/12] build: :technologist: check if there are commits on the branch before checking commits --- justfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/justfile b/justfile index 9f58894..e297400 100644 --- a/justfile +++ b/justfile @@ -31,7 +31,11 @@ build-website: # Run checks on commits with non-main branches check-commits: #!/bin/zsh - if [[ $(git rev-parse --abbrev-ref HEAD) != "main" ]] + branch_name=$(git rev-parse --abbrev-ref HEAD) + number_of_commits=$(git rev-list --count HEAD ^$branch_name) + if [[ ${branch_name} != "main" && ${number_of_commits} -gt 0 ]] then poetry run cz check --rev-range main..HEAD + else + echo "Not on main or haven't committed yet." fi From 3c104c3bb0896851401e1c7b7afa182a93692c98 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Mon, 17 Feb 2025 14:49:45 +0100 Subject: [PATCH 06/12] docs: :page_facing_up: update license year to 2025 --- LICENSE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.md b/LICENSE.md index 740f93f..aeed825 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ # MIT License -Copyright (c) 2023-2024 Aarhus University +Copyright (c) 2023-2025 Aarhus University Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From dbc0d1f20045aea46542c469e3397bd58daa7bd3 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Mon, 17 Feb 2025 14:50:29 +0100 Subject: [PATCH 07/12] build: :wrench: set template as a `src/` layout --- pyproject.toml | 11 +++++++++-- src/PACKAGE-NAME/__init__.py | 0 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 src/PACKAGE-NAME/__init__.py diff --git a/pyproject.toml b/pyproject.toml index 363b80f..db412f7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [tool.poetry] -name = "NAME" +name = "template-python-package" version = "0.0.1" description = "" authors = [ @@ -18,7 +18,6 @@ readme = "README.md" homepage = "https://NAME.seedcase-project.org" repository = "https://github.com/seedcase-project/REPO" license = "MIT" -packages = [{include = "NAME"}] [tool.poetry.urls] "Bug Tracker" = "https://github.com/seedcase-project/REPO/issues" @@ -35,3 +34,11 @@ ruff = "^0.6.2" [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" + +[tool.pytest.ini_options] +addopts = [ + # A short traceback mode to make it easier to view + "--tb=short", + # Use the package in `src/` + "--import-mode=importlib", +] diff --git a/src/PACKAGE-NAME/__init__.py b/src/PACKAGE-NAME/__init__.py new file mode 100644 index 0000000..e69de29 From 6f7fe31b1916768af67af3d79e90c35e19de26c0 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Mon, 17 Feb 2025 14:50:57 +0100 Subject: [PATCH 08/12] chore: :pushpin: set Python to 3.12 for Ruff --- ruff.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ruff.toml b/ruff.toml index 90a4c9e..9171953 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,5 +1,5 @@ -# Support Python 3.10+ -target-version = "py310" +# Support Python 3.12+ +target-version = "py312" # In addition to the default formatters/linters, add these as well. [lint] From e341cc2586a7818df8cdafa3eabcc62f99a03c3c Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Mon, 17 Feb 2025 14:52:46 +0100 Subject: [PATCH 09/12] chore: :hammer: `cSpell` option was renamed, this matches their new option --- .vscode/settings.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index f006005..491bd60 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -32,9 +32,9 @@ "python.defaultInterpreterPath": "${workspaceFolder}/.venv", "python.languageServer": "Pylance", "files.insertFinalNewline": true, - "cSpell.enableFiletypes": [ - "quarto" - ], + "cSpell.enabledFileTypes": { + "quarto": true + }, "cSpell.language": "en,en-GB", "python.testing.pytestEnabled": true, "python.testing.pytestPath": "${workspaceFolder}/.venv/bin/pytest", From 40c33ca1998c0f7c5146fa0cdc0d1e6bb7d57009 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Mon, 17 Feb 2025 14:54:08 +0100 Subject: [PATCH 10/12] docs: :memo: update README to mostly the latest changes --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d07ae2e..1764565 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Template for Seedcase Python projects +# Template for Seedcase Python packages -This repository contains a template for setting up new Python (with Django) projects in Seedcase. The first step is to create a new repository using this template. This can easily be done by clicking the "Use this template" button on the repository page or by using the GitHub CLI: +This repository contains a template for setting up new Python package projects in Seedcase. The first step is to create a new repository using this template. This can easily be done by clicking the "Use this template" button on the repository page or by using the GitHub CLI: ``` bash # NAME is the name to give the new repository @@ -16,9 +16,7 @@ cd new-project poetry init ``` -Search for `NAME` and `REPO` and replace them with the name of your project and the repository name. Then look for any `TODO` items. - -You will need to set up Fly manually for now. +Search for `NAME`, `PACKAGE-NAME`, and `REPO` and replace them with the name of your project and the repository name. Then look for any `TODO` items. ## Setting things up From 302ef3102dfb816a0f25de908a3dd29807384918 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Tue, 18 Feb 2025 09:50:43 +0100 Subject: [PATCH 11/12] docs: :pencil2: small correction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Signe Kirk Brødbæk <40836345+signekb@users.noreply.github.com> --- index.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.qmd b/index.qmd index a1ec6f8..3d0f710 100644 --- a/index.qmd +++ b/index.qmd @@ -1,5 +1,5 @@ --- -title: "Welcome to {{PACKAGE-NAME}}!" +title: "Welcome to NAME!" --- {{< include /docs/includes/_wip.qmd >}} From 9627bc71b08b749cbecf67e1e4ca8f31855e77b0 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Tue, 18 Feb 2025 09:58:42 +0100 Subject: [PATCH 12/12] docs: :pencil2: to be consistent --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1764565..448872f 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ cd new-project poetry init ``` -Search for `NAME`, `PACKAGE-NAME`, and `REPO` and replace them with the name of your project and the repository name. Then look for any `TODO` items. +Search for `NAME` and `REPO` and replace them with the name of your project and the repository name. Then look for any `TODO` items. ## Setting things up