`./pants export ::` only supports exporting all re...
# general
./pants export ::
only supports exporting all resolves, I suggest that
./pants freeze --resolve=xyz
should be supported. As a alternative, we can implement
in the following way: https://github.com/da-tubi/pants-minimal-freeze
https://github.com/pantsbuild/pants/issues/17398 It seems that Pants 2.15 will introduce selective exports!
Well, even with selective exports, I still need the feature of exporting to a specific virtual environtment.
I use pyenv, And I found pyenv managed virtual environments works well with Intellij Idea and VSCode
./pants export
generate virtualenvs that can be used in VSCode?
i'm already using exported venvs for VSCode, Vim CoC, etc. without any problem..
But for VSCode Jupyter Plugin, the exported virtualenv does not work!
And for PyCharm, it is not very convenient to locate the exported virtual environment.
For VSCode, there a setting: https://github.com/da-tubi/pants-minimal-freeze/blob/main/.vscode/settings.json
With the setting, I do not need to select the python interpreter manually.
hmm.. i have no experience with VSCode Jupyter plugin yet..
maybe it has a separate interpreter path setting
sometimes the interpreter path must be an absolute path instead of a relative path starting with "dist/export/...", even depending on which Python tool you use
so I always set the interpreter/tool paths using absolute ones
Hi @bored-energy-25252, can you clarify what you mean by “exporting to a specific virtual environment”? As @rhythmic-morning-87313 pointed out, Pants 2.15 will have the
flag on
, exactly as you suggested
by “exporting to a specific virtual environment”
It means, exporting to a virtual environment managed by pyenv or conda.
can only export to a fixed path virtualenv.
So “export” to an already existing virtualenv?
Yeah today Pants creates a virtualenv
So “export” to an already existing virtualenv?
That might be tricky
So, I suggest there should be a
pip freeze
equiv in pants.
Which would emit a requirements.txt or something like that?
We already have the lockfile, so we could convert that to something pip can ingest
We already have the lockfile, so we could convert that to something pip can ingest
A good idea!
Is there any spec on the lock file? It would be nice to have a tool like
. And one could use
lock install xxx.lock
to install the dependencies in the lockfile.
Like PEX, the spec for lockfile could be independent from pants.
The spec for lockfile is part of PEX actually. It’s just JSON. Pants adds some front matter.
👍 1
pex --lock 3rdparty/python/default.lock
, it does not work well with the pants-generated lockfile.
Copy code
pex.resolve.lockfile.json_codec.ParseError: The lock file at 3rdparty/python/default.lock does not contain valid JSON: Expecting value: line 1 column 1 (char 0)
Do you think
pex --freeze 3rdparty/python/default.lock
pex --freeze xyz.pex
is a good idea?
pex --freeze
available, we can
Copy code
pip install `pex --freeze xyz.lock`
to install the necessary dependencies in a created virtualenv. Further more,
pex --export xyz.lock
should be a better command to replace `pip install `pex --freeze xyz.lock``
Copy code
pex3 lock export 3rdparty/bark.lock
Thanks! It is in PEX3. Now I just need some commandlinefu to strip the leading part of the lockfile generated by pants!
👀 1
Hey @bored-energy-25252, just checking if you’ve had any luck with this, or do you want/need to open a feature request ticket for it?
Let me open a feature request ticket for pants.
See https://github.com/pantsbuild/pants/issues/15940 there is already a issue. Let me comment there.