Skip to content

Migrate development workflow to uv lockfile - #2016

Open
wmcv wants to merge 6 commits into
lightly-ai:masterfrom
wmcv:issue-2015-dev-workflow
Open

Migrate development workflow to uv lockfile#2016
wmcv wants to merge 6 commits into
lightly-ai:masterfrom
wmcv:issue-2015-dev-workflow

Conversation

@wmcv

@wmcv wmcv commented Aug 4, 2026

Copy link
Copy Markdown

Fixes #2015

Summary

  • Move development dependencies to a uv dependency group
  • Add a reproducible uv.lock with the configured cutoff date
  • Add make lock
  • Run development commands through uv run --frozen
  • Update CONTRIBUTING.md and CLAUDE.md for the new workflow

Testing

  • make lock passes
  • make format-check passes
  • make type-check now completes and reports five existing type-checking errors in unrelated files
  • make install-minimal currently fails due to an existing NumPy 1.18.1/Python 3.12 compatibility issue

Comment thread CONTRIBUTING.md
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:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 ....

Comment thread Makefile Outdated
deactivate || true
rm -rf .venv
uv venv .venv
uv sync --frozen --all-extras

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is not the same logic anymore. Previously it was:

  1. delete the venv
  2. create a new venv
    Now we're also installing all the dependencies (including extras). So this needs to be addressed.

Comment thread Makefile Outdated
Comment on lines 162 to 165
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"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The goal here is now that we only need a singular command.

Comment thread Makefile
Comment on lines 172 to 175
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"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Here we also just want a singular command.

Comment thread Makefile Outdated
Comment on lines +194 to +195
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here.

@liopeer liopeer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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!).

Comment thread Makefile
## build source and wheel package
dist: clean
python -m build
uv build

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Need to check if that actually gives the same result.

Comment thread Makefile

.PHONY: reset-venv
reset-venv:
deactivate || true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Make it retain the same Python version.

Comment thread Makefile
# useful for local development.
# Install the package in non-editable mode in CI.
ifdef CI
EDITABLE=

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think EDITABLE is not used anymore. Only NO_EDITABLE.

Comment thread Makefile
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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This currently does not properly work since we're not setting lower bounds for many packages.

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.

Mypy and numpy incompatible through make install-dev

2 participants