-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Interest in supporting PEP 665? #10636
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
Comments
I feel +1 to making |
To answer the interest question: Yes, to the extent that multiple maintainers are co-authors. ;) |
For the UI design discussion: As noted, -1 to allowing this in I also think it would make sense for |
Hmm... I think there's a misunderstanding. Allow me to try again. What I'm saying we should do is:
I don't think we should have a mode where you can disable the uninstall semantics when using the lockfile; not unless someone explicitly asks for it. In other words, I think we shouldn't add is "install things from this lockfile to the environment, in addition to whatever is already installed" (think of how |
+1 for supporting this in pip. What follows is not much more than instinctive reactions at this stage, as I have not digested the draft PEP yet. For installation, a I'm not sure pip should venture in the environment management space just yet. Although if we want to, Regarding generation of the lock file I always thought that both the pip freeze and pip-compile approaches are valuable. Freeze does require recording information about the original artifact (its hash at least) but that sounds doable although it probably requires a new PEP. Also regarding the generation of the lock file, I have a question: are there thoughts or examples of how the UI/UX would look like for generating a multi-platform lock file (with pip or in general) ? |
My instinct is that "installing a lock file" has to mean "making the environment look like what the file specifies". Otherwise there are too many questions around what happens in the case of conflicts, etc. But I agree that it may be confusing if I think if we're supporting lockfiles, we need a new subcommand (+1 for One possible issue though - in general, I'd expect a lockfile would definitely not specify that pip was to be installed (nothing depends on pip, after all). But we'd have to have pip in the environment to do the install, so "install exactly what is in the lockfile" won't be 100% accurate anyway, we'll need to make an exception for pip. Not a big deal, but let's be careful to be explicit here... |
Yeah, I think I read your response wrong. The one thing I don't like about having |
Yea, a |
Right now, the workflow that I've got bouncing around in my head is: $ pip resolve -r requirements.txt mousebender packaging -o something.pylock.toml
$ pip sync something.pylock.toml We'd effectively be providing the workflow that pip-tools provides; albeit with a standard-backed format (instead of requirements.txt) as the intermediary. |
@pradyunsg yep, but my keyword was "multi-platform" :) I understand the lock file would support multiple platforms ? Or is it up to the user to create one lockfile for each platform ? Or does pip resolve try different platforms ? |
Well...
Realistically though, we'd likely only implement 1 -- the platform-specific lock file -- at least in the first implementation. We can explore either "expanding" what we output to be platform-agnostic in a follow up, and/or defer to other tooling in the ecosystem to have them generate platform agnostic files. |
Yeah, my question should rather have been for the pep discussion, as it is not pip specific, and I agree pip may not need to care about that aspect in a first iteration. |
About this example. What would it look like if the application for which we want to lock the dependencies has a pyproject.toml instead of a requirements.txt.in. We may need a specific mechanism for that use case, as |
Ah! The sub-text from my response answers your PEP-related question too though -- The UX on the installer's end would be the same for well-formed lockfiles, regardless of whether the lockfile is a cross platform or not. It will "just" discard more things that don't match the environment (markers or tags).
I hadn't thought of this!
I agree, although...
I think local directories should be rejected when given as a top-level input to Instead, we could have something like |
First, thanks for the vote of support on the PEP (for those that aren't co-authors 😉). Second, for |
One thing to consider with a As such, you may want to provide a requirements file escape hatch as extra stuff to pull in that won't fit in a lock file. |
The PEP positions the lock file as very much an explicit specification of "this is what you install to create the environment for this app". Reproducibility is a key goal. Allowing "extra stuff" to be installed risks compromising that goal, which is one of the key reasons I think we should have a separate command for building an environment from a lockfile. Without some sort of support in the PEP for the use case of installing "other stuff" alongside the packages listed in a lockfile, and some explanation of the intended/expected semantics, I'd be -1 on supporting that in pip. Also, if we define behaviour and the standard is later extended in a way incompatible with our approach, we end up with a backward compatibility issue, so that's another reason for not immediately going beyond what the standard specifies. It's easier to add functionality than remove it, so let's start without this. If the PEP authors think the use case is worth supporting, they can do so in the PEP. Otherwise, we should follow their lead. |
That aside, it's not like requirements.txt is going away anytime soon -- so there's no reason for the lockfile to accomodate for all the potential ways that pip allows you to do things. Starting with a subset and expanding is fine IMO. |
My idea to "support" the use case is something like pip resolve -r requirements.in -o foo.pylock.toml
# If pip finds anything not lock-able, it emits foo-additional-requirements.txt listing them.
pip sync foo.pylock.toml
pip install -r foo-additional-requirements.txt --no-deps (Persuambly |
To clarify my position (and sorry to bring a somewhat dissonant voice here), while I support pip implementing PEP 665 in principle, I'm stil assuming that the question of supporting sdists and VCS URLs can be resolved in PEP 665 before we implement this in pip. Indeed pip provides first class support for both and I think it would be surprising for pip users to offer a replacement to requirements.txt that does not support those. Also, the question of pinning build dependencies (of dependencies) regularly comes up and I think it's a great opportunity to provide a solution for that. |
I'd be very happy with the solution of I'd be happy too if no additional file is produced as long as the lock produced only included lockable requirements. As long as pip resolve produces fully locked whiles while allowing requirements.in to include things that can't be locked it will fit well for my situation. Manually managing additional-requirements file is pretty doable for me, so I think foo-additional-requirements.txt is a bonus |
Thinking about The first is when the local project is installed in editable mode and the lock file has its dependencies (a common use case I assume). In such case, Another, maybe less common, case is to have a lock file for each set of extras (e.g. a lock file for the runtime requirements, a lock file for test requirements, or docs requirements). In this case we may want a mechanism to pip sync several compatible lock files at once. |
I don’t see why the editable project is a concern, to be honest. If we go with the approach that As for doing
|
I guess the point I want to get across with these examples (and when I say I'm not sure pip should venture into env management) is that there are nuances in workflows around a |
I'll note that we don't have to get this right in the first attempt. We explicitly have the ability to use an escape hatch of "this is an experimental command" if we find out that something is more complexity than would be worthwhile for us. |
s/665/751/ |
The lock file format proposal is now PEP 751. pip also added I think a sensible approach now would be to either add a new |
Due note that PEP 751 is still draft. |
PEP 751 has now been accepted. |
Fantastic! |
#13213 is the PR for |
What's the problem this feature will solve?
Standardizing on a file format that fixes some shortcomings of requirements files.
Describe the solution you'd like
Two possibilities.
One,
pip freeze
emits PEP 665 files.Two,
-r
(or some new option) can read in and install from a PEP 665 file.Alternative Solutions
Status quo.
Additional context
https://discuss.python.org/t/pep-665-take-2-a-file-format-to-list-python-dependencies-for-reproducibility-of-an-application/11736
I'm basically looking for tool support to quote in the PEP at this point to help drive its support/acceptance.
Code of Conduct
The text was updated successfully, but these errors were encountered: