When I use `pants export` it exports a venv plus a...
# general
n
When I use
pants export
it exports a venv plus all my tools too. Is there a way to choose which tools get exported? Or rather, to not export the tools and only export a venv with all 3rd party dependencies.
c
The
--resolve
option allows you to specify which resolve(s) you want to export: https://www.pantsbuild.org/docs/reference-export#resolve
b
pants help export
can help you find out what's available (pun intended)
c
also
pants help-advanced <thing>
to get the full picture as some options are “hidden” from the basic listing..
h
Which Pants version are you on? This has changed recently
But yeah, on 2.18
--resolve
will let you select the lockfiles to export, and tool lockfiles are no longer a special thing but just regular named lockfiles that the tool config points to
n
We're 2.17. I'm not sure what the resolve options should be. But if I give it with a target I get an error.
Copy code
❯ pants export --resolve='python-default' development_libs:frontend
...
raise ExportError("If using the `--resolve` option, do not also provide target specs.")
pants.core.goals.export.ExportError: If using the `--resolve` option, do not also provide target specs.
If I don't specify a target I get this different error
Copy code
❯ pants export --resolve='python-default'
result = yield self
native_engine.IntrinsicError: Unmatched glob from the resolve `python-default`: "3rdparty/python/default.lock"
In the docs it says to use
--export-resolve="['<str>', '<str>', ...]"
, but this gets the same errors.
I've just tried using the resolve of a specific tool, and that works, but what I want in the main venv with all the 3rd party dependencies from the target I gave.
c
for 2.17, you have per tool options to opt out of export: https://www.pantsbuild.org/v2.17/docs/reference-black#export
n
Thanks. Curious then, what's the 2.18 syntax for exporting the 3rd party deps of a target without exporting all the tools?
c
the change is that all tools also use regular lockfiles (resolves) so behaves the same as your 3rd party deps, i.e. using the
--export-resolve
option.
n
but if I don't care about the tools, and what I want is a venv that contains 3rd party deps for the target I am working on, will I need to generate a static lockfile per target?
c
typically you don’t have the tools in the same lockfile as your 3rd party deps, so you can export the env for just your deps without any tools deps in there…
n
ah, i see. thanks.
c
h
That `Unmatched glob from the resolve `python-default`: "3rdparty/python/default.lock"` sounds like you haven't actually generated that lockfile?