hundreds-father-404
02/09/2022, 12:02 AMpython -m venv
, and simply go with ./pants export
? NB that I'll make a code change so export
can handle mutliple resolves. https://www.pantsbuild.org/v2.10/docs/setting-up-an-ide#third-party-dependencies-pythonhundreds-father-404
02/09/2022, 12:12 AMexport
to be simpler...rather than ::
, have it be something like ./pants export --python-export-resolve=foo
But I'll do the current specs-based approach for now. We already have code from ./pants repl
for how to handle multiple resolves, which I'm takinghundreds-father-404
02/09/2022, 12:17 AM./pants export ::
creates N venvs, depending on # of resolves? We don't have InteractiveProcess
here, we can partition ourselves unlike repl
It does require reworking the API of export
to accommodate multiple folders, but we need that anywayswitty-crayon-22786
02/09/2022, 12:18 AMrepl
and export
will be importantwitty-crayon-22786
02/09/2022, 12:18 AMhundreds-father-404
02/09/2022, 12:19 AMrepl
other than "Run this command to run on a subset"
export
is easy for us to create multiple venvs, no fundamental restriction. only time to implement. That is much more ergonomic than what I wrote in new docs
If you are using [multiple "resolves"](doc:python-third-party-dependencies),will error with instructions to choose which resolve to create the virtual env for. You can repeat this for each resolve to set up separate IDE modules for each.export ::
witty-crayon-22786
02/09/2022, 12:19 AMrepl
and export
, there is a specific choice to be made, i think.witty-crayon-22786
02/09/2022, 12:19 AMwitty-crayon-22786
02/09/2022, 12:20 AMwitty-crayon-22786
02/09/2022, 12:20 AMhundreds-father-404
02/09/2022, 12:20 AMhundreds-father-404
02/09/2022, 12:20 AMwitty-crayon-22786
02/09/2022, 12:21 AMhappy-kitchen-89482
02/09/2022, 1:05 AMpython -m venv
bit from the docs, yeshundreds-father-404
02/09/2022, 1:12 AMexport
should do with multiple resolves?
Another way of asking you that: you wrote about "to set up separate IDE modules for each." Do you know if that's actually possible?hundreds-father-404
02/09/2022, 7:06 PMexport
should handle multiple resolves:
• ./pants export ::
creates 1 venv for each resolve. User can then point their IDE to whichever they want at the moment.
• This requires renaming dist/virtualenv
to instead mention the resolve name...tbd how
• Stu pointed out a downside is you may be doing more work than necessary, if you don't use some resolves. We considered instead eagerly erroring if >1 resolve is detected, and giving an error message like https://github.com/pantsbuild/pants/pull/14327.
• Ultimately, we think doing the simplest and most correct thing is probably worth it, even if a bit slower. We can make it clear in docs how to generate for only one resolve
Wdyt? This blocks 2.10 stabilizationhappy-kitchen-89482
02/09/2022, 8:03 PMwitty-crayon-22786
02/09/2022, 8:03 PMhappy-kitchen-89482
02/09/2022, 8:04 PMhundreds-father-404
02/09/2022, 8:05 PMhundreds-father-404
02/09/2022, 8:42 PMlen([python].resolves) == 1
, stick with dist/virtualenv
• else, dist/virtualenvs/my-resolve
, dist/virtualenvs/another-resolve
Key insight is your point: "do the simple thing for 80% of users who don't need multiple resolves".
This assumes that we will not have dedicated tool venvs, per https://pantsbuild.slack.com/archives/C0D7TNJHL/p1644397600652729. Not sure that's correct..happy-kitchen-89482
02/09/2022, 10:19 PMhappy-kitchen-89482
02/09/2022, 10:19 PMhappy-kitchen-89482
02/09/2022, 10:19 PMhundreds-father-404
02/09/2022, 10:19 PMpython-default
, so it would be dist/virtualenvs/python-default/
rather than dist/virtualenv/
happy-kitchen-89482
02/09/2022, 10:20 PMhappy-kitchen-89482
02/09/2022, 10:20 PMhappy-kitchen-89482
02/09/2022, 10:21 PMhundreds-father-404
02/09/2022, 10:21 PMhappy-kitchen-89482
02/09/2022, 10:25 PMhundreds-father-404
02/09/2022, 10:28 PM./pants export ::
after the upgrade, PyCharm will keep using your old venv without you realizing that you need to go into IDE settings and update things.
We could have a compromise where we scan dist/
folder to see if dist/virtulenv/
is there already, and if so log an ERROR or WARNING message that you must update your IDE. Wdyt?hundreds-father-404
02/09/2022, 10:28 PMhappy-kitchen-89482
02/09/2022, 11:20 PMhundreds-father-404
02/10/2022, 12:57 AM[python].resolves_to_interpreter_constraints
. The benefit of doing that is that you're less likely to have churn when running on ./pants export dir1::
vs `./pants export dir::2`; it's possible for targets to be a subset of resolve's ICs, e.g. ==3.8
vs >=3.7,<3.10
happy-kitchen-89482
02/10/2022, 1:32 AMhappy-kitchen-89482
02/10/2022, 1:33 AMhappy-kitchen-89482
02/10/2022, 1:33 AM