-
Notifications
You must be signed in to change notification settings - Fork 760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use relative paths for user display #2559
Conversation
+1 I prefer this strongly. I would be careful with cases where the user provides something relative but stepping upwards like |
e3454e3
to
19856a4
Compare
19856a4
to
150dd65
Compare
524e2fa
to
1b1821c
Compare
1b1821c
to
f63f4c9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better
"Activate with: source /home/ferris/project/.venv/bin/activate", | ||
), | ||
(filter_prompt, "Activate with: source .venv/bin/activate"), | ||
(&filter_venv, ".venv"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this filter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, for some reason on macOS these paths are sometimes prefixed with /private/
Summary
This PR changes our user-facing representation for paths to use relative paths, when the path is within the current working directory. This mirrors what we do in Ruff. (If the path is outside the current working directory, we print an absolute path.)
Before:
❯ uv venv .venv2 Using Python 3.12.2 interpreter at: /Users/crmarsh/workspace/uv/.venv/bin/python3 Creating virtualenv at: .venv2 Activate with: source .venv2/bin/activate
After:
Note that we still want to use the existing
.simplified_display()
anywhere that the path is being simplified, but still intended for machine consumption (e.g., when passing to.current_dir()
).