Repository navigation
Modernise packaging and tooling to match the MetEOR template - #38
Merged
Merged
Conversation
- Move all package metadata into pyproject.toml and drop setup.py, requirements.txt, tox.ini and environment.yml (dev/docs deps are now the [dev] and [docs] extras; pytest config is in pyproject) - Replace versioneer with setuptools_scm; __version__ now comes from importlib.metadata - Replace black with ruff (lint + format) and mypy in pre-commit, with pinned versions and an explicit ruff rule selection - Replace the old GitHub Actions workflows with tests.yml (pytest on Python 3.11-3.13 plus a ruff/mypy lint job) and publish.yml (tag- triggered PyPI release via trusted publishing) - Update .readthedocs.yaml to install the docs extra and unshallow the clone so setuptools_scm can see tags - Require Python >= 3.11 (3.8-3.10 are end-of-life) - Refresh README badges, development and release instructions, and correct the licence name to LGPLv3
Mechanical only: ruff format at black's line length (removes blank lines at the start of blocks and rejoins a few split expressions) and removes unused imports flagged by ruff --fix. No behaviour change.
(cherry picked from commit 7b8f9bf)
(cherry picked from commit 61fc784)
- E721: compare exact types with `is` rather than `==` (same semantics) - E712: mark the intentional elementwise numpy `== True/False` comparisons with noqa rather than changing their behaviour - F841: use the already-computed sliced_dims rather than recomputing it, and drop unused variables from the create_ds test fixture - F811: remove a verbatim duplicate of test___setitem___new_mask - Reformat the cherry-picked overflow fix to the project line length - test_rename_dims: newer xarray's assert_identical also compares indexes, and rename_dims keeps the index on the renamed "time" coordinate, so drop it before comparing with the expected dataset
Annotation fixes so the new mypy gate passes: - Use numpy.typing.DTypeLike for dtype arguments (numpy.typecodes is a string constant, not a type) - Make implicit-Optional defaults explicit and widen fill_value to accept numpy scalars, which get_default_fill_value returns - Accept Hashable variable names where xarray hands them to us, and return xr.Dataset rather than an unbound TypeVar from rename methods - Annotate err-corr slices as tuples, matching all callers and subclasses, and accept slices/ints in Flag indexing (e.g. ``[:]``) - Build _expand_sli's list under its own name instead of retyping out_sli Small behaviour changes that fall out of this: - A "flag" template variable without attributes now raises a clear ValueError rather than AttributeError on None.pop - An uncertainty tuple definition with attrs=None is treated as having no attrs rather than raising TypeError - append_names/empty_err_corr_matrix format non-str names with str() rather than failing on string concatenation
Install numpy and xarray into the hook environment so type narrowing behaves as it does in CI, restrict the hook to the package (as CI does), and use the ruff-check hook id in place of the legacy ruff alias.
language = None is no longer valid in current Sphinx.
checkout v7, setup-python v7, upload-artifact v7, download-artifact v8 and codecov-action v7, clearing the Node.js 20 deprecation warnings. None of their breaking changes affect these workflows (artifacts are downloaded by name, no pull_request_target, no pip-install input).
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings obsarray's package-level setup in line with the newer MetEOR tools (eomatch, eoio, …). CI on
maincurrently fails at "Install dependencies" on every job; this replaces it with a working setup, and fixes the issues the new checks and current numpy/xarray turned up.Tooling
pyproject.tomlonly: removedsetup.py,requirements.txt,tox.iniandenvironment.yml. Dev/docs dependencies are now the[dev]and[docs]extras, and pytest config lives inpyproject.toml.setuptools_scm(version fromv*tags), with__version__read viaimportlib.metadata.obsarray/, so it reports the same results as CI.tests.ymlruns pytest on Python 3.11–3.13 and uploads test/coverage reports and coverage to Codecov. A separate lint job runsruff format --check,ruff checkandmypy.publish.ymlpublishes to PyPI on av*tag push (or a confirmed manual run), via trusted publishing..[docs]and fetches full history so setuptools_scm sees the tags.Fixes needed to get CI green
FalseraisedOverflowError, which also broke the docs build. This is fixed by cherry-picking @mattgoalen's two fix commits fromoverflow-errors.test_rename_dims: newer xarray'sassert_identicalalso compares indexes, so the test now drops the retainedtimeindex before comparing. This was a test issue, not a library bug.ruff formatcommit. It keeps black's 88-column line length rather than the template's 120, to avoid reflowing about 650 lines and conflicting with open branches.language = Nonechanged to"en".Testing
Run locally on Python 3.13 (numpy 2.5, xarray 2026.9):
ruff check,ruff format --checkandmypy obsarrayare clean, andpre-commit run -apasses.Before the first release
comet-toolkit, repositoryobsarray, workflowpublish.yml, environmentpypi.CODECOV_TOKENrepository secret if you want coverage uploads.Not changed
docs.yml, becauseobsarray.readthedocs.iois the published URL..gitlab-ci.yml, since obsarray is GitHub-only.LGPL-3.0-onlyandLGPL-3.0-or-lateris a licensing decision.