uv
uv copied to clipboard
Prompt activation after uv venv has successfully run
Summary
- Add prompts for users to activate the
.venvafter it has been created. - Closes https://github.com/astral-sh/uv/issues/1326
If the platform os matches Os::Windows then we provide the following prompt:
writeln!(
printer,
"Activate with .\\{}\\Scripts\\activate.ps1",
path.normalized_display().cyan()
)
Otherwise we provide the following prompt:
writeln!(
printer,
"Activate with source {}/bin/activate",
path.normalized_display().cyan()
)
I've added additional filters in crates/uv/tests/venv.rs so there shouldn't be issues on any of the CI runs (not sure what some of the Windows paths could look like, so these filters might need to be changed):
(
r".*?\\\.venv\\Scripts\\activate\.ps1",
"Activate with source /home/ferris/project/.venv/bin/activate"
)
Test Plan
- Ran tests in
crates/uv/tests/venv.rsand updated snapshots. - Ran
uv venvin a Docker container to test that the output is correct (running Ubuntu)