Skip to content

DOC: clarify and expand documentation about PYTHONUSERBASE and PYTHONNOUSERSITE#144637

Open
tacaswell wants to merge 7 commits intopython:mainfrom
tacaswell:doc/usersite_details
Open

DOC: clarify and expand documentation about PYTHONUSERBASE and PYTHONNOUSERSITE#144637
tacaswell wants to merge 7 commits intopython:mainfrom
tacaswell:doc/usersite_details

Conversation

@tacaswell
Copy link
Contributor

@tacaswell tacaswell commented Feb 9, 2026

I erred on this not needing an issue to say "the docs could be improved" as that is always a true statement ;).

The changes are split up into individual commits for ease of review. The primary changes are:

  • increased cross references
  • documenting the previously undocumented behavior that include-system-site-packages in pyvenv.cfg implicitly also controls user site-packages
  • an error in the site.py docstring (looks like it has always been wrong)

📚 Documentation preview 📚: https://cpython-previews--144637.org.readthedocs.build/

Otherwise it is not clear how to disable user site-packages.  Even though it is
directly above, the link from the search results put the top of the page on
PYHONUSERBASE and the user may not think to scroll up for critical context.
Now matches both site.rst and the actual implementation.
It is not otherwise documented that this implicitly disables user
site-packages.
Copy link
Member

@FFY00 FFY00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this @tacaswell!

It overall looks good, and corrects some incorrect information, which is very helpful. I just have a couple comments.

Comment on lines 99 to 106
There are other ways how "virtual environments" could be implemented, this
documentation refers implementations based on the ``pyvenv.cfg`` mechanism,
such as :mod:`venv`. Most virtual environment implementations follow the
model set by :mod:`venv`, but there may be exotic implementations that
diverge from it.
There are many ways how "virtual environments" could be implemented.
This documentation refers to implementations based on the ``pyvenv.cfg``
mechanism, such as :mod:`venv`, that many virtual environment implementations
follow.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly don't think this paragraph needs a change. In fact, I think the new version removes some information that I think is helpful to the user.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think this edit removes any factual information, but agree it could be word smithed a bit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old text points out that most virtual environment implementations use pyvenv.cfg, and reminds the user that there are still other implementations. The new text removes emphasis on pyvenv.cfg being the main mechanism used in most virtual environment implementations. That's what I meant, sorry!

Copy link
Contributor Author

@tacaswell tacaswell Feb 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"virtual environments" is a bit of a slippery term as it can both mean the very specific family of implementations that rely on pyvenv.cfg and a generic "isolated user space Python". Neither pixi nor conda currently drop this file in their environments (how I got started down this path was an issue at work on a shared system where some had done pip install --user and it was then leaking into and breaking pixi environments).

I consider those mainstream tools for the looser meaning the term and in that context the previous text was at best misleading.


I tweaked the first sentence a bit.

@bedevere-app
Copy link

bedevere-app bot commented Feb 19, 2026

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.

@FFY00
Copy link
Member

FFY00 commented Feb 24, 2026

Friendly ping @tacaswell 😊

@tacaswell
Copy link
Contributor Author

I have made the requested changes; please review again

@bedevere-app
Copy link

bedevere-app bot commented Mar 1, 2026

Thanks for making the requested changes!

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

@bedevere-app bedevere-app bot requested a review from FFY00 March 1, 2026 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants