question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Delete Pipfile.lock as late as possible

See original GitHub issue

When 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:

  1. 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.
  2. 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
  1. Start with an existing Pipenv environment (i.e. you have a working Pipfile/Pipfile.lock).
  2. Run pipenv install <any_dep_that_takes_a_long_time>.
  3. Hit Ctrl+C before it’s finished.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
uranusjrcommented, Apr 1, 2018

+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.

0reactions
wichertcommented, Apr 3, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found