Skip to content

Notebook and Quarto deploys with -r uv.lock fail for a bare filename (cwd is empty) #922

Open

Description

@tdstein

Problem

Deploying a notebook or Quarto document by bare filename with -r uv.lock fails before bundling:

Inspecting Python environment...                 [ERROR]
Error: Error creating environment: Error during uv export: [Errno 2] No such file or directory: ''

Reproduce (main @ 01878e8)

From a uv project directory that contains uv.lock:

rsconnect write-manifest notebook -r uv.lock nb.ipynb    # fails
rsconnect write-manifest quarto  -r uv.lock doc.qmd     # fails
rsconnect write-manifest quarto  -r uv.lock ./doc.qmd   # works

deploy notebook and deploy quarto fail the same way.

Cause

base_dir = dirname(file) is "" for a bare filename (main.py#L2195, main.py#L3084). uv_export then builds lock_path = os.path.join("", "uv.lock") == "uv.lock" and runs subprocess.run(..., cwd=os.path.dirname(lock_path)), which means cwd="" (inspect_environment.py#L237-L262). subprocess can't chdir("").

Requirements files in requirements.txt format don't hit this because they don't spawn a subprocess with that cwd.

Expected

A bare filename works the same as ./filename. Possible fixes: resolve lock_path with os.path.abspath in uv_export, and/or normalize base_dir to "."/an absolute path when dirname() returns "".

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions