Repository navigation
Uv migration - #152
Uv migration#152maisim wants to merge 6 commits into
Conversation
|
I'm fine with moving to Can you isolate that from the build backend change, it should be independent and I don't immediatly see a benefit of changing the build backend. I don't think |
It was just to be "in sync" with the switch to UV; I have the impression that when we make this change we also switch to uv_build or hatchling as the build system ;) I will remove this part from the PR.
You're right, it's recommended to version the .python-version to indicate the "recommended" version, but since the Python version is very targeted by requires-python, it's unnecessary here. |
- Remove manually-maintained requirements.txt, requirements-test.txt, requirements-mypy.txt (from pip-deepfreeze) - Add auto-generated uv.lock for deterministic dependency resolution - Add .python-version file for uv Python version management (3.13)
- Use ghcr.io/astral-sh/uv:latest as uv source - Use UV_SYSTEM_PYTHON=1 to install into system Python - Use uv sync with layer caching (--no-install-project first) - Remove ENV PYTHONPATH=/app since the package is now properly installed into site-packages
- Replace actions/setup-python with astral-sh/setup-uv - Use `uv sync` instead of pip install - Use `uv run` for pytest and mypy execution
- Replace pip-based setup with uv sync --extra test - Update run commands to use uv run
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #152 +/- ##
=======================================
Coverage 64.59% 64.59%
=======================================
Files 19 19
Lines 1257 1257
=======================================
Hits 812 812
Misses 445 445 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| COPY pyproject.toml uv.lock ./ | ||
| RUN uv sync --frozen --no-dev --no-install-project |
There was a problem hiding this comment.
| COPY pyproject.toml uv.lock ./ | |
| RUN uv sync --frozen --no-dev --no-install-project | |
| # Install dependencies | |
| RUN --mount=type=cache,target=/root/.cache/uv \ | |
| --mount=type=bind,source=uv.lock,target=uv.lock \ | |
| --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ | |
| uv sync --locked --no-install-project |
Following uv's recommendation: https://docs.astral.sh/uv/guides/integration/docker/#intermediate-layers
There was a problem hiding this comment.
I finally did not use bind mounts here because it is redundant, (pyproject.toml/uv.lock are already copied for the final sync) and buildah seems to drop the files from the bind mount. In any case, it seems to be working as it is now.
- Dockerfile: review suggestions applied (UV_COMPILE_BYTECODE, UV_LINK_MODE, uv cache mount, editable install, uv run in CMD), copy README.md required by flit_core, drop the redundant bind mounts (unsupported by buildah) - pyproject.toml: revert to dynamic version/description, relock
Switch from pip to uv