Hi all, I'm currently using the environment create...
# general
p
Hi all, I'm currently using the environment created by
./pants export ::
but noticed that it is a symlink to the pants cache. In my CI pipeline I need a venv that also includes my own package, so I install it into the exported venv using
pip install -e .
. However this causes other builds to break, since I'm touching the same venv from multiple builds. Is there any easy way to do one of the following: • Get an independent copy of this venv (not a symlink to the cache) • Get a venv that includes my package along with the 3rd party dependencies Thanks!
c
Hi Dimitrios, Not my area of expertise, but perhaps if you can package your code up as a pex binary, you can then “install” that into a venv on disk as needed, which would include your first-party code along with all your 3rdparty requirements.
Perhaps draw inspiration of how this can be done by looking at this hint: https://pex.readthedocs.io/en/latest/recipes.html#pex-app-in-a-container ignore the bit about it being for container use.
so, without the
scope
option on the pex invocation, I think you’d end up with both (a complete venv) in one go.
p
Hi Andreas, thanks for the answer. I can't seem to make out how to configure a pex binary from the link you sent about
__defaults____
. Could you elaborate just a bit more how you mean that? I'll read about pex binaries a bit more, I haven't used them till now, and I'm a bit overwhelmed coming from the simpler venv world...
c
Yeah, sorry about that, it was the wrong link, I’ve replaced it with the correct one.
p
That makes more sense 🙂 I think that's the right direction, thanks again!
c
Great. And within a few hours, there’ll be some experts around to help give better answers too 🙂
👍 1
h
Which version of Pants are you on? From (I think) 2.11, export will create isolated venvs that aren't symlinks
👍 1
p
@happy-kitchen-89482 thanks, I'll look into it, I'm one version behind, currently on 2.10.0.