Customizable venv prompt prefix and suffix
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 35.9k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
Feature or enhancement
Proposal:
In venv activate PS1 is updated with the fixed format.
Some user like me doesn't like such format for some reason.
For my case, I'd like to keep empty line between the previous output and the current prompt like
[/tmp]
<username>@<hostname>% python --version
Python 3.14.2
[/tmp]
<username>@<hostname>%
If I enable venv, it breaks my preference like
(.python.venv.default.3.14.2)
[/tmp]
<username>@<hostname>% python --version
Python 3.14.2
(.python.venv.default.3.14.2)
[/tmp]
<username>@<hostname>%
I want to keep empty like between previous output and commands like
(.python.venv.default.3.14.2)
[/tmp]
<username>@<hostname>% python --version
Python 3.14.2
(.python.venv.default.3.14.2)
[/tmp]
<username>@<hostname>%
This can be easily achieved keeping the compatibility by taking prefix and suffix for venv name in activate to set PS1 instaed of current "(" and ") ".
It makes someone to use explain venv name as their preferred way like
(Python env: /home/<...>/.venv)
[/tmp]
<username>@<hostname>% python --version
Python 3.14.2
(Python env: /home/<...>/.venv)
[/tmp]
<username>@<hostname>%
with
# Auto activate .venv in the new dir
function chpwd() {
if [[ -d "`pwd`/.venv" ]]; then
VIRTUAL_ENV_PROMPT_PREFIX="
(Python env: `pwd`/" source `pwd`/.venv/bin/activate
fi
}
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
- gh-144205
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với script kích hoạt venv được đề cập trong đề xuất và xem lại cách script hiện đặt PS1. So sánh hành vi được yêu cầu đối với tiền tố và hậu tố có thể cấu hình với phần công việc được liên kết trong gh-144205; hoàn thành nghĩa là vẫn giữ mặc định hiện có đồng thời cho phép định dạng prompt được minh họa trong các ví dụ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- tooling
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 25/100