Skip to content

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

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

DOC: clarify and expand documentation about PYTHONUSERBASE and PYTHONNOUSERSITE#144637
tacaswell wants to merge 6 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 +61 to +64
directories are added to the module search path. The :envvar:`PYTHONUSERBASE`
environment variable controls where is searched for user site-packages and the
:envvar:`PYTHONNOUSERSITE` environment variable prevents searching for user
site-packages all together. A common way to customize the search path is to
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be in the paragraph below, together with their respective CLI flags.

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.

@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.

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

Comments