miniature-restaurant-31318
05/30/2023, 10:38 AMpoetry.lock
.
First, I tried to add the following section in the config file (seen here in the doc):
[python.resolves_to_constraints_file]
__default__ = "constraints.txt"
It did not seem to have an effect (i.e. the resolved dependencies versions in the pex file were not the correct ones)...
After exploring the docs a bit more, I added the following lines in the python section of the pants.toml
:
enable_resolves = true
resolves_generate_lockfiles = false
resolves = { python-default = "contraints.txt" }
I create the contraints file in the CI, running poetry export
before pants.
It works (i.e. it correctly uses the versions defined in the contraints file) but it first generates a big pex files with all the dependencies before the selecting the one used in the subproject I’m building. It makes the build quite slow as it’s a big monorepo with lots of dependencies, is there a way to only install the needed dependencies and still use the versions defined in the poetry.lock
?
PS: I’m using v2.15broad-processor-92400
05/30/2023, 10:48 AMshunit2_test
test (in pants) that the requirements.txt file on disk matches the output of poetry export
(or similar, I’m on my phone at the moment, so can’t check exactly what we do).
It’s not great but it’s been working for usminiature-restaurant-31318
05/30/2023, 11:01 AMminiature-restaurant-31318
05/30/2023, 11:01 AMbroad-processor-92400
05/30/2023, 11:11 AMbroad-processor-92400
05/30/2023, 11:14 AM__default__
with your actual resolve name(s) work any better? As in, eliminate that special key as a source of bugs)