Skip to content

Policy for altering sys.path #68323

Closed
Closed

Description

@ThomasGttler
BPO 24135
Nosy @bitdancer

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 = <Date 2015-05-06.13:22:15.320>
created_at = <Date 2015-05-06.13:03:53.199>
labels = ['invalid']
title = 'Policy for altering sys.path'
updated_at = <Date 2015-05-06.13:22:15.318>
user = 'https://bugs.python.org/ThomasGttler'

bugs.python.org fields:

activity = <Date 2015-05-06.13:22:15.318>
actor = 'r.david.murray'
assignee = 'none'
closed = True
closed_date = <Date 2015-05-06.13:22:15.320>
closer = 'r.david.murray'
components = []
creation = <Date 2015-05-06.13:03:53.199>
creator = 'Thomas G\xc3\xbcttler'
dependencies = []
files = []
hgrepos = []
issue_num = 24135
keywords = []
message_count = 2.0
messages = ['242664', '242671']
nosy_count = 2.0
nosy_names = ['r.david.murray', 'Thomas G\xc3\xbcttler']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue24135'
versions = []

Activity

  1. ThomasGttler commented on May 6, 2015

    ThomasGttlermannequin
    MannequinAuthor

    I am missing a policy how sys.path should be altered.

    We run a custom sub class of list in sys.path. We set it in sitecustomize.py

    This instance get replace by a common list in lines like this:

    sys.path = glob.glob(os.path.join(WHEEL_DIR, "*.whl")) + sys.path

    The above line is from pip, it similar things happen in a lot of packages.

    Before trying to solve this with code, I think the python community should agree an a policy for altering sys.path.

    What can I do to this done?

    We use Python 2.7.

  2. bitdancer commented on May 6, 2015

    @bitdancer
    Member

    My guess, unfortunately, is give up. There is too much code in the field that replaces sys.path with a regular list. What you propose is effectively an impossible social engineering problem. You may well also run into issues where the Python C code calls list methods directly even if sys.path is a subclass of list. (I don't know that that is true, but there are certainly places where the C code does that kind of thing).

    Could you get consensus to change stdlib and pip practice? That's at least conceivable. I guess python-ideas would be the place to start for that. I'm going to close the issue, since this would be a PEP level change if you are successful. (Frankly, I don't think you are likely to be successful, but I don't hang out on python-ideas so I might be wrong :)

  3. transferred this issue fromon Apr 10, 2022
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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions