https://pantsbuild.org/ logo
#general
Title
# general
e

eager-dress-66405

05/19/2022, 6:45 AM
Question regarding moving from
requirement_constraints = "constraints.lock"
to enabling resolves/pex lockfiles in ๐Ÿงต
โœ… 1
We are still in the process of moving all the various teams/projects in our monorepo onto pants. Before pants, and still for a few things that haven't been transitioned yet, we had a single giant venv.
Our
constaints.lock
file is ...bespoke- no poetry/pip-compile, originally a
pip freeze
, but with many hand edits since.
Using
requirement_constraints
has been very useful for us to be able to transition to pants while keeping the mini venvs it creates in sync with our legacy mega venv deployments, but we would like to switch over to resolves and pex lockfiles asap in order to 1) take advantage of performance improvements (we're currently spending a lot of time resolving dependencies), 2) allow new projects to split off into their own resolves
Is there anyway to generate a lockfile for the default python resolve that matches our legacy constraints.lock file? Even if this is a manual process it would work for now.
b

bitter-ability-32190

05/19/2022, 8:18 AM
If you download
pex
, you can run
pex3 lock create -r constraints.lock
to convert your lockfile to the PEX one. (You'll have to double check the command, going off memory)
๐Ÿ‘€ 1
e

eager-dress-66405

05/19/2022, 10:05 AM
Copy code
pex3 lock create --constraints "constraints.lock" -r "3rdparty/requirements.txt" > "3rdparty/python/default.lock"
works, but when i try to use it:
Copy code
pants.core.util_rules.lockfile_metadata.InvalidLockfileError: Could not find a Pants metadata block in the lockfile `3rdparty/python/default.lock` for `python-default`. To resolve this error, you will need to regenerate the lockfile by running `/home/mpcusack/dev/color/pants generate-lockfiles --resolve=python-default`.
b

bitter-ability-32190

05/19/2022, 11:58 AM
there's a pants option for "don't use pants to generate the lockfiles"
(sorry I don't have a link im on mobile)
e

eager-dress-66405

05/19/2022, 12:43 PM
Ahh, I'll try that
3 Views