plain-carpet-73994
04/28/2021, 9:49 PMvenv
but I think that can't be done from within Pants, right?hundreds-father-404
04/28/2021, 9:52 PMhundreds-father-404
04/28/2021, 9:53 PMwas hoping to have a task that creates and populates a venvHave you used Pex before? Note that Pex now has support for acting like a venv - upon the first execution, it will extract itself into a venv and all subsequent runs will have ~no overhead. https://www.pantsbuild.org/docs/reference-pex_binary#codeexecution_modecode
plain-carpet-73994
04/28/2021, 10:21 PMplain-carpet-73994
04/28/2021, 10:22 PMvenv
for the whole repo that I can point my IDE at (vim language server) so it can resolve symbols for me.
2. Install the deps into the venv
so I can pip freeze
that.
I don't think .pex is a good fit for either of those, right?hundreds-father-404
04/28/2021, 10:23 PMplain-carpet-73994
04/28/2021, 10:34 PMpants venv
or pants requirements
plain-carpet-73994
04/28/2021, 10:34 PMhundreds-father-404
04/28/2021, 10:35 PMJust thought it'd be more user friendly to be able to do something like pants venvStrong agreement. We're starting work soon to support multiple constraints files in a repo, and part of that will involve Pants generating constraints files for you. Possibly creating the venv too for the sake of IDEs. That bash script is not where we want to end up
plain-carpet-73994
04/28/2021, 10:39 PMhundreds-father-404
04/28/2021, 10:42 PMdist/
folder, which is what ./pants package
does
If you want to write outside the build root, atm you would need a subprocess to do that via Process
. (Probably not relevant to you, but note that doing that would not be safe with Remote Execution - if the remote worker wrote to some global directory via a Process
, it would mutate the remote worker, but not your local machine)plain-carpet-73994
04/28/2021, 10:55 PMplain-carpet-73994
04/28/2021, 11:07 PMmain.py
) and a BUILD file with a single pex_binary
target. That won't run - it exits with a ModuleNotFoundError
. If I unzip the .pex file indeed none of my code is there.
however, if I add an otherwise empty python_library
rule to that BUILD file and do nothing else now it works.
'sup with that?hundreds-father-404
04/28/2021, 11:09 PMpython_library
to teach Pants your code exists. Then, if you set up your entry_point
for the pex_binary
to be in the format main.py
, Pants can use dependency inference to figure out which code you're using
pex_binary
does not have any sources
, it can only depend on other targetsplain-carpet-73994
04/28/2021, 11:10 PMhundreds-father-404
04/28/2021, 11:10 PM./pants tailor
(in a clean git state) https://www.pantsbuild.org/docs/create-initial-build-filesplain-carpet-73994
04/28/2021, 11:11 PMpython_library
was needed.