Repository navigation
chore: type annotations and numpy docstrings everywhere, enforced in lint; add AGENTS.md - #44
Merged
mpvginde merged 6 commits intoOct 27, 2026
Conversation
leifdenby
force-pushed
the
chore/annotations-docstrings
branch
from
October 27, 2026 14:04
68cea40 to
676c850
Compare
The YAML-driven pipeline (cli, runner, verification, transformations and the config/dates/save helpers it alone uses) now lives in mxalign.pipeline. The console script points at mxalign.pipeline.cli:main. Public re-exports from mxalign/__init__.py are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the untyped Config dict wrapper with pydantic models (PipelineConfig and one model per section) loaded via load_config(). Unknown or missing keys now fail when the Runner is created instead of deep inside a run, and the Runner reads typed attributes rather than popping keys (which also stops align() mutating the config). Keys that are forwarded to loaders, transformations, metrics and save methods are kept as pass-through kwargs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…add AGENTS.md Every module, class, function and method in src/, tests/ and the example loader now has type annotations on all arguments and return values and a numpy-style docstring (Parameters/Returns/Raises). This is enforced in pre-commit (and therefore CI) by ruff's ANN and D rules (numpy convention) and the numpydoc-validation hook. AGENTS.md describes the package layout, development tools and coding conventions. No behaviour changes: apart from docstrings, annotations and import sorting, the only code edits are sorting mxalign.__all__ and dict literals in tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
leifdenby
force-pushed
the
chore/annotations-docstrings
branch
from
October 27, 2026 14:33
676c850 to
228f76c
Compare
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.
Every function now has type annotations on all arguments and return values and a numpy-style docstring. A lint check keeps it that way, and
AGENTS.mddescribes the project's coding conventions and development tools.Note
This builds on #41 and #42, a stack of follow-ups to #30 (
refactor/alignment). All of these come from my fork, and GitHub can't stack PRs across forks, so this one targetsrefactor/alignment(#30) and also shows their commits. Only the last commit is new here.Enforcement (runs in pre-commit, and so in the existing lint CI)
pyproject.tomlenables ruff'sANNrules (annotations) andDrules (docstrings, numpy convention), with no exemptions for tests.numpydoc-validationhook (v1.11.0) checks that every parameter, return value and so on is documented. It runs all checks exceptEX01/SA01/ES01(Examples, See Also and Extended Summary are optional).__init__is excluded because the class docstring documents its parameters.src/mxalign/loaders/ifs_forecast.pyis excluded from both: it's orphaned and imports modules that no longer exist, and it should be removed or ported to mlwp-data-loaders separately.Code (
src/,tests/,examples/myloader.py)Any; pass-through**kwargsare typedobject. Each also has a numpy docstring (Parameters/Returns/Raises).Attributes, because numpydoc can't see pydantic's generated constructor.mxalign.__all__is now sorted.dict(...)became{...}in two tests.AGENTS.md: package layout, development tools (uv, pytest, pre-commit), coding conventions (annotations, numpy docstrings with an example, no mutation of inputs, registries, config schema), tests, CHANGELOG and ADRs.Possible bugs found while documenting, not fixed here (each could be its own issue):
Runner.verify: ifverification.saveis set but there are no metrics,self.metricsis never assigned, so saving raisesAttributeError.Runner.load_datasets: if none of a dataset's files exist, an empty list is passed to the loader.DatasetPath: for a dataset that is neither forecast nor observation,year/month/dayare never set, sosubstituteraisesAttributeError.MxAccessor.align_time_with: can pass a list/timedeltalead_timetoalign_forecast_to_forecast, which only accepts"reference"/"intersection"/"union".utils/traits.update_*_trait: the validation report is discarded, so invalid traits are never reported.broadcast_nans: an empty dict input comes back as an empty list.kelvin_to_celciusis misspelled (should be "celsius"), and it's public.🤖 Generated with Claude Code