Skip to content

refactor(data-api): remove the CF standard-name check and its import-time download - #285

Open
lhoupert wants to merge 3 commits into
mainfrom
refactor/265-remove-cf-name-check
Open

lhoupert wants to merge 3 commits into
mainfrom
refactor/265-remove-cf-name-check

Conversation

@lhoupert

@lhoupert lhoupert commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

The CF standard-name check never rejected anything: standard_name was typed CFStandardName | str | None, so a name that failed the check fell through to str. Its only effect was downloading the ~4.5 MB CF table on every import eopf_geozarr. This removes the check, the import-time fetch and the cf-xarray dependency (its only use was the table parser). standard_name is now str | None, which behaves as before. A new test checks that import eopf_geozarr makes no network call; with the old fetch restored, it fails. Removal was agreed in #265 and in #277 (row 7). Closes #265.

For reviewers: uv.lock is main's lock minus cf-xarray, plus the editable eopf-geozarr version set to 0.12.0 (main's lock was left at 0.11.0 by the release). It was hand-edited because a newer local uv rewrites many unrelated markers; uv lock --check passes.

Author attestation

  • I am a human, these are my changes, and I have reviewed and understood every change and can explain why each is correct.

AI-assisted: implemented with Claude Code and checked by a separate review agent. pre-commit (ruff, format, pyright) and the full non-network suite (758 passed) pass locally.

lhoupert and others added 3 commits September 28, 2026 14:48
…time download

The check never rejected anything: `standard_name` was typed
`CFStandardName | str | None`, so a name that failed the CF check fell
through to `str` and was accepted. The only effect of the check was a
~4.5 MB download of the CF standard-name table every time eopf_geozarr
was imported, which also makes `import eopf_geozarr` (and `eopf --help`
via the CPM entry point) depend on the network.

Remove `get_cf_standard_names`, `CF_STANDARD_NAME_URL`, the import-time
fetch, `check_standard_name` and `CFStandardName`. Type `standard_name`
as `str | None` on the S1 and S2 array attrs (same behaviour as before).
Drop the CF tests and the `cf-xarray` dependency, whose only use was the
table parser.

Closes #265

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Resolve the tests/test_data_api/test_geozarr/test_common.py conflict with #277: keep main's hand-built test_multiscales_round_trip() and drop the CF tests. uv.lock is main's lock minus cf-xarray.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Runs the import in a fresh interpreter with DNS and socket connect stubbed to raise a BaseException, so an except-OSError fallback cannot hide the call. With main's CF fetch restored, the import raises from get_cf_standard_names.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@lhoupert
lhoupert requested a review from d-v-b September 28, 2026 15:56
@lhoupert
lhoupert marked this pull request as ready for review September 28, 2026 15:56
"socket.socket.connect = deny\n"
"import eopf_geozarr\n"
)
subprocess.run([sys.executable, "-c", code], check=True)

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.

can we avoid subproicess?

@emmanuelmathot

Copy link
Copy Markdown
Contributor

@lhoupert is this PR still valid?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CF name check never rejects anything

2 participants