From 1bef499560079027d4692128bc5adff90b351973 Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Mon, 4 May 2026 12:01:44 +0200 Subject: [PATCH 01/38] fix --- scripts/actions.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/actions.sh b/scripts/actions.sh index 29fd22a72..5fa31206a 100755 --- a/scripts/actions.sh +++ b/scripts/actions.sh @@ -128,7 +128,11 @@ case "$1" in # 1. Get the path of the private config of the cluster # 2. Read the yaml and extract the path of the shared conf # This uses the yq command. It is a python package so uvx (bundled with uv) will donwload and create the right venv - export working_dir=$(cat $("$PRIVATE_REPO_PATH"/hpc/platform-env.py hpc-config) | uvx yq .path_shared_working_dir) + # The 'yq' command is used in a separate virtual environment, because the cache + # around that tool can get corrupted. + # See https://github.com/ecmwf/WeatherGenerator/issues/2298 + export working_dir=$(cat "$("$PRIVATE_REPO_PATH"/hpc/platform-env.py hpc-config)" | + UV_CACHE_DIR="$(mktemp -d)" VIRTUAL_ENV="" uvx yq .path_shared_working_dir) # Remove quotes export working_dir=$(echo "$working_dir" | sed 's/[\"\x27]//g') # If the working directory does not exist, exit with an error From 848b7ec66e17f92ad78035e89b3212644473c729 Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Mon, 4 May 2026 12:07:13 +0200 Subject: [PATCH 02/38] activate --- ci/cscs.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/cscs.yaml b/ci/cscs.yaml index eb2d444b4..b9b20a58c 100644 --- a/ci/cscs.yaml +++ b/ci/cscs.yaml @@ -25,6 +25,8 @@ test_job: ./scripts/actions.sh sync echo "Create links and run tests" ./scripts/actions.sh create-links + echo "Activate the environment" + source .venv/bin/activate echo "Run tests" ./scripts/actions.sh integration-test${STAGE_TYPE:-} variables: From 1bcb080295b50f2b1079462dda7a4d6748b82d53 Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Mon, 4 May 2026 12:10:36 +0200 Subject: [PATCH 03/38] activate? --- ci/cscs.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/cscs.yaml b/ci/cscs.yaml index b9b20a58c..94f00f915 100644 --- a/ci/cscs.yaml +++ b/ci/cscs.yaml @@ -27,6 +27,8 @@ test_job: ./scripts/actions.sh create-links echo "Activate the environment" source .venv/bin/activate + which python3 + which pytest echo "Run tests" ./scripts/actions.sh integration-test${STAGE_TYPE:-} variables: From fde166bdff46761bb9293f6f8181c66ec23f6bc0 Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Mon, 4 May 2026 13:56:15 +0200 Subject: [PATCH 04/38] debug --- ci/cscs.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/cscs.yaml b/ci/cscs.yaml index 94f00f915..338d60aae 100644 --- a/ci/cscs.yaml +++ b/ci/cscs.yaml @@ -22,6 +22,8 @@ test_job: https://oauth2:${PRIVATE_REPO_TOKEN}@gitlab.jsc.fz-juelich.de/esde/WeatherGenerator-private.git echo "Sync" + # DEBUG + ls .* ./scripts/actions.sh sync echo "Create links and run tests" ./scripts/actions.sh create-links From 6d21e67ea342b7cb41581a59af0d52d21072498c Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Mon, 4 May 2026 14:05:03 +0200 Subject: [PATCH 05/38] link mode --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 00103cb8c..0259332d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -173,6 +173,7 @@ exclude-newer = "2026-02-27T00:00:00Z" # over revisions, causing reformats to happen without reason. # Also, relatively recent versions are required to support workspaces. required-version = ">=0.7.0" +link-mode = "copy" # The supported environments # TODO: add macos and windows (CPU only, for running tests) From bbe7288e9d7197820ad8def2b40c682fc6344b12 Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Mon, 4 May 2026 14:12:18 +0200 Subject: [PATCH 06/38] copy --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0259332d4..031c19ec0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -161,7 +161,7 @@ enable = ["W0201", "W0141"] [tool.uv] # Most work is done a distributed filesystem, where hardlink is not always possible. # Also, trying to resolve some permissions issue, see 44. -link-mode = "symlink" +link-mode = "copy" # This guarantees that the build is deterministic and will not be impacted # by future releases of dependencies or sub-dependencies. # See https://docs.astral.sh/uv/reference/settings/#exclude-newer @@ -173,7 +173,6 @@ exclude-newer = "2026-02-27T00:00:00Z" # over revisions, causing reformats to happen without reason. # Also, relatively recent versions are required to support workspaces. required-version = ">=0.7.0" -link-mode = "copy" # The supported environments # TODO: add macos and windows (CPU only, for running tests) From 8a97d4fde66c801f3ca372e717c39e2c84d27aa2 Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Mon, 4 May 2026 15:59:46 +0200 Subject: [PATCH 07/38] copy --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 031c19ec0..89e0f2d31 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,8 @@ dependencies = [ "anemoi-datasets", "weathergen-common", "weathergen-evaluate", - "weathergen-readers-extra" + "weathergen-readers-extra", + "pytest>=9.0.2", ] From c1d886f65d375ca2b78f789c9fd4dd01a079901b Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Mon, 4 May 2026 16:11:24 +0200 Subject: [PATCH 08/38] disable cache --- ci/cscs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/cscs.yaml b/ci/cscs.yaml index 338d60aae..d39d48dab 100644 --- a/ci/cscs.yaml +++ b/ci/cscs.yaml @@ -37,4 +37,4 @@ test_job: SLURM_JOB_NUM_NODES: 1 WITH_UENV_VIEW: 'modules' SLURM_TIMELIMIT: '00:20:00' - UV_CACHE_DIR: /iopsstor/scratch/cscs/thunter/uv_cache_shared + #UV_CACHE_DIR: /iopsstor/scratch/cscs/thunter/uv_cache_shared From 16d183057befcf6350fc17db9e251c4925b5b324 Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Mon, 4 May 2026 16:29:46 +0200 Subject: [PATCH 09/38] uv cache dir --- ci/cscs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/cscs.yaml b/ci/cscs.yaml index d39d48dab..338d60aae 100644 --- a/ci/cscs.yaml +++ b/ci/cscs.yaml @@ -37,4 +37,4 @@ test_job: SLURM_JOB_NUM_NODES: 1 WITH_UENV_VIEW: 'modules' SLURM_TIMELIMIT: '00:20:00' - #UV_CACHE_DIR: /iopsstor/scratch/cscs/thunter/uv_cache_shared + UV_CACHE_DIR: /iopsstor/scratch/cscs/thunter/uv_cache_shared From 7d2c3d1ff37c872c88486244cb5f2e14baf6c56f Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Mon, 4 May 2026 17:14:19 +0200 Subject: [PATCH 10/38] trying other options --- pyproject.toml | 3 ++- scripts/actions.sh | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 89e0f2d31..50fd7eb16 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -162,6 +162,7 @@ enable = ["W0201", "W0141"] [tool.uv] # Most work is done a distributed filesystem, where hardlink is not always possible. # Also, trying to resolve some permissions issue, see 44. +# Another option is 'symlink': this can cause broken symlinks to appear but it is faster (no copy) link-mode = "copy" # This guarantees that the build is deterministic and will not be impacted # by future releases of dependencies or sub-dependencies. @@ -173,7 +174,7 @@ exclude-newer = "2026-02-27T00:00:00Z" # It is tightly controlled because the format of uv.lock has changed # over revisions, causing reformats to happen without reason. # Also, relatively recent versions are required to support workspaces. -required-version = ">=0.7.0" +required-version = ">=0.11.0" # The supported environments # TODO: add macos and windows (CPU only, for running tests) diff --git a/scripts/actions.sh b/scripts/actions.sh index 5fa31206a..2b1b8ca71 100755 --- a/scripts/actions.sh +++ b/scripts/actions.sh @@ -8,13 +8,15 @@ case "$1" in sync) ( cd "$SCRIPT_DIR" || exit 1 + # --refresh --reinstall : LUSTRE may clean up some pieces of the cache. + # This ensures basic integrity. # If we are running on a mac, use the cpu extra if [[ "$(uname)" == "Darwin" ]]; then - uv sync --all-packages --extra cpu + uv sync --all-packages --extra cpu --refresh --reinstall exit 0 fi # Otherwise, use the gpu extra - uv sync --all-packages --extra gpu + uv sync --all-packages --extra gpu --refresh --reinstall ) ;; lint) From b35acf37be8fe85531090f4a7cce6839e5ef78ec Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Mon, 4 May 2026 17:16:58 +0200 Subject: [PATCH 11/38] uv --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d462d751e..1946736e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: uses: astral-sh/setup-uv@v5 with: # Install a specific version of uv. - version: "0.7.13" + version: "0.11.8" - name: Run ruff (black) # Do not attempt to install the default dependencies, this is much faster. From 3247a3e84016a7511d770adedd2ca3d698dcc1ed Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Mon, 4 May 2026 17:21:53 +0200 Subject: [PATCH 12/38] change --- .github/workflows/ci.yml | 4 ++-- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1946736e2..905350dd7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: uses: astral-sh/setup-uv@v5 with: # Install a specific version of uv. - version: "0.7.13" + version: "0.11.8" - name: Check PR is linked to an issue # Send the PR number to the script, which will check if it is linked to an issue. @@ -62,7 +62,7 @@ jobs: uses: astral-sh/setup-uv@v5 with: # Install a specific version of uv. - version: "0.7.13" + version: "0.11.8" - name: Run all unit tests # Send the PR number to the script, which will check if it is linked to an issue. diff --git a/pyproject.toml b/pyproject.toml index 50fd7eb16..b18d2a626 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -163,7 +163,7 @@ enable = ["W0201", "W0141"] # Most work is done a distributed filesystem, where hardlink is not always possible. # Also, trying to resolve some permissions issue, see 44. # Another option is 'symlink': this can cause broken symlinks to appear but it is faster (no copy) -link-mode = "copy" +link-mode = "symlink" # This guarantees that the build is deterministic and will not be impacted # by future releases of dependencies or sub-dependencies. # See https://docs.astral.sh/uv/reference/settings/#exclude-newer From a2f68019f2e39ad70e676951c3faa2e6aa2b3c1a Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Mon, 4 May 2026 17:29:44 +0200 Subject: [PATCH 13/38] fixues --- ci/cscs.yaml | 2 +- scripts/actions.sh | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ci/cscs.yaml b/ci/cscs.yaml index 338d60aae..3932a965b 100644 --- a/ci/cscs.yaml +++ b/ci/cscs.yaml @@ -24,7 +24,7 @@ test_job: echo "Sync" # DEBUG ls .* - ./scripts/actions.sh sync + ./scripts/actions.sh sync-safe echo "Create links and run tests" ./scripts/actions.sh create-links echo "Activate the environment" diff --git a/scripts/actions.sh b/scripts/actions.sh index 2b1b8ca71..b8038d220 100755 --- a/scripts/actions.sh +++ b/scripts/actions.sh @@ -6,10 +6,23 @@ PRIVATE_REPO_PATH="${WEATHERGEN_PRIVATE_REPO_PATH:-$SCRIPT_DIR/../WeatherGenerat case "$1" in sync) + ( + cd "$SCRIPT_DIR" || exit 1 + # Creates a virtual environment without checking the integrity of the cache. + # If we are running on a mac, use the cpu extra + if [[ "$(uname)" == "Darwin" ]]; then + uv sync --all-packages --extra cpu + exit 0 + fi + # Otherwise, use the gpu extra + uv sync --all-packages --extra gpu + ) + ;; + sync-safe) ( cd "$SCRIPT_DIR" || exit 1 # --refresh --reinstall : LUSTRE may clean up some pieces of the cache. - # This ensures basic integrity. + # This ensures basic integrity but it is too slow (adds 60 seconds to the sync) to do it on every sync. So we only do it on mac, where the cache is more likely to get corrupted. # If we are running on a mac, use the cpu extra if [[ "$(uname)" == "Darwin" ]]; then uv sync --all-packages --extra cpu --refresh --reinstall From bbf564132f2c6f8b3490b2e30c51bba46e418aa1 Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 10:00:42 +0200 Subject: [PATCH 14/38] more debug info --- ci/cscs.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/cscs.yaml b/ci/cscs.yaml index 3932a965b..4fc02341b 100644 --- a/ci/cscs.yaml +++ b/ci/cscs.yaml @@ -15,6 +15,7 @@ test_job: echo "PRIVATE_REPO_BRANCH=$PRIVATE_REPO_BRANCH" export WEATHERGEN_PRIVATE_REPO_PATH="$PWD/WeatherGenerator-private" echo "WEATHERGEN_PRIVATE_REPO_PATH=$WEATHERGEN_PRIVATE_REPO_PATH" + echo "uv version: $(uv --version) path: $(which uv)" git clone \ --depth 1 --single-branch \ From a4ff6d3a033bc3dff7a263fc07b4c96ca844be47 Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 10:01:20 +0200 Subject: [PATCH 15/38] more debug info --- ci/cscs.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/cscs.yaml b/ci/cscs.yaml index 4fc02341b..475957534 100644 --- a/ci/cscs.yaml +++ b/ci/cscs.yaml @@ -30,8 +30,8 @@ test_job: ./scripts/actions.sh create-links echo "Activate the environment" source .venv/bin/activate - which python3 - which pytest + echo "Python version: $(python3 --version) path: $(which python3)" + echo "Pytest version: $(pytest --version) path: $(which pytest)" echo "Run tests" ./scripts/actions.sh integration-test${STAGE_TYPE:-} variables: From 2b49263da356f55d0dd04d03ceb752d80fe7a3e7 Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 10:09:02 +0200 Subject: [PATCH 16/38] link mode copy --- scripts/actions.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/actions.sh b/scripts/actions.sh index b8038d220..790eff696 100755 --- a/scripts/actions.sh +++ b/scripts/actions.sh @@ -20,16 +20,24 @@ case "$1" in ;; sync-safe) ( + # Creates a virtual environment, checking the integrity of the cache + # and copying the files. + # This is slower (+ 60 seconds to the sync) but it is prevents issues with + # corrupted cache. These issues happen when a shared filesystem such as LUSTRE + # is used along with symlinks and a SCRATCH deletion policy: some files from + # cached packages may get deleted because they seem to not be touched enough. cd "$SCRIPT_DIR" || exit 1 # --refresh --reinstall : LUSTRE may clean up some pieces of the cache. # This ensures basic integrity but it is too slow (adds 60 seconds to the sync) to do it on every sync. So we only do it on mac, where the cache is more likely to get corrupted. + # --link-mode=copy overrides the pyproject.toml setting (symlink) to fully + # detach installed files from the cache, so SCRATCH cleanups can't corrupt the venv. # If we are running on a mac, use the cpu extra if [[ "$(uname)" == "Darwin" ]]; then - uv sync --all-packages --extra cpu --refresh --reinstall + uv sync --all-packages --extra cpu --refresh --reinstall --link-mode=copy exit 0 fi # Otherwise, use the gpu extra - uv sync --all-packages --extra gpu --refresh --reinstall + uv sync --all-packages --extra gpu --refresh --reinstall --link-mode=copy ) ;; lint) From 7cc2f8b6df1a6a970cdff887750ed376583fddb4 Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 10:11:50 +0200 Subject: [PATCH 17/38] fixes for anemoi --- pyproject.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index b18d2a626..cf7efe07a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -198,6 +198,12 @@ name = "pytorch-cu126" url = "https://download.pytorch.org/whl/cu126" explicit = true +# anemoi-datasets (from the tjhunter fork) doesn't declare setuptools in its +# build-system.requires, so PEP 517 isolated builds fail with "No module named +# 'setuptools.build_meta'". Inject it here until upstream fixes it. +[tool.uv.extra-build-dependencies] +anemoi-datasets = ["setuptools", "wheel"] + [tool.pyrefly] project-includes = ["src/"] From d19c5c558f3dae81ad0788b4f0b3e4eb7b98052d Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 10:16:35 +0200 Subject: [PATCH 18/38] checks --- pyproject.toml | 3 ++- scripts/actions.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index cf7efe07a..6bf6e2b7f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -263,7 +263,8 @@ torch = [ { index = "pytorch-cpu", marker = "sys_platform == 'darwin'", extra="gpu"}, ] # branch = "feature/any-zarr-version-in-pyproject/" -anemoi-datasets = { git = "https://github.com/tjhunter/anemoi-datasets", tag = "0.0.1"} +# anemoi-datasets = { git = "https://github.com/tjhunter/anemoi-datasets", tag = "0.0.1"} +anemoi-datasets = { git = "https://github.com/ecmwf/anemoi-datasets", tag = "v0.0.2-special-zarr3"} [tool.pytest.ini_options] log_cli = true diff --git a/scripts/actions.sh b/scripts/actions.sh index 790eff696..cc4893841 100755 --- a/scripts/actions.sh +++ b/scripts/actions.sh @@ -204,7 +204,8 @@ case "$1" in *) ( # Automatically extract all options from the case statement - options=$(grep -oP '^\s*\K[\w-]+(?=\))' "$0" | tr '\n' '|' | sed 's/|$//') + # Uses sed -E (BSD/macOS-compatible) instead of grep -oP (GNU-only). + options=$(sed -nE 's/^[[:space:]]*([a-zA-Z][a-zA-Z0-9_-]*)\).*/\1/p' "$0" | tr '\n' '|' | sed 's/|$//') echo "Usage: $0 {$options}" exit 1 ) From 0a5c5f0b42f3bdd42bde35efd4ad9bf1c4f9f23b Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 10:28:14 +0200 Subject: [PATCH 19/38] check --- pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6bf6e2b7f..2298c6dd9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -202,7 +202,7 @@ explicit = true # build-system.requires, so PEP 517 isolated builds fail with "No module named # 'setuptools.build_meta'". Inject it here until upstream fixes it. [tool.uv.extra-build-dependencies] -anemoi-datasets = ["setuptools", "wheel"] +anemoi-datasets = ["setuptools", "wheel", "setuptools.build_meta"] [tool.pyrefly] @@ -263,8 +263,8 @@ torch = [ { index = "pytorch-cpu", marker = "sys_platform == 'darwin'", extra="gpu"}, ] # branch = "feature/any-zarr-version-in-pyproject/" -# anemoi-datasets = { git = "https://github.com/tjhunter/anemoi-datasets", tag = "0.0.1"} -anemoi-datasets = { git = "https://github.com/ecmwf/anemoi-datasets", tag = "v0.0.2-special-zarr3"} +anemoi-datasets = { git = "https://github.com/tjhunter/anemoi-datasets", tag = "0.0.1"} +# anemoi-datasets = { git = "https://github.com/ecmwf/anemoi-datasets", tag = "v0.0.2-special-zarr3"} [tool.pytest.ini_options] log_cli = true From 0c3d990b7db9e02ea52fe8fdad2dff9388e2760a Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 10:30:52 +0200 Subject: [PATCH 20/38] changes --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2298c6dd9..903f8fca2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -202,7 +202,7 @@ explicit = true # build-system.requires, so PEP 517 isolated builds fail with "No module named # 'setuptools.build_meta'". Inject it here until upstream fixes it. [tool.uv.extra-build-dependencies] -anemoi-datasets = ["setuptools", "wheel", "setuptools.build_meta"] +anemoi-datasets = ["setuptools", "wheel"] [tool.pyrefly] From 5ceebd822339d1fbc9091590cd75a45ae563860d Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 10:32:56 +0200 Subject: [PATCH 21/38] debug --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 903f8fca2..d691eaa6c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -203,7 +203,7 @@ explicit = true # 'setuptools.build_meta'". Inject it here until upstream fixes it. [tool.uv.extra-build-dependencies] anemoi-datasets = ["setuptools", "wheel"] - +cfunits = ["setuptools", "wheel"] [tool.pyrefly] project-includes = ["src/"] From 783233defccfc94c317f96a2fe23ca542bdc59cf Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 10:34:39 +0200 Subject: [PATCH 22/38] debug --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index d691eaa6c..9ed773977 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -204,6 +204,7 @@ explicit = true [tool.uv.extra-build-dependencies] anemoi-datasets = ["setuptools", "wheel"] cfunits = ["setuptools", "wheel"] +antlr4-python3-runtime = ["setuptools", "wheel"] [tool.pyrefly] project-includes = ["src/"] From e1bf00c38dedd7c59081345aa107f2b03e245dbc Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 10:37:46 +0200 Subject: [PATCH 23/38] debug --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 9ed773977..409d6ca98 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,6 +65,8 @@ dev = [ "pdbpp>=0.11.7", "pylint==4.0.3", "pyrefly==0.36.0", + # DEBUG + "cfunits", ] From e77e029420a5e6212b3faedb501eaca7899f37b1 Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 10:40:09 +0200 Subject: [PATCH 24/38] debug --- pyproject.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 409d6ca98..194f8be38 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,6 +29,9 @@ dependencies = [ "weathergen-evaluate", "weathergen-readers-extra", "pytest>=9.0.2", + # DEBUG + "cfunits", + "antlr4-python3-runtime", ] @@ -65,8 +68,6 @@ dev = [ "pdbpp>=0.11.7", "pylint==4.0.3", "pyrefly==0.36.0", - # DEBUG - "cfunits", ] From d59e96856a27771a6e39b6054344bfae9572baab Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 10:48:59 +0200 Subject: [PATCH 25/38] try --- pyproject.toml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 194f8be38..5494772a1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,6 +18,7 @@ dependencies = [ 'matplotlib', 'packaging', 'wheel', + 'setuptools', 'psutil', "polars~=1.25.2", "omegaconf~=2.3.0", @@ -195,20 +196,24 @@ conflicts = [ ], ] +[tool.uv.extra-build-dependencies] +anemoi-datasets = ["setuptools"] + +# These packages don't declare setuptools/wheel in build-system.requires, so +# isolated builds fail with "No module named 'setuptools.build_meta'". Build +# them in the project venv (which has setuptools + wheel as runtime deps). +no-build-isolation-package = [ + "anemoi-datasets", + "cfunits", + "antlr4-python3-runtime", +] + [[tool.uv.index]] name = "pytorch-cu126" url = "https://download.pytorch.org/whl/cu126" explicit = true -# anemoi-datasets (from the tjhunter fork) doesn't declare setuptools in its -# build-system.requires, so PEP 517 isolated builds fail with "No module named -# 'setuptools.build_meta'". Inject it here until upstream fixes it. -[tool.uv.extra-build-dependencies] -anemoi-datasets = ["setuptools", "wheel"] -cfunits = ["setuptools", "wheel"] -antlr4-python3-runtime = ["setuptools", "wheel"] - [tool.pyrefly] project-includes = ["src/"] project-excludes = [ From 35aadb7141e8dc101fd7564745fcacda26b75679 Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 10:55:12 +0200 Subject: [PATCH 26/38] debug --- pyproject.toml | 5 +++-- scripts/actions.sh | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5494772a1..09a0dc5d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -196,8 +196,6 @@ conflicts = [ ], ] -[tool.uv.extra-build-dependencies] -anemoi-datasets = ["setuptools"] # These packages don't declare setuptools/wheel in build-system.requires, so # isolated builds fail with "No module named 'setuptools.build_meta'". Build @@ -208,6 +206,9 @@ no-build-isolation-package = [ "antlr4-python3-runtime", ] +[tool.uv.extra-build-dependencies] +anemoi-datasets = ["setuptools", "wheel"] + [[tool.uv.index]] name = "pytorch-cu126" diff --git a/scripts/actions.sh b/scripts/actions.sh index cc4893841..4cc436193 100755 --- a/scripts/actions.sh +++ b/scripts/actions.sh @@ -37,7 +37,7 @@ case "$1" in exit 0 fi # Otherwise, use the gpu extra - uv sync --all-packages --extra gpu --refresh --reinstall --link-mode=copy + uv sync --all-packages --extra gpu --refresh --reinstall --link-mode=copy --verbose ) ;; lint) From b3583065b330a318c882b21bf8d558ae2d2b7309 Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 10:57:50 +0200 Subject: [PATCH 27/38] debug --- pyproject.toml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 09a0dc5d9..241c52f00 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -198,16 +198,15 @@ conflicts = [ # These packages don't declare setuptools/wheel in build-system.requires, so -# isolated builds fail with "No module named 'setuptools.build_meta'". Build -# them in the project venv (which has setuptools + wheel as runtime deps). -no-build-isolation-package = [ - "anemoi-datasets", - "cfunits", - "antlr4-python3-runtime", -] - +# isolated PEP 517 builds fail with "No module named 'setuptools.build_meta'". +# Inject the missing build deps into uv's isolated build environment. +# NOTE: do NOT pair this with no-build-isolation-package for the same packages +# — no-build-isolation wins and skips the injected build deps, then fails +# because the project venv isn't populated yet at build time. [tool.uv.extra-build-dependencies] anemoi-datasets = ["setuptools", "wheel"] +cfunits = ["setuptools", "wheel"] +antlr4-python3-runtime = ["setuptools", "wheel"] [[tool.uv.index]] From fd4bf24d88b9b1e3a7e22a6cd8258fc0f6474e97 Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 11:02:03 +0200 Subject: [PATCH 28/38] debug --- pyproject.toml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 241c52f00..4b00569c3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -200,13 +200,16 @@ conflicts = [ # These packages don't declare setuptools/wheel in build-system.requires, so # isolated PEP 517 builds fail with "No module named 'setuptools.build_meta'". # Inject the missing build deps into uv's isolated build environment. +# setuptools is pinned <76: with newer setuptools (observed: 82.0.0) the +# `setuptools.build_meta:__legacy__` backend isn't importable, which breaks +# any sdist that has no pyproject.toml and relies on the legacy backend. # NOTE: do NOT pair this with no-build-isolation-package for the same packages # — no-build-isolation wins and skips the injected build deps, then fails # because the project venv isn't populated yet at build time. [tool.uv.extra-build-dependencies] -anemoi-datasets = ["setuptools", "wheel"] -cfunits = ["setuptools", "wheel"] -antlr4-python3-runtime = ["setuptools", "wheel"] +anemoi-datasets = ["setuptools<76", "wheel"] +cfunits = ["setuptools<76", "wheel"] +antlr4-python3-runtime = ["setuptools<76", "wheel"] [[tool.uv.index]] From ceacad255093c91079a834e22f659117740899e9 Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 11:03:43 +0200 Subject: [PATCH 29/38] debug --- pyproject.toml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4b00569c3..d1a4fe594 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -199,18 +199,13 @@ conflicts = [ # These packages don't declare setuptools/wheel in build-system.requires, so # isolated PEP 517 builds fail with "No module named 'setuptools.build_meta'". -# Inject the missing build deps into uv's isolated build environment. -# setuptools is pinned <76: with newer setuptools (observed: 82.0.0) the -# `setuptools.build_meta:__legacy__` backend isn't importable, which breaks -# any sdist that has no pyproject.toml and relies on the legacy backend. -# NOTE: do NOT pair this with no-build-isolation-package for the same packages -# — no-build-isolation wins and skips the injected build deps, then fails -# because the project venv isn't populated yet at build time. +# setuptools is pinned <76: with newer setuptools (>=82) the +# `setuptools.build_meta:__legacy__` backend has been removed [tool.uv.extra-build-dependencies] anemoi-datasets = ["setuptools<76", "wheel"] cfunits = ["setuptools<76", "wheel"] antlr4-python3-runtime = ["setuptools<76", "wheel"] - +cartopy = ["setuptools<76", "wheel"] [[tool.uv.index]] name = "pytorch-cu126" From 7b6fe6aa90be90599da54a7fb82139c5232e7da9 Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 11:04:20 +0200 Subject: [PATCH 30/38] debug --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d1a4fe594..89a0a6d76 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -205,7 +205,7 @@ conflicts = [ anemoi-datasets = ["setuptools<76", "wheel"] cfunits = ["setuptools<76", "wheel"] antlr4-python3-runtime = ["setuptools<76", "wheel"] -cartopy = ["setuptools<76", "wheel"] +cartopy = ["setuptools<78", "wheel"] [[tool.uv.index]] name = "pytorch-cu126" From 3969b2c43398e240ce553a111f988137fe599dd8 Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 11:04:52 +0200 Subject: [PATCH 31/38] debug --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 89a0a6d76..401b9f5a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -206,6 +206,7 @@ anemoi-datasets = ["setuptools<76", "wheel"] cfunits = ["setuptools<76", "wheel"] antlr4-python3-runtime = ["setuptools<76", "wheel"] cartopy = ["setuptools<78", "wheel"] +numcodecs = ["setuptools<78", "wheel"] [[tool.uv.index]] name = "pytorch-cu126" From 622731c0b406c8ab65587635faa68c8b67e6cb7d Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 11:11:48 +0200 Subject: [PATCH 32/38] debug --- pyproject.toml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 401b9f5a9..bc4dc60a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,8 @@ dependencies = [ "weathergen-evaluate", "weathergen-readers-extra", "pytest>=9.0.2", + # older version have no precompiled linux-aarch64 cp312 wheel + "numcodecs>=0.16", # DEBUG "cfunits", "antlr4-python3-runtime", @@ -205,8 +207,10 @@ conflicts = [ anemoi-datasets = ["setuptools<76", "wheel"] cfunits = ["setuptools<76", "wheel"] antlr4-python3-runtime = ["setuptools<76", "wheel"] +# Cartopy requires setuptools >= 77 cartopy = ["setuptools<78", "wheel"] -numcodecs = ["setuptools<78", "wheel"] +# numcodecs is forced to >=0.16 in [project].dependencies so wheels are used — +# no source build needed, so no extra build deps required here. [[tool.uv.index]] name = "pytorch-cu126" From cf405ab72b3612a5ec3ac2011d920e647848b8b4 Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 11:13:45 +0200 Subject: [PATCH 33/38] try --- packages/common/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/pyproject.toml b/packages/common/pyproject.toml index 3bc52c764..71b416fcd 100644 --- a/packages/common/pyproject.toml +++ b/packages/common/pyproject.toml @@ -8,7 +8,7 @@ dependencies = [ "xarray>=2025.6.1", "dask>=2024.9.1", "zarr~=3.1.3", - "numcodecs<0.16.0", + "numcodecs<=0.16.5", "astropy_healpix~=1.1.2", "omegaconf~=2.3.0", "pyyaml", From 5d194d9cbc058de0a26b3f5db8edd6b0b0550b64 Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 11:27:58 +0200 Subject: [PATCH 34/38] trigger run --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index bc4dc60a3..598170bd8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -59,6 +59,7 @@ build-backend = "hatchling.build" [tool.hatch.build.targets.wheel] packages = ["src/weathergen"] + [dependency-groups] # The development dependencies dev = [ From 6e50d5a6d0c985007a1763e454e30132d6e3d4bd Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 12:11:34 +0200 Subject: [PATCH 35/38] changes --- ci/cscs.yaml | 2 -- packages/common/pyproject.toml | 1 + pyproject.toml | 19 +++++++++---------- scripts/actions.sh | 2 +- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/ci/cscs.yaml b/ci/cscs.yaml index 475957534..302e18bb6 100644 --- a/ci/cscs.yaml +++ b/ci/cscs.yaml @@ -23,8 +23,6 @@ test_job: https://oauth2:${PRIVATE_REPO_TOKEN}@gitlab.jsc.fz-juelich.de/esde/WeatherGenerator-private.git echo "Sync" - # DEBUG - ls .* ./scripts/actions.sh sync-safe echo "Create links and run tests" ./scripts/actions.sh create-links diff --git a/packages/common/pyproject.toml b/packages/common/pyproject.toml index 71b416fcd..58a5ad407 100644 --- a/packages/common/pyproject.toml +++ b/packages/common/pyproject.toml @@ -8,6 +8,7 @@ dependencies = [ "xarray>=2025.6.1", "dask>=2024.9.1", "zarr~=3.1.3", + # zarr3 has issues with more recent numcodecs "numcodecs<=0.16.5", "astropy_healpix~=1.1.2", "omegaconf~=2.3.0", diff --git a/pyproject.toml b/pyproject.toml index 598170bd8..bb44a7715 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,8 +17,6 @@ dependencies = [ 'tqdm', 'matplotlib', 'packaging', - 'wheel', - 'setuptools', 'psutil', "polars~=1.25.2", "omegaconf~=2.3.0", @@ -32,9 +30,12 @@ dependencies = [ "pytest>=9.0.2", # older version have no precompiled linux-aarch64 cp312 wheel "numcodecs>=0.16", - # DEBUG - "cfunits", - "antlr4-python3-runtime", +# # DEBUG +# "cfunits", +# "antlr4-python3-runtime", + # This seems necessary for build isolation? + 'wheel', + 'setuptools', ] @@ -169,12 +170,12 @@ enable = ["W0201", "W0141"] [tool.uv] # Most work is done a distributed filesystem, where hardlink is not always possible. # Also, trying to resolve some permissions issue, see 44. -# Another option is 'symlink': this can cause broken symlinks to appear but it is faster (no copy) +# symlink: faster than copy (ex: torch), but leads to files being deleted +# when the cache is in SCRATCH with a deletion policy. link-mode = "symlink" # This guarantees that the build is deterministic and will not be impacted # by future releases of dependencies or sub-dependencies. # See https://docs.astral.sh/uv/reference/settings/#exclude-newer -# TODO: pytorch does not publish valid release timestamps, so sadly it does not work. exclude-newer = "2026-02-27T00:00:00Z" # The minimum version of uv required. @@ -201,7 +202,7 @@ conflicts = [ # These packages don't declare setuptools/wheel in build-system.requires, so -# isolated PEP 517 builds fail with "No module named 'setuptools.build_meta'". +# isolated builds fail with "No module named 'setuptools.build_meta'". # setuptools is pinned <76: with newer setuptools (>=82) the # `setuptools.build_meta:__legacy__` backend has been removed [tool.uv.extra-build-dependencies] @@ -210,8 +211,6 @@ cfunits = ["setuptools<76", "wheel"] antlr4-python3-runtime = ["setuptools<76", "wheel"] # Cartopy requires setuptools >= 77 cartopy = ["setuptools<78", "wheel"] -# numcodecs is forced to >=0.16 in [project].dependencies so wheels are used — -# no source build needed, so no extra build deps required here. [[tool.uv.index]] name = "pytorch-cu126" diff --git a/scripts/actions.sh b/scripts/actions.sh index 4cc436193..cc4893841 100755 --- a/scripts/actions.sh +++ b/scripts/actions.sh @@ -37,7 +37,7 @@ case "$1" in exit 0 fi # Otherwise, use the gpu extra - uv sync --all-packages --extra gpu --refresh --reinstall --link-mode=copy --verbose + uv sync --all-packages --extra gpu --refresh --reinstall --link-mode=copy ) ;; lint) From 23209f3698e8d36b50c7b08e6d5a18ff8dc364fd Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 12:13:11 +0200 Subject: [PATCH 36/38] cleanup --- scripts/actions.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/actions.sh b/scripts/actions.sh index cc4893841..abea30ca1 100755 --- a/scripts/actions.sh +++ b/scripts/actions.sh @@ -204,7 +204,6 @@ case "$1" in *) ( # Automatically extract all options from the case statement - # Uses sed -E (BSD/macOS-compatible) instead of grep -oP (GNU-only). options=$(sed -nE 's/^[[:space:]]*([a-zA-Z][a-zA-Z0-9_-]*)\).*/\1/p' "$0" | tr '\n' '|' | sed 's/|$//') echo "Usage: $0 {$options}" exit 1 From 4ffd314f43a803b3f58a55adafa5fbe1d8b36532 Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 12:19:49 +0200 Subject: [PATCH 37/38] cleanup --- pyproject.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bb44a7715..ab5820ac0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,9 +30,6 @@ dependencies = [ "pytest>=9.0.2", # older version have no precompiled linux-aarch64 cp312 wheel "numcodecs>=0.16", -# # DEBUG -# "cfunits", -# "antlr4-python3-runtime", # This seems necessary for build isolation? 'wheel', 'setuptools', From 31690fc7386584ce2e0ab8f960516a8d2006619a Mon Sep 17 00:00:00 2001 From: Tim Hunter Date: Fri, 29 May 2026 14:11:24 +0200 Subject: [PATCH 38/38] change --- pyproject.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ab5820ac0..45c553f65 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -271,9 +271,10 @@ torch = [ # TODO: explore pytorch + metal backend { index = "pytorch-cpu", marker = "sys_platform == 'darwin'", extra="gpu"}, ] -# branch = "feature/any-zarr-version-in-pyproject/" -anemoi-datasets = { git = "https://github.com/tjhunter/anemoi-datasets", tag = "0.0.1"} +# TODO: switch back to this branch, but this is a larger update and the tag name is incorrect # anemoi-datasets = { git = "https://github.com/ecmwf/anemoi-datasets", tag = "v0.0.2-special-zarr3"} +anemoi-datasets = { git = "https://github.com/tjhunter/anemoi-datasets", tag = "0.0.1"} + [tool.pytest.ini_options] log_cli = true