Skip to content
Open
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
4 changes: 4 additions & 0 deletions templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ repositories when a template is updated, or a new one created.
uses the `prompt_share()` function to remind repository developers if they are
modifying a templated file and should consider sharing the change.

### note:
Each repo has a `ci-template-check.yml` workflow to call this,
itself based on [this template](github/workflows/ci-template-check.yml)

`SPRING_CLEANING` flag in [`_templating_scripting.py`](_templating_scripting.py):
a mechanism for disabling the issues and comments if the dev team is
deliberately doing intense work on templates and templated files (the volume
Expand Down
182 changes: 106 additions & 76 deletions templates/_templating_include.json
Original file line number Diff line number Diff line change
@@ -1,85 +1,143 @@
{
"__comment__": "The first keys are files used in implementation, *not* templates...",

"_templating_include.json": {},
"_templating_exclude.json": {},
"_templating_scripting.py": {},
"README.md": {},
"MANIFEST.in": {
"cf-units": "MANIFEST.in",
"iris": "MANIFEST.in",
"iris-esmf-regrid": "MANIFEST.in",
"iris-grib": "MANIFEST.in",
"mo_pack": "MANIFEST.in",
"nc-time-axis": "MANIFEST.in",
"python-stratify": "MANIFEST.in",
"tephi": "MANIFEST.in"

"__comment__": [
Comment thread
pp-mo marked this conversation as resolved.
Resolved
"The remaining keys are **paths to templates** ...",
"All are files in this directory + its subdirectories.",
"PLEASE KEEP THESE IN ORDER.",
"They are in alphabetic order, except that ..",
" * all files are listed before subdirectories",
" * capitals come before lower-case.",
" * '.' comes _before_ all letters",
" * '_' comes _after_ all letters"
],

".lycheeignore": {
"iris": ".lycheeignore",
"iris-grib": ".lycheeignore"
},
".pre-commit-config.yaml": {
"cf-units": ".pre-commit-config.yaml",
"cfpint": ".pre-commit-config.yaml",
"iris": ".pre-commit-config.yaml",
"iris-esmf-regrid": ".pre-commit-config.yaml",
"iris-grib": ".pre-commit-config.yaml",
"mo_pack": ".pre-commit-config.yaml",
"nc-time-axis": ".pre-commit-config.yaml",
"python-stratify": ".pre-commit-config.yaml",
"tephi": ".pre-commit-config.yaml",
"workflows": ".pre-commit-config.yaml",
"test-iris-imagehash": ".pre-commit-config.yaml",
"mo_pack": ".pre-commit-config.yaml",
"cfpint": ".pre-commit-config.yaml"
"workflows": ".pre-commit-config.yaml"
},

"CITATION.cff": {
"cf-units": "CITATION.cff",
"iris": "CITATION.cff",
"iris-esmf-regrid": "CITATION.cff",
"python-stratify": "CITATION.cff",
"nc-time-axis": "CITATION.cff",
"tephi": "CITATION.cff",
"iris-grib": "CITATION.cff",
"cf-units": "CITATION.cff",
"mo_pack": "CITATION.cff"
"nc-time-axis": "CITATION.cff",
"mo_pack": "CITATION.cff",
"python-stratify": "CITATION.cff",
"tephi": "CITATION.cff"
},
"CODE_OF_CONDUCT.md": {
"iris": "CODE_OF_CONDUCT.md",
"iris-grib": "CODE_OF_CONDUCT.md",
"cf-units": "CODE_OF_CONDUCT.md",
"iris": "CODE_OF_CONDUCT.md",
"iris-esmf-regrid": "CODE_OF_CONDUCT.md",
"python-stratify": "CODE_OF_CONDUCT.md",
"tephi": "CODE_OF_CONDUCT.md",
"iris-grib": "CODE_OF_CONDUCT.md",
"mo_pack": "CODE_OF_CONDUCT.md",
"nc-time-axis": "CODE_OF_CONDUCT.md",
"mo_pack": "CODE_OF_CONDUCT.md"
"python-stratify": "CODE_OF_CONDUCT.md",
"tephi": "CODE_OF_CONDUCT.md"
},
"LICENSE": {
".github": "LICENSE",
"cf-units": "LICENSE",
"cfpint": "LICENSE",
"iris": "LICENSE",
"iris-grib": "LICENSE",
"tephi": "LICENSE",
"python-stratify": "LICENSE",
"iris-abf": "LICENSE",
"iris-esmf-regrid": "LICENSE",
"cf-units": "LICENSE",
"nc-time-axis": "LICENSE",
"test-iris-imagehash": "LICENSE",
"iris-grib": "LICENSE",
"libmo_unpack": "LICENSE",
".github": "LICENSE",
"workflows": "LICENSE",
"mo_pack": "LICENSE",
"marketing": "LICENSE",
"mo_pack": "LICENSE",
"nc-time-axis": "LICENSE",
"python-stratify": "LICENSE",
"tephi": "LICENSE",
"test-iris-imagehash": "LICENSE",
"test-tephi-imagehash": "LICENSE",
"iris-abf": "LICENSE",
"voted_issues": "LICENSE",
"twitter-scitools-iris": "LICENSE",
"cfpint": "LICENSE"
"voted_issues": "LICENSE",
"workflows": "LICENSE"
},
".lycheeignore": {
"iris": ".lycheeignore",
"iris-grib": ".lycheeignore"
"MANIFEST.in": {
"cf-units": "MANIFEST.in",
"iris": "MANIFEST.in",
"iris-esmf-regrid": "MANIFEST.in",
"iris-grib": "MANIFEST.in",
"mo_pack": "MANIFEST.in",
"nc-time-axis": "MANIFEST.in",
"python-stratify": "MANIFEST.in",
"tephi": "MANIFEST.in"
},
"pyproject.toml": {
"cf-units": "pyproject.toml",
"cfpint": "pyproject.toml",
"iris": "pyproject.toml",
"iris-abf": "pyproject.toml",
"iris-esmf-regrid": "pyproject.toml",
"iris-grib": "pyproject.toml",
"mo_pack": "pyproject.toml",
"nc-time-axis": "pyproject.toml",
"python-stratify": "pyproject.toml",
"tephi": "pyproject.toml",
"test-iris-imagehash": "pyproject.toml"
},
"run_doctests.py": {
"iris": "tools/run_doctests.py",
"ncdata": "tools/run_doctests.py",
"run-doctests": "tools/run_doctests.py"
},

"benchmarks/README.md": {
"iris": "benchmarks/README.md",
"iris-esmf-regrid": "benchmarks/README.md"
},
"benchmarks/asv.conf.json": {
"iris": "benchmarks/asv.conf.json",
"iris-esmf-regrid": "benchmarks/asv.conf.json"
},
"benchmarks/asv_delegated.py": {
"iris": "benchmarks/asv_delegated.py",
"iris-esmf-regrid": "benchmarks/asv_delegated.py"
},
"benchmarks/bm_runner.py": {
"iris": "benchmarks/bm_runner.py",
"iris-esmf-regrid": "benchmarks/bm_runner.py"
},
"benchmarks/_asv_delegated_abc.py": {
"iris": "benchmarks/_asv_delegated_abc.py",
"iris-esmf-regrid": "benchmarks/_asv_delegated_abc.py"
},

"benchmarks/benchmarks/__init__.py": {
"iris": "benchmarks/benchmarks/__init__.py",
"iris-esmf-regrid": "benchmarks/benchmarks/__init__.py"
},

"benchmarks/benchmarks/generate_data/__init__.py": {
"iris": "benchmarks/benchmarks/generate_data/__init__.py",
"iris-esmf-regrid": "benchmarks/benchmarks/generate_data/__init__.py"
},

"benchmarks/custom_bms/README.md": {
"iris": "benchmarks/custom_bms/README.md",
"iris-esmf-regrid": "benchmarks/custom_bms/README.md"
},
"benchmarks/custom_bms/install.py": {
"iris": "benchmarks/custom_bms/install.py",
"iris-esmf-regrid": "benchmarks/custom_bms/install.py"
Expand All @@ -88,30 +146,7 @@
"iris": "benchmarks/custom_bms/tracemallocbench.py",
"iris-esmf-regrid": "benchmarks/custom_bms/tracemallocbench.py"
},
"benchmarks/custom_bms/README.md": {
"iris": "benchmarks/custom_bms/README.md",
"iris-esmf-regrid": "benchmarks/custom_bms/README.md"
},
"benchmarks/asv.conf.json": {
"iris": "benchmarks/asv.conf.json",
"iris-esmf-regrid": "benchmarks/asv.conf.json"
},
"benchmarks/_asv_delegated_abc.py": {
"iris": "benchmarks/_asv_delegated_abc.py",
"iris-esmf-regrid": "benchmarks/_asv_delegated_abc.py"
},
"benchmarks/asv_delegated.py": {
"iris": "benchmarks/asv_delegated.py",
"iris-esmf-regrid": "benchmarks/asv_delegated.py"
},
"benchmarks/bm_runner.py": {
"iris": "benchmarks/bm_runner.py",
"iris-esmf-regrid": "benchmarks/bm_runner.py"
},
"benchmarks/README.md": {
"iris": "benchmarks/README.md",
"iris-esmf-regrid": "benchmarks/README.md"
},

"github/workflows/ci-benchmarks-report.yml": {
"iris": ".github/workflows/benchmarks_report.yml"
},
Expand All @@ -125,19 +160,14 @@
},
"github/workflows/ci-linkchecks.yml": {
"iris": ".github/workflows/ci-linkchecks.yml",
"iris-grib": ".github/workflows/ci-linkchecks.yml"
},
"pyproject.toml": {
"iris": "pyproject.toml",
"iris-esmf-regrid": "pyproject.toml",
"iris-grib": "pyproject.toml",
"nc-time-axis": "pyproject.toml",
"python-stratify": "pyproject.toml",
"tephi": "pyproject.toml",
"cf-units": "pyproject.toml",
"mo_pack": "pyproject.toml",
"test-iris-imagehash": "pyproject.toml",
"iris-abf": "pyproject.toml",
"cfpint": "pyproject.toml"
"iris-grib": ".github/workflows/ci-linkchecks.yml",
"ncdata": ".github/workflows/ci-linkchecks.yml"
},
"github/workflows/ci-template-check.yml": {
"iris": ".github/workflows/ci-template-check.yml",
"iris-esmf-regrid": ".github/workflows/ci-template-check.yml",
"iris-grib": ".github/workflows/ci-template-check.yml",
"ncdata": ".github/workflows/ci-template-check.yml",
"run-doctests": ".github/workflows/ci-template-check.yml"
}
}
2 changes: 2 additions & 0 deletions templates/_templating_scripting.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ def __init__(self):
self.templates: dict[Path, list[Config.TargetRepo]] = {}

for _template, _target_repos in config.items():
if _template == "__comment__":
continue
template = TEMPLATES_DIR / _template
assert template.is_file(), f"{template} does not exist."
target_repos = [
Expand Down
20 changes: 20 additions & 0 deletions templates/github/workflows/ci-template-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Checks if a PR makes any changes that ought to be shared via templating.
# See the called workflow in the scitools/workflows repo for more details.

name: ci-template-check

on:
pull_request_target: # zizmor: ignore[dangerous-triggers]
branches:
- main

permissions: {}

jobs:
prompt-share:
uses: scitools/workflows/.github/workflows/ci-template-check.yml@28aea7a3a1eb58e1bbf9b1d9c8cb2de07892b67e

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took me a minute to realise this was targeting an outside repo. More I'm more flagging this as something to be aware of than something to fix, but having repos named ".github" and "workflows" can get a bit confusing when they start referencing each other like this.

@pp-mo pp-mo Oct 30, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As stated, this content is identical to what's in Iris.
Actually it's like this in iris/stratify/nc-time-axis, and a slightly older version in iris-grib/iris-esmf-regrid/tephi/cf-units/mo-pack

The use of 'workflows' is kind-of deprecated + supposed to be replaced by templating.
In this case, it should be possible to replace the composite action with actions code in the template, and share that with whatever changes (like project name).
But it's not trivial so I'm avoiding doing that here + now.

secrets:
AUTH_APP_ID: ${{ secrets.AUTH_APP_ID }}
AUTH_APP_PRIVATE_KEY: ${{ secrets.AUTH_APP_PRIVATE_KEY }}
with:
pr_number: ${{ github.event.pull_request.number }}
Loading
Loading