-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[PoC] PEP 751 pip lock
command
#13213
base: main
Are you sure you want to change the base?
Conversation
0b02620
to
914bd0b
Compare
Nice. I would love to help with making it happen (of course it depends on PEP 751 to be approved). We are currently doing our own custom and pretty "poor" implementation of locks with cosntraints in Airlfow and having a "standard" way of reproducible installs would be a great thing. Not sure what is the status now of the PEP and whether it has a chance to be approved soon, but that looks really great that we are trying to standardise it now. |
I appreciate this is draft, but some small early feedback. Firstly, I am advocating for an "output file" option. Writing pip's output to a file in other commands has several footguns, e.g knowing the correct flags to turn off non-relevant output, determining if pip hit errors or warnings when you do, and writing non-UTF-8 files when you direct standard out from powershell on Windows. pip-compile (and uv pip compile) solve this by having an output file option which is considered best practice to use. That said, I don't know the history of why other commands don't offer this, perhaps it's non-trivial.
I agree, I think pip should start as limited as possible around known difficult issues, and expand from there. This will give the chance for the lock API to evolve, if able. |
Cool. I did some early PoC work on the PEP, but things have evolved drastically since then, and I never got back to it. But one of my goals was always for the pip installation report format to be easily convertible into a lockfile. Another thing I'd like to see pip implement (I may well get round to this myself, in due course, it's not a request for someone else to pick it up!) is I'd very definitely aim pip at solely producing "environment reproduction" lockfiles, and not cross-platform ones. To that end, I think that disallowing the I don't have a strong opinion on the question of an
The PEP is in its final stages before being submitted for pronouncement. At this point, it's extremely unlikely that any major changes will occur. Speaking as the PEP-delegate, I can say that I've been heavily involved in the discussions on the PEP, and I'm confident that it has a good chance of being accepted2. Footnotes
|
I think a pre-requisite for that is PEP 710 |
I'm fine with this being in a follow up PR if there are non-trivial questions to answer. Though looking now at the PEP I do think a pedantic reading of it would be that the data should only ever be written as a file and not outputted as stdout as that would technically violate those same file name specifications 😉. (If not made clear by emoji I think that's terrible and that stdout should absolutely be an option at least). |
🙂 I wasn't trying to be pedantic, just noting the likelihood that someone would ask the question about validating the filename. Getting the encoding correct by using the |
914bd0b
to
a29a039
Compare
I choose not to emit Also, I choose to emit a relative path for |
d124afc
to
4b4f84a
Compare
0333893
to
ef393e6
Compare
It could be dynamic, so not emitting it is a better default. In the future we could consider emitting it when we know it is not dynamic.
ef393e6
to
f77d21c
Compare
This is a
roughPoC for apip lock
command that writes PEP 751 compliant tomlto stdout.Use with:
pip --quiet lock -o - .
to lock the local project to stdout.pip lock -e .
to lock the local project in editable mode topylock.toml
I wrote this mainly as a way to better understand the PEP.
A few comments:
pip install --dry-run --ignore-installed
, with mostly the same options.environments
,requires-python
,packages.marker
.--only-deps
option (Add--only-deps
(and--only-build-deps
) option(s) #11440)