astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
20.46k stars 605 forks source link

`--no-install-workspace` needs the pyproject.toml of each workspace member to be present #6685

Closed konstin closed 3 weeks ago

konstin commented 3 weeks ago

uv sync --no-dev --no-install-workspace --locked doesn't work when only the root pyproject.toml and uv.lock are present. We should allow installing the entire workspace with --no-install-workspace --locked when only the top level uv.lock is present.

Reproducer failing:

FROM ubuntu AS builder

RUN mkdir /app
WORKDIR /app
ENV UV_PYTHON_INSTALL_DIR=/app/python

COPY --from=ghcr.io/astral-sh/uv /uv /bin/uv

# Install the dependencies
ADD pyproject.toml uv.lock /app/
RUN uv sync --no-dev --no-install-workspace --locked

# Install the project itself
ADD src /app/src
ADD packages /app/packages
RUN uv sync --no-dev --locked

Passing:

FROM ubuntu AS builder

RUN mkdir /app
WORKDIR /app
ENV UV_PYTHON_INSTALL_DIR=/app/python

COPY --from=ghcr.io/astral-sh/uv /uv /bin/uv

# Install the dependencies
ADD pyproject.toml uv.lock /app/
ADD packages/bird-feeder/pyproject.toml /app/packages/bird-feeder/pyproject.toml
ADD packages/seeds/pyproject.toml /app/packages/seeds/pyproject.toml
RUN uv sync --no-dev --no-install-workspace --locked

# Install the project itself
ADD src /app/src
ADD packages /app/packages
RUN uv sync --no-dev --locked
charliermarsh commented 3 weeks ago

The same in spirit as #6573 though makes sense to keep separate; it might be separately fixable.

konstin commented 3 weeks ago

Will probably fix them in one go but i wanted to document the test case.

charliermarsh commented 3 weeks ago

I think this one is easier to fix.