hey team. When having a constraints file (generat...
# general
f
hey team. When having a constraints file (generated from the
requirements.txt
file), I configure
pants.toml
to be:
Copy code
[python-setup]
...
requirement_constraints = "constraints.txt"
resolve_all_constraints = false
When running the tests, I can see this being printed:
Copy code
Starting: Building requirements.pex with 4 requirements: PyYAML, dataclasses==0.6, marshmallow>=3.5, requests>=2.22
Does it mean that Pants ignores the
constraints.txt
file? I’ve left a dependency out of the
constraints.txt
on purpose and got this message, so Pants must be able to find it
Copy code
The constraints file constraints.txt does not contain entries for the following requirements: elasticsearch
Reading the docs (https://www.pantsbuild.org/v2.6/docs/reference-python-setup#section-resolve-all-constraints) I can see:
If disabled, Pants will not use a global resolve and will resolve each subset of your requirements independently
So it should still be able to use pinned versions from the constraints, am I wrong?
h
Hi! Yeah, it will still use the constraints file. You can confirm by using
-ldebug
to see the argv for the Process That warning is a hint that your constraints file isn't as comprehensive as you may have intended
f
Oh sorry
I’ve left a dependency out of the 
constraints.txt
 on purpose
that was in another run to see if Pants will pick it up. I get the
Copy code
Starting: Building requirements.pex with 4 requirements: PyYAML, dataclasses==0.6, marshmallow>=3.5, requests>=2.22
in both cases 🙂
h
Oh so that's not the actual command run, only Pants's UI. It's telling you the top-level requirements it's telling Pex to install - but Pants still passes the constraints file for Pex/pip to further lock down versions
f
You can confirm by using 
-ldebug
 to see the argv for the Process
Thank you, can confirm these are showing up
Copy code
"--constraints", "constraints.txt"
❤️ 1
then the case is solved, thanks for explaining what’s going on!
💯 1
h
Great! This will hopefully be more clear when we have proper lockfiles. It will say something like
Installing data_science.lockfile
, followed by
Extracting 4 requirements from data_science.lockfile: Django, ansicolors
etc
🙌 1
b
Meantime, sounds like a tweak to the docs would be helpful. @fresh-cat-90827 can you suggest language that would have made it clearer for you as a user?