Skip to content

Uv migration#152

Open
maisim wants to merge 6 commits into
sbidoul:mainfrom
maisim:uv-migration
Open

Uv migration#152
maisim wants to merge 6 commits into
sbidoul:mainfrom
maisim:uv-migration

Conversation

@maisim

@maisim maisim commented May 16, 2026

Copy link
Copy Markdown

Switch from pip to uv

@sbidoul

sbidoul commented May 17, 2026

Copy link
Copy Markdown
Owner

I'm fine with moving to uv and uv.lock.

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 .python-version is necessary for uv as it reads requires-python from pyproject.toml.

maisim added 5 commits May 17, 2026 14:11
- 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
@maisim

maisim commented May 17, 2026

Copy link
Copy Markdown
Author

I'm fine with moving to uv and uv.lock.

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.

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.

I don't think .python-version is necessary for uv as it reads requires-python from pyproject.toml.

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.

@maisim maisim marked this pull request as ready for review May 19, 2026 06:21
Comment thread pyproject.toml
Comment on lines +26 to +27
version = "0.2"
description = "A simple Odoo runbot lookalike using kubernetes."

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Why this change?

@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.59%. Comparing base (2aff751) to head (08c3c4e).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sbidoul sbidoul left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

A few things

Comment thread Dockerfile
COPY requirements.txt /tmp/requirements.txt
RUN pip install --no-cache-dir -r /tmp/requirements.txt
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
ENV UV_SYSTEM_PYTHON=1

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Suggested change
ENV UV_SYSTEM_PYTHON=1
ENV UV_SYSTEM_PYTHON=1
ENV UV_COMPILE_BYTECODE=1

Comment thread Dockerfile
Comment on lines +17 to +18
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev --no-install-project

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Suggested change
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

Comment thread Dockerfile

# Install the project
COPY src/ src/
RUN uv sync --frozen --no-dev --no-editable

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Suggested change
RUN uv sync --frozen --no-dev --no-editable
RUN uv sync --locked --no-dev

Editable should be fine, and avoids a copy of the app files.

Comment thread Dockerfile
RUN uv sync --frozen --no-dev --no-install-project

# Install the project
COPY src/ src/

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Suggested change
COPY src/ src/
COPY src/ /app/

No need to change this

Comment thread Dockerfile

EXPOSE 8000

CMD [ "gunicorn", "-w", "1", "--bind", ":8000", "-k", "runboat.uvicorn.RunboatUvicornWorker", "--access-logfile=-", "runboat.app:app"]

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Suggested change
CMD [ "gunicorn", "-w", "1", "--bind", ":8000", "-k", "runboat.uvicorn.RunboatUvicornWorker", "--access-logfile=-", "runboat.app:app"]
CMD [ "uv", "run", "gunicorn", "-w", "1", "--bind", ":8000", "-k", "runboat.uvicorn.RunboatUvicornWorker", "--access-logfile=-", "runboat.app:app"]

I've not tested this but I suspect this is necessary

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