Skip to content

chore: migrate dependency management from Poetry to uv - #132

Merged
t-uda merged 2 commits into
ellphi-0.1.3from
chore/121-migrate-poetry-to-uv
Jul 3, 2026
Merged

chore: migrate dependency management from Poetry to uv#132
t-uda merged 2 commits into
ellphi-0.1.3from
chore/121-migrate-poetry-to-uv

Conversation

@t-uda

@t-uda t-uda commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

Migrates dependency management from Poetry to uv, per issue #121.

  • pyproject.toml
    • Removed the demo optional-dependencies extra and all [tool.poetry.group.*] groups; demo handling now lives in the separate ellphi-demo repository.
    • Dev and docs tooling moved to PEP 735 [dependency-groups] (dev installed by uv sync by default, docs via --group docs). Runtime deps stay in PEP 621 [project.dependencies]; matplotlib remains a mandatory runtime dependency.
    • Build backend kept as poetry-core: [tool.poetry.build].script = "scripts/build_tangency_cpp.py" is what makes any PEP 517 install (pip, uv) compile the C++ tangency backend, so [tool.poetry] / [tool.poetry.build] and the poetry-core backend are retained (floor bumped to poetry-core>=2.0 since the metadata is PEP 621). Verified empirically: uv sync and a plain sdist install both build _tangency_cpp_impl.so.
    • setuptools>=78.1.1 in [build-system] and the dev group (CVE-2025-47273) — this subsumes PR Bump setuptools minimum version to 78.1.1 #126, which can be closed once this merges.
    • [tool.uv] constraint-dependencies = ["numpy<2.5"]: numpy 2.5 exposes NDArray as a PEP 695 type alias that stubtest cannot verify on Python ≥ 3.12 (ellphi.FloatArray is inconsistent, runtime is not a type). This constrains only the dev lockfile; the published package keeps numpy>=1.26. Follow-up when stubtest/numpy catch up.
  • Lockfile: poetry.lock deleted; uv.lock committed. CI now verifies freshness with uv lock --check (lesson from poetry.lock: demo-only transitive dependencies incorrectly listed in main group #124), and installs use uv sync --locked.
  • Workflows (all four): astral-sh/setup-uv@v6 with caching, uv sync / uv run / uv build. Job ids and check names (test (3.10..3.12), typecheck, package-test, demo-install, docs, build-windows (...), build-sdist, build-linux) are preserved for branch protection.
    • demo-install: the demo dependency set no longer exists, so the job (name kept) is repurposed to build the sdist with uv build --sdist and smoke-test a plain pip install from it, verifying the C++ backend compiles from source — a path no other job covered (package-test installs the wheel).
    • Fixes CI: Codecov upload step can fail even when tests pass #117 in python-app.yml: codecov/codecov-action bumped v4.0.1 → v5 and the upload step is now continue-on-error: true, so a Codecov outage cannot fail CI.
  • Docs: README, CONTRIBUTING, AGENTS (checklist rewritten to uv run ...), docs/hybrid_tuning.md, docs/eigen_backend_plan.md, plus scripts/update_version.py usage text and the rebuild hint in src/ellphi/_tangency_cpp.py error message.
  • stubtest allowlist: ellphi.solver.MethodName removed — mypy 1.20 (now locked) reports it as an unused allowlist entry, which stubtest treats as an error. ellphi._solver_python.MethodName is still required. AGENTS.md justification section updated accordingly.

Closes #121
Closes #117

Verification (local, macOS arm64, uv 0.11.8)

All commands run on this branch; every one passed:

Command Status
uv sync (builds C++ backend) pass
uv run python -m ellphi --build-infocpp_backend_available=True pass
uv run black src tests scripts pass (47 files unchanged)
uv run black --check src tests scripts pass
uv run flake8 src tests scripts pass
uv run mypy src tests pass (33 files)
MYPYPATH=src uv run stubtest ellphi --allowlist stubtest-allowlist.txt pass (on both Python 3.11 and 3.12)
uv run pytest pass (243 passed)
uv run mkdocs build pass (one pre-existing griffe warning)
uv lock --check pass
uv build (sdist + wheel; sdist contains .cpp, no binaries; wheel contains .so, .pyi, py.typed) pass

Poetry itself is not installed on this machine; per the migration's premise, no Poetry backwards compatibility was verified or intended.

Deviations / reviewer notes

  • Caret constraints were translated to explicit ranges (e.g. flake8>=7.3.0,<8); exact pins (mkdocstrings==0.25.0, mkdocs-autorefs==1.3.1) kept as-is.
  • The numpy<2.5 dev-lock constraint and the removed ellphi.solver.MethodName allowlist entry are consequences of the fresh resolution (numpy 2.5, mypy 1.20) — flagging them explicitly since they go slightly beyond a pure tooling swap.
  • The wheel built by uv build carries the same interpreter-specific tag scheme (cp312-cp312-<platform>) poetry-core produced before, so the per-Python matrix in release.yml is unchanged.

🤖 Generated with Claude Code

- Move dev/docs tooling to PEP 735 [dependency-groups]; drop demo
  extras and all Poetry groups (demo lives in the ellphi-demo repo)
- Replace poetry.lock with uv.lock; constrain numpy<2.5 in the dev
  lockfile until stubtest supports numpy's PEP 695 NDArray alias
- Keep the poetry-core build backend so pip/uv installs still compile
  the C++ tangency backend; bump setuptools floor to >=78.1.1
  (CVE-2025-47273, subsumes PR #126) and poetry-core to >=2.0
- Switch all four workflows to astral-sh/setup-uv with caching,
  uv sync/run/build; add a `uv lock --check` freshness step
- Repurpose the demo-install job to smoke-test a plain sdist install
- Bump codecov-action to v5 and make the upload non-blocking (#117)
- Update README, CONTRIBUTING, AGENTS and docs to uv commands
- Drop the ellphi.solver.MethodName stubtest allowlist entry, unused
  since mypy 1.20

Closes #121
Closes #117

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 3, 2026 12:36
@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates the project’s development/dependency management workflow from Poetry to uv, updating CI and contributor docs accordingly while keeping poetry-core as the PEP 517 build backend to preserve the C++ extension build behavior.

Changes:

  • Move dev/docs dependencies to PEP 735 [dependency-groups] and add uv-specific configuration in pyproject.toml.
  • Update GitHub Actions workflows to use astral-sh/setup-uv@v6, uv sync, uv run, and uv build, including lockfile freshness checks.
  • Refresh docs/tooling guidance (README/CONTRIBUTING/AGENTS) and adjust stubtest allowlist entries.

Reviewed changes

Copilot reviewed 13 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
stubtest-allowlist.txt Removes an unused stubtest allowlist entry.
src/ellphi/_tangency_cpp.py Updates rebuild guidance text for the C++ backend version mismatch error.
scripts/update_version.py Updates usage instructions from Poetry to uv.
README.md Removes demo extra install instructions and points to the external demo repo; updates source-build guidance to uv.
pyproject.toml Replaces Poetry dependency groups with PEP 735 dependency-groups and adds [tool.uv] constraints; bumps build requirements.
docs/hybrid_tuning.md Updates example command to use uv run.
docs/eigen_backend_plan.md Updates Eigen rebuild instructions to use uv.
CONTRIBUTING.md Updates contributor workflow commands from Poetry to uv (including docs group install).
AGENTS.md Rewrites the local-check checklist and dependency instructions to use uv + uv.lock.
.github/workflows/release.yml Switches release builds from Poetry to uv build.
.github/workflows/python-app.yml Updates CI jobs to use uv for sync/run/build; adds uv lock --check; repurposes demo-install to sdist install smoke test.
.github/workflows/docs.yml Switches docs build/deploy from Poetry to uv (docs dependency group).
.github/workflows/build-windows-wheels.yml Switches wheel build from Poetry to uv build --wheel.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md Outdated
Comment thread docs/eigen_backend_plan.md Outdated
Comment thread src/ellphi/_tangency_cpp.py Outdated
Comment thread .github/workflows/python-app.yml Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 47468c3efd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pyproject.toml
- scripts/hybrid_tuning.sh: migrate `poetry run` to `uv run`
- docs/eigen_backend_plan.md: include ELLPHI_USE_EIGEN=1 in the
  rebuild command so the extension is rebuilt in Eigen mode
- src/ellphi/_tangency_cpp.py: rebuild hint now covers both uv and
  pip (`pip install --force-reinstall .`) and uses the correct
  scripts/build_tangency_cpp.py path
- .github/workflows/python-app.yml: fix "explicitely" typo
- README.md: clarify that maintained demo notebooks live in
  ellphi-demo while in-repo notebooks/ examples remain but their
  extra dependencies are no longer declared by this package

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@t-uda t-uda left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

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.

2 participants