export
pants export [args]
Export Pants data for use in other tools, such as IDEs.
Backend: pants.core
Config section: [export]
Basic options
py_resolve_format
--export-py-resolve-format=<PythonResolveExportFormat>
PANTS_EXPORT_PY_RESOLVE_FORMAT
[export]
py_resolve_format = <PythonResolveExportFormat>
mutable_virtualenv, symlinked_immutable_virtualenv
default:
mutable_virtualenv
Export Python resolves using this format. Options are:
mutable_virtualenv
: Export a standalone mutable virtualenv that you can further modify.symlinked_immutable_virtualenv
: Export a symlink into a cached Python virtualenv. This virtualenv will have no pip binary, and will be immutable. Any attempt to modify it will corrupt the cache! It may, however, take significantly less time to export than a standalone, mutable virtualenv.
resolve
--export-resolve="['<str>', '<str>', ...]"
PANTS_EXPORT_RESOLVE
[export]
resolve = [
'<str>',
'<str>',
...,
]
[]
Export the specified resolve(s). The export format is backend-specific, e.g., Python resolves are exported as virtualenvs.
Advanced options
py_editable_in_resolve
--export-py-editable-in-resolve="['<str>', '<str>', ...]"
PANTS_EXPORT_PY_EDITABLE_IN_RESOLVE
[export]
py_editable_in_resolve = [
'<str>',
'<str>',
...,
]
[]
When exporting a mutable virtualenv for a resolve, do PEP-660 editable installs of all python_distribution
targets that own code in the exported resolve.
If a resolve name is not in this list, python_distribution
targets will not be installed in the virtualenv. This defaults to an empty list for backwards compatibility and to prevent unnecessary work to generate and install the PEP-660 editable wheels.
This only applies when [python].enable_resolves
is true and when exporting a mutable_virtualenv
(symlinked_immutable_virtualenv
exports are not "full" virtualenvs because they must not be edited, and do not include pip
).
py_generated_sources_in_resolve
--export-py-generated-sources-in-resolve="['<str>', '<str>', ...]"
PANTS_EXPORT_PY_GENERATED_SOURCES_IN_RESOLVE
[export]
py_generated_sources_in_resolve = [
'<str>',
'<str>',
...,
]
[]
When exporting a mutable virtualenv for a resolve listed in this option, generate sources which result from code generation (for example, the protobuf_sources
and thrift_sources
target types) into the mutable virtualenv exported for that resolve. Generated sources will be placed in the appropriate location within the site-packages directory of the mutable virtualenv.
py_non_hermetic_scripts_in_resolve
--export-py-non-hermetic-scripts-in-resolve="['<str>', '<str>', ...]"
PANTS_EXPORT_PY_NON_HERMETIC_SCRIPTS_IN_RESOLVE
[export]
py_non_hermetic_scripts_in_resolve = [
'<str>',
'<str>',
...,
]
[]
When exporting a mutable virtualenv for a resolve listed in this option, by default console script shebang lines will be made "hermetic". Specifically, the shebang of hermetic console scripts will uses the python args -sE
where:
-s
skips inclusion of the user site-packages directory,-E
ignores allPYTHON*
env vars likePYTHONPATH
.
If you need "non-hermetic" scripts for a partcular resolve, then add that resolve's name to this option. This will allow simple python shebangs that respect vars like PYTHONPATH
, which, for example, will allow IDEs like PyCharm to inject its debugger, coverage, or other IDE-specific libs when running a script.
This only applies when when exporting a mutable_virtualenv
(symlinked_immutable_virtualenv
exports are not "full" virtualenvs because they are used internally by pants itself. Pants requires hermetic scripts to provide its reproduciblity guarantee, fine-grained caching, and other features).
Deprecated options
py_hermetic_scripts
--[no-]export-py-hermetic-scripts
PANTS_EXPORT_PY_HERMETIC_SCRIPTS
[export]
py_hermetic_scripts = <bool>
True
Deprecated, will be removed in version: 2.24.0.dev0.
Use `--export-py-non-hermetic-scripts-in-resolve` instead.
When exporting a mutable virtualenv for a resolve, by default modify console script shebang lines to make them "hermetic". The shebang of hermetic console scripts uses the python args: -sE
:
-s
skips inclusion of the user site-packages directory,-E
ignores allPYTHON*
env vars likePYTHONPATH
.
Set this to false if you need non-hermetic scripts with simple python shebangs that respect vars like PYTHONPATH
, to, for example, allow IDEs like PyCharm to inject its debugger, coverage, or other IDE-specific libs when running a script.
This only applies when when exporting a mutable_virtualenv
(symlinked_immutable_virtualenv
exports are not "full" virtualenvs because they are used internally by pants itself. Pants requires hermetic scripts to provide its reproduciblity guarantee, fine-grained caching, and other features).