Skip to main content
Version: 2.32 (prerelease)

generate-lockfiles


pants generate-lockfiles [args]

Generate lockfiles for third-party dependencies.

Backend: pants.backend.experimental.codegen.protobuf.scala

Config section: [generate-lockfiles]

Basic options

diff

--[no-]generate-lockfiles-diff
PANTS_GENERATE_LOCKFILES_DIFF
pants.toml
[generate-lockfiles]
diff = <bool>
default: True

Print a summary of changed distributions after generating the lockfile.

diff_include_unchanged

--[no-]generate-lockfiles-diff-include-unchanged
PANTS_GENERATE_LOCKFILES_DIFF_INCLUDE_UNCHANGED
pants.toml
[generate-lockfiles]
diff_include_unchanged = <bool>
default: False

Include unchanged distributions in the diff summary output. Implies diff=true.

resolve

--generate-lockfiles-resolve="['<str>', '<str>', ...]"
PANTS_GENERATE_LOCKFILES_RESOLVE
pants.toml
[generate-lockfiles]
resolve = [
'<str>',
'<str>',
...,
]
default: []

Only generate lockfiles for the specified resolve(s).

Resolves are the logical names for the different lockfiles used in your project. For your own code's dependencies, these come from backend-specific configuration such as [python].resolves. For tool lockfiles, resolve names are the options scope for that tool such as black, pytest, and mypy-protobuf.

For example, you can run pants generate-lockfiles --resolve=black --resolve=pytest --resolve=data-science to only generate lockfiles for those two tools and your resolve named data-science.

If you specify an invalid resolve name, like 'fake', Pants will output all possible values.

If not specified, Pants will generate lockfiles for all resolves.

sync

--[no-]generate-lockfiles-sync
PANTS_GENERATE_LOCKFILES_SYNC
pants.toml
[generate-lockfiles]
sync = <bool>
default: False

Attempt a minimal update of the lockfile, preserving existing dependency versions wherever possible. The resulting lockfile will be a valid solution for the requested dependency versions, but it may not include the latest versions available.

If a backend does not support syncing it will fall back to full regeneration of the lockfile, and this option will have no effect.

Note that there may be edge cases where syncing will fail the next time it's run after options that affect lockfile generation are changed. In this case you may need to temporarily turn off sync and trigger a full regeneration of the lockfile.

Advanced options

custom_command

--generate-lockfiles-custom-command=<str>
PANTS_GENERATE_LOCKFILES_CUSTOM_COMMAND
pants.toml
[generate-lockfiles]
custom_command = <str>
default: None

If set, lockfile metadata will say to run this command to regenerate the lockfile, rather than running pants generate-lockfiles --resolve=<name> like normal.

Deprecated options

None