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 — site.py reporting user site info even if ENABLE_USER_SITE=False · Issue #82419 · python/cpython

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

New issue
Copy link
New issue
Copy link
Open
Open
site.py reporting user site info even if ENABLE_USER_SITE=False#82419
Copy link
Labels
3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.12only security fixesonly security fixesdocsDocumentation in the Doc dirDocumentation in the Doc direasystdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory

Description

bjmuld
mannequin
opened on Sep 20, 2019
Issue body actions
BPO 38238
Nosy @tiran, @bjmuld
PRs
  • bpo-38238: site.py report user paths contingent on ENABLE_USER_SITE #16303
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2019-09-20.19:34:35.686>
    labels = ['3.7', 'type-bug', 'library']
    title = 'site.py reporting user site info even if ENABLE_USER_SITE=False'
    updated_at = <Date 2019-09-23.10:58:24.685>
    user = 'https://github.com/bjmuld'

    bugs.python.org fields:

    activity = <Date 2019-09-23.10:58:24.685>
    actor = 'christian.heimes'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2019-09-20.19:34:35.686>
    creator = 'bjmuld'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38238
    keywords = ['patch']
    message_count = 2.0
    messages = ['352884', '353008']
    nosy_count = 2.0
    nosy_names = ['christian.heimes', 'bjmuld']
    pr_nums = ['16303']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue38238'
    versions = ['Python 3.7']

    Linked PRs

    • gh-82419: improve doc for ENABLE_USER_SITE #121684
    • gh-82419: Improve site docs to clarify user site-packages disabling #125083

    Activity

    1. bjmuld commented on Sep 20, 2019

      @bjmuld
      bjmuldmannequin
      on Sep 20, 2019
      MannequinAuthor
      More actions

      site info is accessed externally via getusersitepackages() and getuserbase()... for example see "pip/_internal/locations.py"

      If ENABLE_USER_SITE is set to "False," or otherwise disabled,
      accesses to these methods should return '' or None (shouldn't they?).

      Currently, I have ENABLE_USER_SITE globally disabled (by various means), but pip's call to getusersitepackages() is still returning "~/.local/lib/...".

      This seems wrong. An alternative would be for external tools to manually import site.ENABLE_USER_SITE, but this seems incorrect.

    2. bjmuld
      added
      3.7 (EOL)end of lifeend of life
      stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
      on Sep 20, 2019
    3. tiran commented on Sep 23, 2019

      @tiran
      tiran
      on Sep 23, 2019
      Member
      More actions

      getusersitepackages() and getuserbase() don't take ENABLE_USER_SITE into account. The function simply return the location of the user site-package directory independently of the value of ENABLE_USER_SITE. The check for ENABLE_USER_SITE and modification of sys.path occurs later. The design allows applications to get the hypothetical path for user site-packages independently from the ENABLE_USER_SITE flag.

      The API is mature, old, and around since Python 2.6. We can't change it without breaking backwards compatibility.

    4. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    5. merwok
      added
      docsDocumentation in the Doc dirDocumentation in the Doc dir
      3.11only security fixesonly security fixes
      3.10 (EOL)end of lifeend of life
      3.12only security fixesonly security fixes
      easy
      and removed
      type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
      3.7 (EOL)end of lifeend of life
      on Feb 26, 2023
    6. merwok commented on Feb 26, 2023

      @merwok
      merwok
      on Feb 26, 2023
      Member
      More actions

      I would review a patch to clarify the docs about this.

    7. pelson commented on Jul 27, 2023

      @pelson
      pelson
      on Jul 27, 2023
      Contributor
      More actions

      Just to say that, as a result of #107344, with Python 3.11+, even if you set the ENABLE_USER_SITE variable to False in site.py, it doesn't disable user site-packages (this is because Python no longer reads site.py at runtime, and rather falls back to the frozen version of site.py found at build-time).

    8. damngamerz commented on Jul 13, 2024

      @damngamerz
      damngamerz
      on Jul 13, 2024
      Contributor
      More actions

      Hi I would like to try this one.

    9. encukou commented on Aug 1, 2024

      @encukou
      encukou
      on Aug 1, 2024
      Member
      More actions

      Changing site.py file won't work (unless you recompile Python), but administrators should still be able to set site.ENABLE_USER_SITE in a sitecustomize module.

      The documentation could be changed to:

      • lead users to create sitecustomize.py or usercustomize.py, rather than try to edit site.py, and
      • mention that getusersitepackages() and getuserbase() return the relevant locations even if they are not added to sys.path.
    10. pppppkun commented on Oct 8, 2024

      @pppppkun
      pppppkun
      on Oct 8, 2024
      More actions

      I want to try to fix the document.

    11. pppppkun
      added 3 commits that reference this issue on Oct 8, 2024

      pythongh-82419 Refactor site.rst to clarify user site-packages disabling

      afd431d

      pythongh-82419 Revised the site docs about user site-packages disabling

      99a15eb

      pythongh-82419 Revise the format of docs

      ef8b8cf
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.12only security fixesonly security fixesdocsDocumentation in the Doc dirDocumentation in the Doc direasystdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions

        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.