Delete Pipfile.lock as late as possible
See original GitHub issueWhen updating Pipfile.lock, the old version is deleted before anything happens. If the update process fails (maybe because one Ctrl+C’s it because of a mistake, or it’s taking too long, or it crashes, etc.), then one is left with no lockfile.
Could the behaviour be changed so that the lockfile deletion is performed immediately before the serialisation of the new content? (FWIW, I’d be happy to attempt a PR for this.)
I guess two rationales for the current behaviour:
- Your
Pipfile.lock
should be in Git. Yes, but it still sucks if you’re doing a sequence of new package installs/etc. and haven’t committed your work. - The update of the
Pipfile.lock
should be consistent with the current state of the virtualenv. I’d buy that, but the current behaviour (no lockfile) doesn’t strike me as better 😉.
Steps to replicate
- Start with an existing Pipenv environment (i.e. you have a working
Pipfile
/Pipfile.lock
). - Run
pipenv install <any_dep_that_takes_a_long_time>
. - Hit Ctrl+C before it’s finished.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:8 (7 by maintainers)
Top Results From Across the Web
Is it possible to remove a dependency from the Pipfile.lock file ...
I can say pipenv uninstall dependency , but that will uninstall it from the venv not the Pipfile. lock file.
Read more >Basic Usage of Pipenv - Read the Docs
$ pipenv lock is used to create a Pipfile.lock , which declares all dependencies (and sub-dependencies) of your project, their latest available versions,...
Read more >pipenv Documentation - Read the Docs
Generates and checks file hashes for locked dependencies when installing from Pipfile.lock. • Automatically install required Python version when pyenv is ...
Read more >Basic Usage of Pipenv
$ pipenv lock is used to create a Pipfile.lock , which declares all dependencies (and sub-dependencies) of your project, their latest available versions,...
Read more >Setting up a Python development environment with pipenv
I can help you install and uninstall python packages. ... You will also notice that it searched for a Pipfile.lock file and created...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
+1 from me on the atomic file replacing part. I’ve always disliked how Pipenv deletes the lockfile and then fails to lock, personally. Nothing wrong technically, but is a bit expectected from a UX perspective.
This would be really helpful for us. I am currently in a location where the network is very slow, and I keep seeing developers hit a download timeout, not noticing Pipfile.lock disappeared, running
pipenv install
again and then noticing all kinds of unexpected upgrades happened.