Migrate development workflow to uv lockfile - #2016
Conversation
| test suite passes: | ||
| As you work on the features, you should make sure that the code is formatted and | ||
| the test suite passes. The Makefile runs development tools through the locked `uv` | ||
| environment, so manual virtual environment activation is not required: |
There was a problem hiding this comment.
Seems like there is currently no section on the unit tests. Would add explanation on running make test and on running singular test directories/modules/tests with uv run --frozen pytest ....
| deactivate || true | ||
| rm -rf .venv | ||
| uv venv .venv | ||
| uv sync --frozen --all-extras |
There was a problem hiding this comment.
This is not the same logic anymore. Previously it was:
- delete the venv
- create a new venv
Now we're also installing all the dependencies (including extras). So this needs to be addressed.
| install-minimal: | ||
| uv pip install --exclude-newer ${EXCLUDE_NEWER_DATE} ${EDITABLE} ".[dev]" | ||
| uv pip install --exclude-newer ${EXCLUDE_NEWER_DATE} --group dev ${EDITABLE} . | ||
| uv pip install --resolution=lowest-direct --exclude-newer ${EXCLUDE_NEWER_DATE} --reinstall ${EDITABLE} ".[minimal]" | ||
| uv pip install --exclude-newer ${EXCLUDE_NEWER_DATE} --reinstall "setuptools<50" |
There was a problem hiding this comment.
The goal here is now that we only need a singular command.
| install-minimal-extras: | ||
| uv pip install --exclude-newer ${EXCLUDE_NEWER_DATE} ${EDITABLE} ".[dev]" | ||
| uv pip install --exclude-newer ${EXCLUDE_NEWER_DATE} --group dev ${EDITABLE} . | ||
| uv pip install --resolution=lowest-direct --exclude-newer ${EXCLUDE_NEWER_DATE} --reinstall ${EDITABLE} ".[matplotlib,minimal,timm,video]" --requirement pyproject.toml | ||
| uv pip install --exclude-newer ${EXCLUDE_NEWER_DATE} --reinstall "setuptools<50" |
There was a problem hiding this comment.
Here we also just want a singular command.
| uv pip install --exclude-newer ${EXCLUDE_NEWER_DATE} --reinstall --group dev | ||
| uv pip install --exclude-newer ${EXCLUDE_NEWER_DATE} --reinstall ${EDITABLE} ".[matplotlib,minimal,timm]" --requirement pyproject.toml |
liopeer
left a comment
There was a problem hiding this comment.
Thanks for the work! I think I will have to take this over, since we will need to also fix a few things in the overall dependency handling. Might touch a bit too many things in the code base for a first contribution (but don't worry, once we merge the commits will still be associated with you as well!).
| ## build source and wheel package | ||
| dist: clean | ||
| python -m build | ||
| uv build |
There was a problem hiding this comment.
Need to check if that actually gives the same result.
|
|
||
| .PHONY: reset-venv | ||
| reset-venv: | ||
| deactivate || true |
There was a problem hiding this comment.
Make it retain the same Python version.
| # useful for local development. | ||
| # Install the package in non-editable mode in CI. | ||
| ifdef CI | ||
| EDITABLE= |
There was a problem hiding this comment.
I think EDITABLE is not used anymore. Only NO_EDITABLE.
| install-minimal-extras: | ||
| uv pip install --exclude-newer ${EXCLUDE_NEWER_DATE} ${EDITABLE} ".[dev]" | ||
| uv pip install --resolution=lowest-direct --exclude-newer ${EXCLUDE_NEWER_DATE} --reinstall ${EDITABLE} ".[matplotlib,minimal,timm,video]" --requirement pyproject.toml | ||
| uv sync --python=${MINIMAL_PYTHON_VERSION} --resolution=lowest-direct --exclude-newer ${EXCLUDE_NEWER_DATE} ${NO_EDITABLE} --group dev --extra matplotlib --extra minimal --extra timm --extra video --upgrade-group dev |
There was a problem hiding this comment.
This currently does not properly work since we're not setting lower bounds for many packages.
Fixes #2015
Summary
uv.lockwith the configured cutoff datemake lockuv run --frozenCONTRIBUTING.mdandCLAUDE.mdfor the new workflowTesting
make lockpassesmake format-checkpassesmake type-checknow completes and reports five existing type-checking errors in unrelated filesmake install-minimalcurrently fails due to an existing NumPy 1.18.1/Python 3.12 compatibility issue