Skip to content

Policy for altering sys.path #68323

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

Closed
ThomasGttler mannequin opened this issue May 6, 2015 · 2 comments
Closed

Policy for altering sys.path #68323

ThomasGttler mannequin opened this issue May 6, 2015 · 2 comments

Comments

@ThomasGttler
Copy link
Mannequin

ThomasGttler mannequin commented May 6, 2015

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 = []

@ThomasGttler
Copy link
Mannequin Author

ThomasGttler mannequin commented May 6, 2015

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.

@bitdancer
Copy link
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 :)

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant