-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
gh-82419: Improve site docs to clarify user site-packages disabling #125083
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
base: main
Are you sure you want to change the base?
Conversation
Doc/library/site.rst
Outdated
:envvar:`PYTHONNOUSERSITE`). ``None`` means it was disabled for security | ||
reasons (mismatch between user or group id and effective id) or by an | ||
administrator. | ||
administrator. Note that :func:`getusersitepackages` and :func:`getuserbase` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s add some breathing space:
administrator. Note that :func:`getusersitepackages` and :func:`getuserbase` | |
administrator. | |
Note that :func:`getusersitepackages` and :func:`getuserbase` |
Doc/library/site.rst
Outdated
administrator. | ||
administrator. Note that :func:`getusersitepackages` and :func:`getuserbase` | ||
don't take this variable into account. The check for :data:`ENABLE_USER_SITE` and | ||
modification of ``sys.path`` occurs later. To disable user site-packages, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modification of ``sys.path`` occurs later. To disable user site-packages, | |
modification of ``sys.path`` occur later. To disable user site-packages, |
(two things occur)
Doc/library/site.rst
Outdated
don't take this variable into account. The check for :data:`ENABLE_USER_SITE` and | ||
modification of ``sys.path`` occurs later. To disable user site-packages, | ||
users are encouraged to create :mod:`sitecustomize` or :mod:`usercustomize`, | ||
rather than try to edit :file:`Lib/site.py`. Changing :file:`Lib/site.py` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should refer to the site module, not to the Lib/site.py file that only exists with that name in cpython repo, not after installation 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or maybe something like: rather than try to edit site.py
to make it clear we’re talking about the file, not the module (which is something living in the memory of a python interpreter)
Doc/library/site.rst
Outdated
users are encouraged to create :mod:`sitecustomize` or :mod:`usercustomize`, | ||
rather than try to edit :file:`Lib/site.py`. Changing :file:`Lib/site.py` | ||
won't work unless recompile Python, but administrators should still be able | ||
to set :data:`ENABLE_USER_SITE` in a :mod:`sitecustomize` module. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would delete that last sentence, it repeats info.
@merwok Thank you for your feedback, I will revise it later. |
Based on the discussion here: #82419 and advises from the @tiran and @encukou , I further clarified the relationship between ENABLE_USER_SITE and the functions
getusersitepackages()
andgetuserbase()
in the document. I also added a method to configure the output of these two functions.📚 Documentation preview 📚: https://cpython-previews--125083.org.readthedocs.build/