nice-florist-55958
03/06/2024, 5:43 PMPYTHONBREAKPOINT=0
?
import os
if __name__ == "__main__":
os.environ['PYTHONBREAKPOINT'] = '0'
print(os.environ['PYTHONBREAKPOINT'])
breakpoint()
print('DONE!')
If I run ths in my IDE, it exits immediately. If I run this with pantsd run proj/app/pybreakpoint_test
I get the debugger. This is true if I set the environment variable before invoking the run as well.nice-florist-55958
03/06/2024, 6:11 PMignore_environment=1
and no_user_site=1
which disables any PYTHON*
settings.
Does Pants support disabling the -E
flag PEX passes to the interpreter?happy-kitchen-89482
03/07/2024, 3:03 AMhappy-kitchen-89482
03/07/2024, 3:03 AM$ cat python_env/breakpoint.py
import os
if __name__ == "__main__":
os.environ['PYTHONBREAKPOINT'] = '0'
print(os.environ['PYTHONBREAKPOINT'])
breakpoint()
print('DONE!')
$ python -m pex -D python_env/ -m breakpoint -o python_env.pex
$ ./python_env.pex
0
DONE!
$
happy-kitchen-89482
03/07/2024, 3:04 AMpants run --keep-sandboxes=always ...
and looking at the command in __run.sh
in the relevant sandbox to see how Pants is invoking Pex here, and use that to figure out which Pex flags are causing this behavior. Then we can figure out if/how to modify.nice-florist-55958
03/08/2024, 1:45 AMrun
goal. Picking the last one from the log messages doesn't seem promising (but certainly looks like the one that tried in invoke the pex_binary
target):
Paraphrasing since it's at work:
./python ./pex_v2.1.34 -tmpdur .tmp --jobs 20 --pip-version xx --cert xx --python-path xx --output-file proj.app.iralpha/iralpha.pex --no-emit-warnings --python-shebang=xx --venv prepend --requirements-pex xx --interpreter-constraint xx --entry-point iralpha.iralpha --sources-directory=source_files --lock xx --no-pypi --index=xx --find-links=xx --manylinux manylinux2014 --layout zipapp
nice-florist-55958
03/08/2024, 1:46 AM-E
is being explicitly set. I do see some references to this option in the PEX codebase though; you're positive you get the same behavior by just ordinarily pex'ing the file w/o Pants?nice-florist-55958
03/08/2024, 1:48 AMbreakpoint()s
make it into some of our less rigorous code and it crashes in production, even with PYTHONBREAKPOINT=0
happy-kitchen-89482
03/08/2024, 1:49 AMhappy-kitchen-89482
03/08/2024, 1:49 AMhappy-kitchen-89482
03/08/2024, 1:49 AMnice-florist-55958
03/08/2024, 2:08 AMhappy-kitchen-89482
03/08/2024, 2:23 AM