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

venv: Deactivate.ps1 is not created when Activate.ps1 was used #77091

Closed
godaygo mannequin opened this issue Feb 22, 2018 · 8 comments
Closed

venv: Deactivate.ps1 is not created when Activate.ps1 was used #77091

godaygo mannequin opened this issue Feb 22, 2018 · 8 comments
Labels
docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error

Comments

@godaygo
Copy link
Mannequin

godaygo mannequin commented Feb 22, 2018

BPO 32910
Nosy @pfmoore, @tjguk, @zware, @zooba, @godaygo, @miss-islington
PRs
  • bpo-32910: Remove implementation detail in venv documentation. #14968
  • [3.8] bpo-32910: Remove implementation detail in venv documentation. (GH-14968) #14971
  • [3.7] bpo-32910: Remove implementation detail in venv documentation. (GH-14968) #14972
  • 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-17.21:12:40.361>
    created_at = <Date 2018-02-22.11:38:08.598>
    labels = ['type-bug', 'docs']
    title = 'venv: Deactivate.ps1 is not created when Activate.ps1 was used'
    updated_at = <Date 2019-08-17.21:12:40.361>
    user = 'https://github.com/godaygo'

    bugs.python.org fields:

    activity = <Date 2019-08-17.21:12:40.361>
    actor = 'steve.dower'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-08-17.21:12:40.361>
    closer = 'steve.dower'
    components = ['Documentation']
    creation = <Date 2018-02-22.11:38:08.598>
    creator = 'godaygo'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 32910
    keywords = ['patch']
    message_count = 8.0
    messages = ['312551', '312552', '312553', '312554', '312556', '348531', '348532', '348533']
    nosy_count = 6.0
    nosy_names = ['paul.moore', 'tim.golden', 'zach.ware', 'steve.dower', 'godaygo', 'miss-islington']
    pr_nums = ['14968', '14971', '14972']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue32910'
    versions = ['Python 3.6']

    @godaygo
    Copy link
    Mannequin Author

    godaygo mannequin commented Feb 22, 2018

    There was a related issue, which was closed https://bugs.python.org/issue26715.

    If virtual environment was activated using Powershell script - Activate.ps1, the Deactivate.ps1 was not created, while the documentation says that it should.

    "You can deactivate a virtual environment by typing “deactivate” in your shell. The exact mechanism is platform-specific: for example, the Bash activation script defines a “deactivate” function, whereas on Windows there are separate scripts called deactivate.bat and Deactivate.ps1 which are installed when the virtual environment is created."

    Way to reproduce under Windows 10, Python 3.6.4

    1. Open elevated Powershell (Administrator access).
    2. Activate virtual environment using Activate.ps1.
    3. There is no Deactivate.ps1

    Also, when the environment was activated with Activate.ps1, deactivate will not work. On the other hand, if the environment was activated simply with activate (it works) in Powershell, deactivate will also work.

    @godaygo godaygo mannequin added OS-windows type-bug An unexpected behavior, bug, or error labels Feb 22, 2018
    @godaygo
    Copy link
    Mannequin Author

    godaygo mannequin commented Feb 22, 2018

    Sorry, deactivate works in both cases Scripts/Activate.ps1 and Scripts/activate. Only Deactivate.ps1 is not created for the former, but the docs says that it should.

    @pfmoore
    Copy link
    Member

    pfmoore commented Feb 22, 2018

    As noted in the related issue that you link to, there is not meant to be a deactivate.ps1 script - the deactivate command is provided via a global deactivate function created when you run activate.ps1 (although this is an implementation detail, all that matters is that a "deactivate" command exists, not how it is implemented).

    The documentation of the implementation-specific behaviour is incorrect, but as it's describing internal implementation details, it shouldn't be relied on anyway.

    Suggested documentation fix:

    """
    You can deactivate a virtual environment by typing “deactivate” in your shell. The exact mechanism is platform-specific and is an internal implementation detail (typically a script of shell function will be used).
    """

    @pfmoore pfmoore added docs Documentation in the Doc dir and removed OS-windows labels Feb 22, 2018
    @pfmoore
    Copy link
    Member

    pfmoore commented Feb 22, 2018

    As noted in the related issue that you link to, there is not meant to be a deactivate.ps1 script - the deactivate command is provided via a global deactivate function created when you run activate.ps1 (although this is an implementation detail, all that matters is that a "deactivate" command exists, not how it is implemented).

    The documentation of the implementation-specific behaviour is incorrect, but as it's describing internal implementation details, it shouldn't be relied on anyway.

    Suggested documentation fix:

    """
    You can deactivate a virtual environment by typing “deactivate” in your shell. The exact mechanism is platform-specific and is an internal implementation detail (typically a script of shell function will be used).
    """

    @godaygo
    Copy link
    Mannequin Author

    godaygo mannequin commented Feb 22, 2018

    Yes, I agree, I did not understand the documentation correctly. It seems to me that the problem in the perception arose because of the fact that "deactivate" is not formatted as shell command, while Deactivate.ps1 and others are. So I think simple formatting will be enough.

    Also, it is not mentioned in the documentation that it is possible to activate environment in Powershell with "Drive:\> <venv>\Scripts\activate", but maybe it's not always true and I have nowhere to check.

    @zooba
    Copy link
    Member

    zooba commented Jul 26, 2019

    New changeset 91e4957 by Steve Dower (Derek Keeler) in branch 'master':
    bpo-32910: Remove implementation detail in venv documentation. (GH-14968)
    91e4957

    @miss-islington
    Copy link
    Contributor

    New changeset 4b6421c by Miss Islington (bot) in branch '3.7':
    bpo-32910: Remove implementation detail in venv documentation. (GH-14968)
    4b6421c

    @miss-islington
    Copy link
    Contributor

    New changeset 06e8fc9 by Miss Islington (bot) in branch '3.8':
    bpo-32910: Remove implementation detail in venv documentation. (GH-14968)
    06e8fc9

    @zooba zooba closed this as completed Aug 17, 2019
    @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
    docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants