Skip to content

Add a note to the venv documentation that users should **not** put their code _inside_ the virtual environment #109414

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

Closed
brettcannon opened this issue Sep 14, 2023 · 3 comments
Labels
docs Documentation in the Doc dir

Comments

@brettcannon
Copy link
Member

brettcannon commented Sep 14, 2023

Documentation

The venv docs don't explicitly call out that the virtual environment directory should be viewed as self-contained unit and not as a directory to place one's own code.

Linked PRs

@brettcannon brettcannon added the docs Documentation in the Doc dir label Sep 14, 2023
@brettcannon
Copy link
Member Author

/cc @vsajip

@vsajip
Copy link
Member

vsajip commented Sep 14, 2023

There is an admonition:

Because of this, environments are inherently non-portable, in the general case. You should always have a simple means of recreating an environment (for example, if you have a requirements file requirements.txt, you can invoke pip install -r requirements.txt using the environment’s pip to install all of the packages needed by the environment).

I don't object to adding more information, but doesn't this

virtual environment directory ... and not as a directory to place one's own code.

come under the "bleedin' obvious" category?

@brettcannon
Copy link
Member Author

doesn't this

virtual environment directory ... and not as a directory to place one's own code.

come under the "bleedin' obvious" category?

That's what I thought, but based on https://mastodon.social/@fschulze/111053590685791015 and the amount of people we are running into with VS Code who are getting upset we don't format code we find in a virtual environment because we treat it as outside of a user's domain, it apparently isn't getting out enough into the general community.

vsajip added a commit to vsajip/cpython that referenced this issue Sep 15, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Sep 16, 2023
…uction. (pythonGH-109440)

(cherry picked from commit a6846d4)

Co-authored-by: Vinay Sajip <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Sep 16, 2023
…uction. (pythonGH-109440)

(cherry picked from commit a6846d4)

Co-authored-by: Vinay Sajip <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
vsajip pushed a commit that referenced this issue Sep 16, 2023
Yhg1s pushed a commit that referenced this issue Sep 17, 2023
…duction. (GH-109440) (#109481)

gh-109414: Add some basic information about venvs in the introduction. (GH-109440)
(cherry picked from commit a6846d4)

Co-authored-by: Vinay Sajip <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
@vsajip vsajip closed this as completed Sep 17, 2023
csm10495 pushed a commit to csm10495/cpython that referenced this issue Sep 28, 2023
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
Projects
None yet
Development

No branches or pull requests

2 participants