From 8ee53a9e380d22de09509b44cd01b9d4b51c9d4b Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Sat, 24 Aug 2024 09:45:23 -0400 Subject: [PATCH] Clarify need to include `pyproject.toml` with `--no-install-project` (#6581) ## Summary See: https://github.com/astral-sh/uv/issues/6573 --- crates/uv/tests/sync.rs | 24 ++++++++++++++++++++++++ docs/guides/integration/docker.md | 6 +++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/crates/uv/tests/sync.rs b/crates/uv/tests/sync.rs index 2e3b5ed5d..2ea551fac 100644 --- a/crates/uv/tests/sync.rs +++ b/crates/uv/tests/sync.rs @@ -861,6 +861,18 @@ fn no_install_project() -> Result<()> { + sniffio==1.3.1 "###); + // However, we do require the `pyproject.toml`. + fs_err::remove_file(pyproject_toml)?; + + uv_snapshot!(context.filters(), context.sync().arg("--no-install-project"), @r###" + success: false + exit_code: 2 + ----- stdout ----- + + ----- stderr ----- + error: No `pyproject.toml` found in current directory or any parent directory + "###); + Ok(()) } @@ -928,6 +940,18 @@ fn no_install_workspace() -> Result<()> { + sniffio==1.3.1 "###); + // However, we do require the `pyproject.toml`. + fs_err::remove_file(child.join("pyproject.toml"))?; + + uv_snapshot!(context.filters(), context.sync().arg("--no-install-workspace"), @r###" + success: false + exit_code: 2 + ----- stdout ----- + + ----- stderr ----- + error: Workspace member `[TEMP_DIR]/child` is missing a `pyproject.toml` (matches: `child`) + "###); + Ok(()) } diff --git a/docs/guides/integration/docker.md b/docs/guides/integration/docker.md index e5ec5020f..d8bdfce70 100644 --- a/docs/guides/integration/docker.md +++ b/docs/guides/integration/docker.md @@ -228,8 +228,9 @@ a big time saver. FROM python:3.12-slim COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv -# Copy the lockfile into the image +# Copy the lockfile and `pyproject.toml` into the image ADD uv.lock /app/uv.lock +ADD pyproject.toml /app/pyproject.toml # Install dependencies WORKDIR /app @@ -243,6 +244,9 @@ WORKDIR /app RUN uv sync --frozen ``` +Note that the `pyproject.toml` is required to identify the project root and name, but the project +_contents_ are not copied into the image until the final `uv sync` command. + !!! tip If you're using a [workspace](../../concepts/workspaces.md), then use the