build: migrate to uv and ruff, vendor the bump workflow#323
Open
lewisjared wants to merge 2 commits into
Open
Conversation
Replace Poetry with uv (PEP 621 + hatchling, committed uv.lock) and make ruff the sole linter and formatter (drop black, blackdoc, pylint and bandit configs). Vendor the version-bump process (uv version --bump + towncrier) from climate-resource/github-actions as local composite actions under .github/actions, and migrate the CI/release/deploy/docs workflows, the Makefile and pre-commit to uv. Also fix ScmRun.from_nc under pandas >= 2.1 (including pandas 3): stack() no longer drops all-NaN entries, so the densified netCDF grid left spurious timeseries and could fail to reshape when an _id dimension was present. Empty dimension combinations and timeseries are now dropped explicitly.
cf80789 to
3b51d06
Compare
Python 3.10's last xarray release (2025.6.1) predates pandas-3 support (pandas 3 needs xarray >=~2025.12), so 3.10 cannot work with the modern pandas/numpy stack. Require Python >=3.11, raise the xarray floor to >=2025.12, add scipy>=1.13 (numpy-2 compatible), bump the ruff target to py311 (Self now imported from typing), and update the CI/install matrices and classifiers to 3.11-3.13.
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.
Pull request
Please confirm that this pull request has done the following:
Summary
Migrates the project tooling from Poetry to uv, makes ruff the sole
linter/formatter, re-implements the version-bump workflow using the same process
as
climate-resource/github-actions(vendored locally), and modernises thesupported Python / dependency floors.
Packaging & linting
pyproject.toml: Poetry → PEP 621[project]+[dependency-groups](PEP 735), build backend hatchling, staticversion, committeduv.lock. Extras preserved.[tool.ruff.lint]/[tool.ruff.format],target-version = py311). Removed black, blackdoc,.pylintrc,.bandit.yml; folded.coveragercintopyproject.toml.Vendored bump workflow
.github/actions/setup-uvand.github/actions/bump-version;bump.yamlrewritten to use them (uv version --bump+ towncrier). Old Poetrysetupaction removed.main(e.g.v0.20.0→0.20.1.dev0), matching the reference process.Python support & dependency floors
requires-python = ">=3.11". Python 3.10's lastxarrayrelease (2025.6.1) predates pandas-3 support (which needsxarray >=~2025.12), so 3.10 cannot work with the modern pandas/numpy stack.xarray>=2025.12(first pandas-3-compatible) andscipy>=1.13(first numpy-2-compatible). CI / install matrices and classifiers updated to 3.11–3.13. Thetest-xarray-versionsjob now guards thexarrayfloor (the old0.18.2/2025.0xentries couldn't work with pandas 3).Workflows / docs / hooks → uv
ci.yaml,release.yaml,deploy.yaml,.readthedocs.yaml,Makefile,.pre-commit-config.yaml(ruff + ruff-format + uv-lock) all migrated.liccheckruns viascripts/check-licences.sh+liccheck.ini(it can't parse our PEP 621 pyproject directly).Bug fix bundled in
ScmRun.from_ncunder pandas ≥ 2.1 / 3.0:stack()no longer drops all-NaN entries, so the densified netCDF grid produced spurious timeseries (andIndex contains duplicate entrieswith an_iddimension). Now drops empty dimension combinations and timeseries explicitly. All 108 netcdf tests pass.Verification
uv lock/uv sync/uv build(shipspy.typed);uv version --bumpflow; towncrier draft — OK.ruff check+ruff format --checkclean;pre-commit run --all-filespasses;actionlintclean on the new workflows. Lock resolves a single coherent stack (pandas 3.0.3, xarray 2026.4, numpy 2.4.6, scipy 1.17.1).Known pre-existing failures (dependency drift, out of scope here)
processingtests fail because pandas 3 now returns aDatetimeIndex(datetime64[us]) where the tests' hardcoded expected frames useobjectdtype — stale test expectations.iam-units,psycopg,scse-toolkit, …) pulled transitively viapyam-iamc → ixmp4. The check mechanism is fixed; the policy decision (allowlist vs. constrainpyam-iamc) is left open.