-
-
Notifications
You must be signed in to change notification settings - Fork 292
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
Relocate environment variable injection to before the interpreter is run #2260
Relocate environment variable injection to before the interpreter is run #2260
Conversation
@erikwilliamson thanks for working on this. Please add a test to prove this works. You likely can just pile in the original PR test: https://github.com/pantsbuild/pex/pull/1948/files#diff-2b86577053b9bb459d54416c397bf7d1fa598becf7a5cc9e856290fb0427881e You can then |
@jsirois I'm sorry that this is taking me so long. I'm having trouble getting any tests to run successfully, even from the main branch. I'm totally new to Tox, too which isn't speeding things up. I'm getting the following when running dtox.sh:
And while I know what this means, I'm not sure what the appropriate fix is - should I create a separate user and a different group for it to be in on my dev machine? |
This is the script that's failing: https://github.com/pantsbuild/pex/blob/main/docker/user/create_docker_image_user.sh It runs in the context of building a docker image via: https://github.com/pantsbuild/pex/blob/a43c48c2a4b18b352be2c3175e0ae363ff8876d7/docker/user/Dockerfile#L4-L11 And those Dockerfile ARGs are fed here: https://github.com/pantsbuild/pex/blob/a43c48c2a4b18b352be2c3175e0ae363ff8876d7/dtox.sh#L41-L51 So, if you want to mess around and get that working for you, have at it. That said, using I'll continue to be out of country and AFK through November 2nd. Hopefully you've found success by then, but, if not, I'll check back in. |
@erikwilliamson I wanted to check in and make sure you had what you needed to run |
Hey, I tried to join the Pants/Pex Slack but after filling out the questionnaire it's saying that the link has expired - I wondered if Slack might be a good place for me to ask a few questions rather than here. I'm able to run the tests no problem; however knowing whether the failures are valid now or if the tests need to be altered is perplexing :-) |
I'm not a part of the Pants slack. Since you now can run tests, if you can run tox |
Learning as I go here! I saw that that there's pex/venv/installer.py which had environment variable injection happening. Tests are passing for me now - Thanks for your patience and I look forward to your thoughts. |
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.
@erikwilliamson this LGTM mod commented out tests. I'll let CI fly, but please circle back to get those un-commented / updated to work with this change.
For the formatting shard, |
I'm getting this on OSX 14.1 - I can fire up a linux VM to make it go away in the meantime though Typechecking 338 files using Python 3.11.6 against Python 3.12 ... |
@erikwilliamson if that's the only error, you should be good to go since it was only the format check that failed in CI (https://github.com/pantsbuild/pex/actions/runs/6776741887/job/18420675544?pr=2260#step:4:160) and not the type check. ... and I <3 macOS. |
soon I'll believe you 😂 |
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 @erikwilliamson, this looks good with two small fixes.
assert {"args": ["foo", "bar"], "MESSAGE": None} == json.loads( | ||
# Switching away from the built-in entrypoint should disable injected args but not the en env. | ||
assert {"args": ["foo", "bar"], "MESSAGE": "Hello, world!"} == json.loads( | ||
# assert {"MESSAGE": "Hello, world!"} == json.loads( |
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.
Kill this commented out line.
@@ -240,8 +240,9 @@ def assert_message( | |||
assert_message(b"Hello, world!") | |||
assert_message(b"42", MESSAGE="42") | |||
|
|||
# Switching away from the built-in entrypoint should disable injected args and env. | |||
assert {"args": ["foo", "bar"], "MESSAGE": None} == json.loads( | |||
# Switching away from the built-in entrypoint should disable injected args but not the en env. |
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.
Fix the typo at the end of the sentence. Should be: ... not the env.
…T is defined and run
Alright @erikwilliamson this is now available in Pex 2.1.151:
Thanks for your contribution. |
Thanks so much for guiding me, @jsirois ! Your help and patience were greatly appreciated. |
As per #2224