Skip to content
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

Making venv activation script prompts consistent #81844

Closed
brettcannon opened this issue Jul 23, 2019 · 2 comments
Closed

Making venv activation script prompts consistent #81844

brettcannon opened this issue Jul 23, 2019 · 2 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@brettcannon
Copy link
Member

BPO 37663
Nosy @brettcannon, @vsajip
PRs
  • bpo-37663: have venv activation scripts all consistently use __VENV_PROMPT__ for prompt customization #14941
  • Dependencies
  • bpo-37660: Drop support for Aspen magic directories in venv's activate scripts
  • bpo-37661: venv activation scripts erroneously check if VENV_PROMPT is defined
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2019-08-22.17:52:43.485>
    created_at = <Date 2019-07-23.20:41:06.453>
    labels = ['type-bug', 'library']
    title = 'Making venv activation script prompts consistent'
    updated_at = <Date 2019-08-22.17:52:43.485>
    user = 'https://github.com/brettcannon'

    bugs.python.org fields:

    activity = <Date 2019-08-22.17:52:43.485>
    actor = 'brett.cannon'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-08-22.17:52:43.485>
    closer = 'brett.cannon'
    components = ['Library (Lib)']
    creation = <Date 2019-07-23.20:41:06.453>
    creator = 'brett.cannon'
    dependencies = ['37660', '37661']
    files = []
    hgrepos = []
    issue_num = 37663
    keywords = ['patch']
    message_count = 2.0
    messages = ['348355', '350127']
    nosy_count = 2.0
    nosy_names = ['brett.cannon', 'vinay.sajip']
    pr_nums = ['14941']
    priority = 'low'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue37663'
    versions = []

    @brettcannon
    Copy link
    Member Author

    There are five activation scripts and they are all do things differently when it comes to prompt manipulation. Standardizing on one set of semantics would probably be good for consistency and so people know what to expect regardless of their shell.

    Currently the various semantics are as follows (see subdirectories in https://github.com/python/cpython/tree/master/Lib/venv/scripts for the code):

    • PowerShell: use __VENV_PROMPT__, make it green
    • bash: use __VENV_PROMPT__ if defined (which is nearly true; bpo-37661), else if virtual env in a directory named "__" (for some defunked software named Aspen; bpo-37660) then use "[dir]", else "(dir)"
    • Command Prompt: use __VENV_PROMPT__
    • csh: use __VENV_NAME__ if defined, else calculate name and use "[dir]"
    • fish: same as bash, except if not using __VENV_PROMPT__ then use white text on a blue background

    So the variances/questions are:

    1. Always use __VENV_PROMPT__ and don't bother testing? (bpo-37661 suggests we should, or else come up with a new way to tell whether a custom prompt was provided)
    2. Always use colour regardless of whether the prompt is custom? (I vote "yes"; don't care about what the colours happen to be)
    3. Parentheses or square brackets? (Due to bpo-37661 I vote for parentheses since that's what people are used to)

    @brettcannon brettcannon added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Jul 23, 2019
    @brettcannon
    Copy link
    Member Author

    New changeset 48ede6b by Brett Cannon in branch 'master':
    bpo-37663: have venv activation scripts all consistently use __VENV_PROMPT__ for prompt customization (GH-14941)
    48ede6b

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant