1. Is there a way to specify persistent dirname fo...
# general
s
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
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
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
That hash is to prevent pexes colliding with each other, so you can't use a constant.
1
b
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
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
We monkeypatch that code so it works 😛
There's a PR to pydevd to make it work without shenanigans
s
Also, is there a reason why
run
works with
docker_image
, but
repl
just runs the underlying pex without containerization?
b
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
What code do you monkeypatch exactly?
b
If the server root is
.
We replace it with the pants sandbox root so it "just works"
s
Ah I see
b
https://github.com/fabioz/PyDev.Debugger/pull/243 is th eupstream PR. Just waiting for approval
👍 1