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

powerful-eye-58407

04/21/2023, 12:02 PM
Hi all, quick question about lockfiles vs requirements - docs says:
If you modify the third-party requirements of a resolve then you must regenerate its lockfile by running the
generate-lockfiles
goal. Pants will display an error if a lockfile is no longer compatible with its updated requirements.
How do I see/trigger this warning? I have pandas==1.4.3 in the requirements, and generated lockfile that includes this version:
Copy code
"project_name": "pandas",
"version": "1.4.3"
Now, if I modify requirements.txt to bump pandas version pandas==1.5.3, and run
pants test ::
there's no warning that requirements do not match the resolve - is there a way to check this that's builtin in pants? I want - maybe in the CI check - to make sure that when requirements.txt get upgraded, developers generate lockfiles and commit them to the repository as well. Thanks!
1
e

enough-analyst-54434

04/21/2023, 12:34 PM
Does any test or code under test actually use pandas?
Also, I assume you have lock files turned on but maybe it's not required to generate a lockfile; so worth checking: https://www.pantsbuild.org/docs/reference-python#enable_resolves
p

powerful-eye-58407

04/21/2023, 1:31 PM
Does any test or code under test actually use pandas?
yes
Also, I assume you have lock files turned
Copy code
[python]
interpreter_constraints = ["==3.8.*"]
enable_resolves = true

[python.resolves]
python-default = "lockfiles/default.lock"
I'm using pants version 2.16.0rc0
ok, now it seems to work fine somehow!
Copy code
Dependency on pandas not satisfied, 1 incompatible candidate found:
1.) pandas 1.4.3 does not satisfy the following requirements:
    ==1.5.3 (via: pandas==1.5.3)
sorry about that, I've regenerated lockfiles from the beginning and tried again, and looks correct now; it was probably related to my local setup
4 Views