-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Moving off lockfile #4766
Comments
There's https://pypi.org/project/filelock, which has a very similar API and seems to be active. |
Another possibility: https://pypi.org/project/portalocker/ |
Just a few considerations:
|
@chrahunt Would you be able to make some time to work on this? |
Sure. To start, the current situation is:
|
I think in both of these situations we can probably avoid using file locking altogether, in favor of creating and writing to a unique file (using e.g. Pros:
Cons:
|
Could also move the data to SQLite which guarantees transactional semantics on all platforms. Though maybe Pip tries to work in environments where Python has been compiled without SQLite? |
That's a good point. We would probably want to avoid dependencies on optional modules as much as possible, otherwise we end up raising the bar for a semi-functional Python installation. It could also be optional, but if we have a fallback then we're maintaining two approaches. |
Yep -- Ideally, pip only depends on things it knows will be on end user systems. pip should work on the bare-bones CPython IMO. |
What does “anyone else” mean here? Other users of |
Sorry, other cachecontrol users. |
I see, that makes much more sense. In that case I’d say a double barrel approach would work: pip can implement its own logic (or maybe maintain a small library) to replace lockfile, so it can have the best possible compatibility. The SQLite approach can be pursued by cachecontrol if they so inclined. |
Before rolling out our own library, I'd suggest to look and check if there's any existing library that has this functionality. I'm not against a dedicated library for this but I don't want us redoing work that's already been done. |
I'd rather split it out into a separate library that we then vendor back in. I don't see any point in making functionality like that internal to pip, and conversely if we split it out, we can hopefully find other contributors to help maintain it. But as @pradyunsg says, let's make sure we're not reinventing the wheel first. There's been 3 libraries mentioned so far in this thread, and presumably all other users of lockfile have had to face this question. Pip has some special constraints, but I'd be surprised if we were so special that none of the other options work for us... |
To give us something concrete to discuss over, I have submitted #6879 which uses the strategy described here. It depends on another pending PR so it contains several commits unrelated to this issue but you can see the specific relevant commit here. As stated above - instead of
we do
which should be safer than the previous approach. We can do the same thing for the HTTP cache without much more work. |
Let's discuss over at #6879. |
All done. :) |
Hurrah! Thanks for all your work on this @chrahunt! |
pip currently vendors
lockfile
but it is deprecated as on Oct 2017.pip should start using some other package -- lockfile's README suggests
fasteners
.The text was updated successfully, but these errors were encountered: