GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-82419: Improve site docs to clarify user site-packages disabling by pppppkun · Pull Request #125083 · python/cpython

Conversation

@pppppkun

@pppppkun pppppkun commented Oct 8, 2024 •
edited by github-actions Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

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() and getuserbase() in the document. I also added a method to configure the output of these two functions.

  • Issue: site.py reporting user site info even if ENABLE_USER_SITE=False #82419

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@pppppkun
pythongh-82419 Refactor site.rst to clarify user site-packages disabling
afd431d
@ghost

ghost commented Oct 8, 2024 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.
CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added docs Documentation in the Doc dir skip news awaiting review labels Oct 8, 2024
@bedevere-app bedevere-app Bot mentioned this pull request Oct 8, 2024
site.py reporting user site info even if ENABLE_USER_SITE=False #82419
Open
@merwok merwok changed the title gh-82419: Refactor site.rst to clarify user site-packages disabling gh-82419: Improve site docs to clarify user site-packages disabling Oct 8, 2024
merwok
merwok reviewed Oct 8, 2024
View reviewed changes
Comment thread 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`

@merwok merwok Oct 8, 2024

Copy link
Copy Markdown
Member

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:

Suggested change
administrator. Note that :func:`getusersitepackages` and :func:`getuserbase`
administrator.
Note that :func:`getusersitepackages` and :func:`getuserbase`

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
merwok
merwok reviewed Oct 8, 2024
View reviewed changes
Comment thread 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,

@merwok merwok Oct 8, 2024

Copy link
Copy Markdown
Member

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.

Suggested change
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)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
merwok
merwok reviewed Oct 8, 2024
View reviewed changes
Comment thread 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`

@merwok merwok Oct 8, 2024

Copy link
Copy Markdown
Member

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 🙂

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@merwok merwok Oct 8, 2024

Copy link
Copy Markdown
Member

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)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
merwok
merwok reviewed Oct 8, 2024
View reviewed changes
Comment thread 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.

@merwok merwok Oct 8, 2024

Copy link
Copy Markdown
Member

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@pppppkun

pppppkun commented Oct 9, 2024

Copy link
Copy Markdown
Author

@merwok Thank you for your feedback, I will revise it later.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pppppkun
pythongh-82419 Revised the site docs about user site-packages disabling
99a15eb
merwok
merwok reviewed Oct 9, 2024
View reviewed changes
Comment thread Doc/library/site.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@merwok
merwok requested review from encukou and tiran October 9, 2024 14:08
@pppppkun
pythongh-82419 Revise the format of docs
ef8b8cf
@github-actions

github-actions Bot commented Apr 18, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@merwok merwok merwok left review comments
@encukou encukou Awaiting requested review from encukou
@tiran tiran Awaiting requested review from tiran

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting review docs Documentation in the Doc dir skip news stale Stale PR or inactive for long period of time.

Projects

Docs PRs
Status: Todo

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@pppppkun @merwok
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.