Skip to content

Different venv prompts in uv venv and uv sync #7001

Closed
@gusutabopb

Description

@gusutabopb

As per #1445 (comment), uv venv sets the venv prompt to the current directory name (basename $PWD):

> basename $PWD
uv_test
> uv venv -q  && grep prompt .venv/pyvenv.cfg
prompt = uv_test

However, when using uv sync, the prompt is not set and defaults to .venv (the venv directory name)

> basename $PWD
uv_test
> uv init -q && uv sync -q && grep prompt .venv/pyvenv.cfg
# error code 1

I understand uv tries to abstract venvs away from the user and that activating them shouldn't really be needed when using uv run, etc. However, many people still activate virtual environments and having different prompts depending on which uv command created the venv feels inconsistent.

I'd prefer uv sync to behave like uv venv and set the prompt to the current directory name.

uv info

uv 0.4.4 (3d75df6ab 2024-09-04)

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-decisionUndecided if this should be done

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions