classification
Title: venv: Deactivate.ps1 is not created when Activate.ps1 was used
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: godaygo, miss-islington, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords: patch

Created on 2018-02-22 11:38 by godaygo, last changed 2019-08-17 21:12 by steve.dower. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 14968 merged d3r3kk, 2019-07-26 19:07
PR 14971 merged miss-islington, 2019-07-26 21:57
PR 14972 merged miss-islington, 2019-07-26 21:57
Messages (8)
msg312551 - (view) Author: Kirill Balunov (godaygo) Date: 2018-02-22 11:38
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.
msg312552 - (view) Author: Kirill Balunov (godaygo) Date: 2018-02-22 11:49
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.
msg312553 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2018-02-22 11:49
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).
"""
msg312554 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2018-02-22 11:49
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).
"""
msg312556 - (view) Author: Kirill Balunov (godaygo) Date: 2018-02-22 12:12
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.
msg348531 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2019-07-26 21:57
New changeset 91e49575095ca16d1b67dd8822deeb7885e421da by Steve Dower (Derek Keeler) in branch 'master':
bpo-32910: Remove implementation detail in venv documentation. (GH-14968)
https://github.com/python/cpython/commit/91e49575095ca16d1b67dd8822deeb7885e421da
msg348532 - (view) Author: miss-islington (miss-islington) Date: 2019-07-26 22:03
New changeset 4b6421c61e9335253ea7004f2878317b88096c30 by Miss Islington (bot) in branch '3.7':
bpo-32910: Remove implementation detail in venv documentation. (GH-14968)
https://github.com/python/cpython/commit/4b6421c61e9335253ea7004f2878317b88096c30
msg348533 - (view) Author: miss-islington (miss-islington) Date: 2019-07-26 22:04
New changeset 06e8fc95d138775e942c18c8e47e72cdcc32f95c by Miss Islington (bot) in branch '3.8':
bpo-32910: Remove implementation detail in venv documentation. (GH-14968)
https://github.com/python/cpython/commit/06e8fc95d138775e942c18c8e47e72cdcc32f95c
History
Date User Action Args
2019-08-17 21:12:40steve.dowersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-07-26 22:04:31miss-islingtonsetmessages: + msg348533
2019-07-26 22:03:26miss-islingtonsetnosy: + miss-islington
messages: + msg348532
2019-07-26 21:57:34miss-islingtonsetpull_requests: + pull_request14741
2019-07-26 21:57:26miss-islingtonsetpull_requests: + pull_request14740
2019-07-26 21:57:14steve.dowersetmessages: + msg348531
2019-07-26 19:07:30d3r3kksetkeywords: + patch
stage: patch review
pull_requests: + pull_request14737
2018-02-22 12:12:45godaygosetmessages: + msg312556
2018-02-22 11:49:15paul.mooresetstatus: open

nosy: - docs@python
messages: + msg312554

assignee: docs@python ->
2018-02-22 11:49:07paul.mooresetstatus: open -> (no value)

nosy: + docs@python
messages: + msg312553

assignee: docs@python
components: + Documentation, - Windows
2018-02-22 11:49:06godaygosetmessages: + msg312552
2018-02-22 11:38:08godaygocreate