enough-advantage-61561
08/11/2023, 10:46 AMpants
manages its own virtual environments, how do you debug your python code? I have used to just installing the app + needed libraries in a venv, running ipython
and importing the code I'm working on. Can you somehow run
pants python somescript.py
?enough-advantage-61561
08/11/2023, 10:49 AMvenv
as you normally would, and debug here
2. deactivate venv
3. run pants
commands
4. activate venv
again
?refined-addition-53644
08/11/2023, 10:56 AMrequirements.txt
or pyprojec.toml
. You should check
https://www.pantsbuild.org/docs/python-third-party-dependenciesbitter-ability-32190
08/11/2023, 10:59 AMbitter-ability-32190
08/11/2023, 10:59 AMenough-advantage-61561
08/11/2023, 10:59 AMbitter-ability-32190
08/11/2023, 11:00 AMpdb
is an option too when running your codebitter-ability-32190
08/11/2023, 11:00 AMtest
also has the --debug-adaptor flagenough-advantage-61561
08/11/2023, 11:01 AMimport pdb; pdb.set_tracet()
into the source code or running pants equivalent of
python -m pdb something.py
like (something like pants run --pdb something.py) ?bitter-ability-32190
08/11/2023, 11:02 AMbitter-ability-32190
08/11/2023, 11:02 AMbreakpoint()
when's toobitter-ability-32190
08/11/2023, 11:03 AMenough-advantage-61561
08/11/2023, 11:03 AMbreakpoint()
with PYTHONBREAKPOINT=IPython.embed
so I guess that would work similarlybitter-ability-32190
08/11/2023, 11:03 AMpdb.set_trace
I Believeenough-advantage-61561
08/11/2023, 11:03 AMbitter-ability-32190
08/11/2023, 11:04 AM