better-wolf-86659
12/01/2025, 6:11 PMversion-control style python_requirement (reference) and the lockfile?
Here's what I'm running into:
• we have pants version 2.28.0
• we have a python_requirement defined in 3rdparty/BUILD:
MY_DEP_VERSION = "v1.xx.xx"
MY_DEP_GIT_URL = f"my-dep@ git+<https://github.com/my-repo/my-dep.git@{MY_DEP_VERSION}>"
python_requirement(
name="my_dep",
requirements=[MY_DEP_GIT_URL],
modules=["mydep"],
)
• after generating the lockfile, I bumped `MY_DEP_VERSION`to a newer version. Surprisingly, running "pants check" or "pants package" on targets than depend on "my_dep" didn't error out.
• When I manually run "pants generate-lockfiles", the summary does show the upgraded dependencies for "my_dep" from v1.xx.xx to the newer version "v1.yy.yy"
I wonder if this is a bug? Is it known or I should file a new one? Or I'm doing something wrong with version control requirement?
Thank you!happy-kitchen-89482
12/01/2025, 10:12 PMhappy-kitchen-89482
12/01/2025, 10:13 PMbetter-wolf-86659
12/01/2025, 10:19 PMpants check :: did error out, saying the lockfile is incompatible.
BTW, I do already have a custom workflow to automate regeneration of lockfiles when this happens.happy-kitchen-89482
12/01/2025, 11:20 PMhappy-kitchen-89482
12/01/2025, 11:21 PMbrief-scientist-13682
12/01/2025, 11:22 PMbetter-wolf-86659
12/01/2025, 11:33 PM{
"artifacts": [
{
"algorithm": "sha256",
"commit_id": "abcdef1234567890deadbeefcafebabefeedface",
"hash": "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcd",
"url": "git+<https://example.com/org/sample-repo.git@vX.Y.Z>"
}
],
"project_name": "sample-repo",
"requires_dists": [...],
"requires_python": ">=3.10",
"version": "X.Y.Z"
}
And this requirement is being depended on throughout our python project in many places. After modifying version from "X.Y.Z" to a different(newer) version, both pants check :: and pants package :: would still succeed...
If I manually run pants generate-lockfiles after modifying version, I can see in the diff that commit_id , hash , url and version all have changed as expectedbetter-wolf-86659
12/01/2025, 11:34 PMIf 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.
in the documentationhappy-kitchen-89482
12/01/2025, 11:44 PMhappy-kitchen-89482
12/01/2025, 11:46 PMhappy-kitchen-89482
12/01/2025, 11:47 PMhappy-kitchen-89482
12/01/2025, 11:53 PMhappy-kitchen-89482
12/02/2025, 12:02 AMhappy-kitchen-89482
12/02/2025, 12:02 AMbrief-scientist-13682
12/02/2025, 12:17 AMhappy-kitchen-89482
12/02/2025, 12:30 AMbrief-scientist-13682
12/02/2025, 3:07 AMAh yes, this comment may as well say "why are we even bothering with this"...The code looks misguided all around. If you're going to have a lock header you definitely should validate the input requirements, but you should be validating the input requirements to the lock, not the subset requirements. So, the comment is right I'd say, but it misses the forest for the trees since the whole concept is botched. Perhaps its too expensive to calculate the full root requirement set and check it has not changed wrt lock header? If so though, that would be the more appropriate comment.
brief-scientist-13682
12/02/2025, 4:34 PMbrief-scientist-13682
12/02/2025, 9:05 PMhappy-kitchen-89482
12/02/2025, 9:44 PM[pex-cli]
version = "v2.1.143"
known_versions = [
"v2.73.1|macos_arm64|e6907e079a3f7c917dc88b41d892f732d4b8dbe388abfefc064d19c4a9f3c7e8|4939987",
"v2.73.1|macos_x86_64|e6907e079a3f7c917dc88b41d892f732d4b8dbe388abfefc064d19c4a9f3c7e8|4939987",
"v2.73.1|linux_x86_64|e6907e079a3f7c917dc88b41d892f732d4b8dbe388abfefc064d19c4a9f3c7e8|4939987",
"v2.73.1|linux_arm64|e6907e079a3f7c917dc88b41d892f732d4b8dbe388abfefc064d19c4a9f3c7e8|4939987"
]happy-kitchen-89482
12/02/2025, 9:45 PMbetter-wolf-86659
12/03/2025, 4:58 PMhappy-kitchen-89482
12/03/2025, 5:22 PM