Skip to content

bpo-43319: Fixed the tutorial on venv about standard library#24740

Merged
miss-islington merged 1 commit intopython:masterfrom
cmhzc:master
Mar 7, 2021
Merged

bpo-43319: Fixed the tutorial on venv about standard library#24740
miss-islington merged 1 commit intopython:masterfrom
cmhzc:master

Conversation

@cmhzc
Copy link

@cmhzc cmhzc commented Mar 4, 2021

In the official tutorial on virtual environment

This will create the tutorial-env directory if it doesn’t exist, and also create directories inside it containing a copy of the Python interpreter, the standard library, and various supporting files.

According to the actual behavior of venv and PEP 405's description about virtual environment, no standard library file is included in the virtual environment's directory.

https://bugs.python.org/issue43319

Automerge-Triggered-By: GH:vsajip

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@cmhzc

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@bedevere-bot bedevere-bot added docs Documentation in the Doc dir awaiting review labels Mar 4, 2021
@cmhzc cmhzc changed the title bpo 43319: Fixed the tutorial on venv about standard library bpo-43319: Fixed the tutorial on venv about standard library Mar 4, 2021
@dtrodrigues
Copy link
Contributor

From the abstract of PEP 405 (emphasis added):

Each virtual environment has its own Python binary (allowing creation of environments with various Python versions) and can have its own independent set of installed Python packages in its site directories, but shares the standard library with the base installed Python.

By default, a venv is isolated from system site-packages, not from the standard library.

@cmhzc
Copy link
Author

cmhzc commented Mar 4, 2021

From the abstract of PEP 405 (emphasis added):

Each virtual environment has its own Python binary (allowing creation of environments with various Python versions) and can have its own independent set of installed Python packages in its site directories, but shares the standard library with the base installed Python.

By default, a venv is isolated from system site-packages, not from the standard library.

The phrase I quoted is from the original tutorial, isn't it implying the virtual environment has its own standard lib?

@dtrodrigues
Copy link
Contributor

That's a fair point -- it does seem to imply it has its own copy of the standard library. I misunderstood what you were saying to mean that it didn't have access to the standard library.

It also doesn't necessarily create a copy of the Python interpreter, but rather a symlink to the Python interpreter if it can, but if not, then a copy. I'm not sure if that detail is worth clarifying though.

@cmhzc
Copy link
Author

cmhzc commented Mar 4, 2021

That's a fair point -- it does seem to imply it has its own copy of the standard library. I misunderstood what you were saying to mean that it didn't have access to the standard library.

It also doesn't necessarily create a copy of the Python interpreter, but rather a symlink to the Python interpreter if it can, but if not, then a copy. I'm not sure if that detail is worth clarifying though.

Yeah, I think the default behavior is to create a symbolic link if it can, but I'm not sure if that could be done on Windows. Since
a copy could be made with a --copies option, I didn't make any change to this either.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@cmhzc
Copy link
Author

cmhzc commented Mar 5, 2021

I have made the requested changes; please review again.
I dropped the unneeded commits from the commits history.

@bedevere-bot
Copy link

Thanks for making the requested changes!

@vsajip: please review the changes made to this pull request.

@miss-islington miss-islington merged commit 8d00462 into python:master Mar 7, 2021
sthagen added a commit to sthagen/python-cpython that referenced this pull request Mar 7, 2021
bpo-43319: Fixed the tutorial on venv about standard library (pythonGH-24740)
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 skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants