https://pantsbuild.org/ logo
#general
Title
# general
s

steep-match-53634

01/16/2023, 11:16 PM
3. Is there a way to specify persistent dirname for the unzipped pex? I need it for instance for code mapping for remote debugging. I know it's
$PEX_ROOT/unzipped_pexes/<some hash>
, and I can technically search the archive for the exact name, but it will be easier to just have it as a constant.
b

broad-processor-92400

01/17/2023, 3:38 AM
I'm not sure this is exactly going to help, but are you aware of the
export
goal: https://www.pantsbuild.org/docs/setting-up-an-ide#python-third-party-dependencies-and-tools ?
s

steep-match-53634

01/17/2023, 8:01 AM
It only creates a venv with all the deps that allows completion and jump to the deps' sources. I'm talking about the name of the directory that is created when a pex runs, where all the code gets unzipped to. When debugging remotely, Debuger Adapter Protocol needs to know the path to your source root on the host to match your local code to the one that is being run remotely. The whole setup is much more easier when you know the source root path in advance, and I don't think that the hash that is generated by default has any meaning, so I thought I can replace it with something constant
h

happy-kitchen-89482

01/17/2023, 12:41 PM
That hash is to prevent pexes colliding with each other, so you can't use a constant.
1
b

bitter-ability-32190

01/17/2023, 1:47 PM
You also may have missed it but the
run
and
test
goals have a
--debug-adapter
flag which launches the DAP server and waits for connections. Pants 2.15 just got a bunch of bugfixes for it, and will be released soon.
s

steep-match-53634

01/17/2023, 2:03 PM
I updated to v2.15rc1 today, but I did use it before when debugging a plugin I wrote. The
--debug-adapter
unfortunately isn't implemented for
docker_image
target though. Also, I'm not sure how it would help - I think the one who sends the local:remote code mapping is the client, not the server (because only client can know the local part of the mapping), So the client will still be in situation where it needs to know the hash for the pex
b

bitter-ability-32190

01/17/2023, 2:03 PM
We monkeypatch that code so it works 😛
There's a PR to pydevd to make it work without shenanigans
s

steep-match-53634

01/17/2023, 2:04 PM
Also, is there a reason why
run
works with
docker_image
, but
repl
just runs the underlying pex without containerization?
b

bitter-ability-32190

01/17/2023, 2:04 PM
So you're familiar with my blog post, in it we tell PEX to install the PEX as a venv at a location. If you do that you can have a static known path in the image
👍 1
🤷‍♂️ I know little about docker, in general. Feel free to try and find an issue, and if none exists file one.
👍 1
s

steep-match-53634

01/17/2023, 2:08 PM
What code do you monkeypatch exactly?
b

bitter-ability-32190

01/17/2023, 2:15 PM
If the server root is
.
We replace it with the pants sandbox root so it "just works"
s

steep-match-53634

01/17/2023, 4:19 PM
Ah I see
b

bitter-ability-32190

01/17/2023, 4:20 PM
https://github.com/fabioz/PyDev.Debugger/pull/243 is th eupstream PR. Just waiting for approval
👍 1
3 Views