-
-
Notifications
You must be signed in to change notification settings - Fork 640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Figure out how to handle VCS requirements with Python lockfiles and --hash
#13965
Comments
Another alternative is to improve |
How do you propose you perform a coherent resolve using two separate requirements lists? Afaict you can't without implementing your own resolver. So, --hash checking mode is almost a non-feature. It seems like the easiest thing is to not pass Pip hashes at all and do the hash checking ourselves after pip download has run. Here us == Pex. |
Agreed it does need to be a coherent resolve, only with the results split across two files. Perhaps
Sure, that sounds good to me too. But how would we disable hashes for pip? There's only At that point, I wonder if implementing |
I don't understand your 1st resaponse, but I'll move on since I think it's moot.
Yes - it already does this. The |
What's confusing about that question though, is if you're using Pex lockfiles, you're not passing requirements.txt anyhow - Pex is reading its own lock file format and can clearly do whatever with that. |
Oh, maybe this is the root of the confusion. I was thinking about the output of With the output, A workaround is for I was speculating how that could be implemented, that This output problem would still be relevant even if you move hash checking from pip to pex because the produced lockfiles would not be consumable outside of Pex, like if you run --
That's presuming we use Pex's lockfile format, rather than running We could also only export with a new option |
There is no need to run pex3 lock export. pex3 lock create creates a lock Pex inherently understands. Why middleman? |
Let's have that convo at #13964 (comment) to keep this one focused on VCS requirements. But that does sound good that if we go with PEX's format, then the output problem seems okay. The input problem I think would only be that VCS requirements generally don't work yet with |
So, I just went through the exercise of figuring out we don't handle this today - we map vcs requirements to version "*" for poetry to lock. That results in a lock, but of the latest publicly available version of the project and not of the requested vcs version. So, worse, its a silent failure to resolve what you asked for: #14020 I'm guessing you knew this though and so this is a new feature you're expecting out of a locker? The poetry locker, when given a proper git / rev, refuses to provide a hash via So, since the existing locker is broken for vcs requirements and the nascent Pex lock support is as well, there seem to be a host of options: |
Closing in favor of:
|
See pypa/pip#6469. Pip is all-or-nothing with
--hash
. If one entry in therequirements.txt
has it, then everything must have it in the file.The pip issue suggests switching VCS requirements to an Artifact URL like using the
.zip
file, but that doesn't always work and would require our users to have a confusing workaround.We want to in general strongly encourage (require?) that you use
--hash
because it's important for supply chain attacks. So we can't give up on--hash
entirely.--
Instead, the only workaround I can think of is what the issue suggests: to use a distinct
requirements.txt
for VCS requirements, which doesn't use--hash
, and then a normal one that uses--hash
.It's not clear how to model this: should
generate-lockfile
start generating 1+ lockfile per resolve? We could keep[python].resolves
a mapping ofresolve -> lockfile path
, and rely on a standard suffix likedefault_lock.vcs_reqs.txt
. That is, the extra file gets generated automatically and its name can't be changed. A major benefit of saving two lockfiles to disk is we get interop with the greater ecosystem, like you canpip install
the files without Pants.We could stick to using one lockfile, and then do some magical introspection of the lockfile to dynamically split it into two lockfiles during the rule. We don't have the interop benefit, though, and this is doing perhaps more work than actually necessary.
cc @stuhood @jsirois , thoughts?
The text was updated successfully, but these errors were encountered: