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 — [3.8] bpo-41376: Fix the documentation of `site.getusersitepackages()` (GH-21602) by miss-islington · Pull Request #22592 · python/cpython

Conversation

@miss-islington

@miss-islington miss-islington commented Oct 8, 2020 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

site.getusersitepackages() returns the location of the user-specific site-packages directory
even when the user-specific site-packages is disabled.

$ python -s -m site
sys.path = [
    '/home/user/conda/lib/python37.zip',
    '/home/user/conda/lib/python3.7',
    '/home/user/conda/lib/python3.7/lib-dynload',
    '/home/user/conda/lib/python3.7/site-packages',
]
USER_BASE: '/home/user/.local' (exists)
USER_SITE: '/home/user/.local/lib/python3.7/site-packages' (doesn't exist)
ENABLE_USER_SITE: False

It was not practical to prevent the function from returning None if user-specific site-packages are disabled, since there are other uses of the function which are relying on this behaviour (e.g. python -m site).
(cherry picked from commit 35f041d)

Co-authored-by: Phil Elson [email protected]

https://bugs.python.org/issue41376

Sorry, something went wrong.

Uh oh!

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

All reactions
@pelson @miss-islington
bpo-41376: Fix the documentation of site.getusersitepackages() (pyt…
a4bd1a9
…honGH-21602)

`site.getusersitepackages()` returns the location of the user-specific site-packages directory
even when the user-specific site-packages is disabled.

```
$ python -s -m site
sys.path = [
    '/home/user/conda/lib/python37.zip',
    '/home/user/conda/lib/python3.7',
    '/home/user/conda/lib/python3.7/lib-dynload',
    '/home/user/conda/lib/python3.7/site-packages',
]
USER_BASE: '/home/user/.local' (exists)
USER_SITE: '/home/user/.local/lib/python3.7/site-packages' (doesn't exist)
ENABLE_USER_SITE: False
```

It was not practical to prevent the function from returning None if user-specific site-packages are disabled, since there are other uses of the function which are relying on this behaviour (e.g. `python -m site`).
(cherry picked from commit 35f041d)

Co-authored-by: Phil Elson <[email protected]>
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Oct 8, 2020
@bedevere-bot bedevere-bot mentioned this pull request Oct 8, 2020
bpo-41376: Correct the documentation on site.getusersitepackages() regarding respecting PYTHONNOUSERSITE #21602
Merged
@bedevere-bot bedevere-bot added skip news docs Documentation in the Doc dir awaiting review labels Oct 8, 2020
methane
methane approved these changes Oct 8, 2020
View reviewed changes
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting review labels Oct 8, 2020
@pablogsal
pablogsal merged commit 1006f63 into python:3.8 Oct 11, 2020
@bedevere-bot bedevere-bot removed the awaiting merge label Oct 11, 2020
@miss-islington
miss-islington deleted the backport-35f041d-3.8 branch October 11, 2020 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@methane methane methane approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

docs Documentation in the Doc dir skip news

Projects

None yet

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.

6 participants

@miss-islington @methane @pablogsal @the-knights-who-say-ni @bedevere-bot @pelson
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.