-
-
Notifications
You must be signed in to change notification settings - Fork 267
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
Include PYTHONPATH
in --inherit-path
logic.
#765
Include PYTHONPATH
in --inherit-path
logic.
#765
Conversation
Previously Pex would inherit `PYTHONPATH` by default despite the default `--inherit-path` setting being false. This was buggy behavior running against the primary Pex goal of providing an isolated execution environment. Now, to use PYTHONPATH to ammend the `sys.path` of a running is accomplished by either of: ``` PEX_INHERIT_PATH=prefer PYTHONPATH=... ./my.pex PEX_INHERIT_PATH=fallback PYTHONPATH=... ./my.pex ``` Update corresponding settings documentation and fix pex to consider PYTHONPATH when adjusting sys.path. Fixes pex-tool#707
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.
Thanks!
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.
Thanks John for fixing this! Looks good.
return pex_info | ||
|
||
def assert_isolation(self, inherit_path, expected_output): | ||
env = dict(PYTHONPATH=self.pythonpath) |
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.
Nit: collection literal preferred, per Pants style guide. Not worth losing sleep over or fixing retroactively, though.
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.
Hrm, that definitely is not the style guide used in PEX today.String interpolation doesn't even apply for example due to PEX supporting 2.7. Even if it did though, this one I might have wanted to debate a little. For dicts in particular, dict can be viewed as nicer than a literal since the kwarg form used here puts sane restrictions on env var keys as well as making them appropriately "pop out" visually in syntax highlighters. Thats why I tend to use it for env dicts anyhow.
Previously Pex would inherit
PYTHONPATH
by default despite the default--inherit-path
setting being false. This was buggy behavior runningagainst the primary Pex goal of providing an isolated execution
environment. Now, to use PYTHONPATH to amend the
sys.path
of arunning is accomplished by either of:
Update corresponding settings documentation and fix pex to consider
PYTHONPATH when adjusting sys.path.
Fixes #707