{"action":"created","issue":{"url":"https://api.github.com/repos/pypa/pipenv/issues/1888","repository_url":"https://api.github.com/repos/pypa/pipenv","labels_url":"https://api.github.com/repos/pypa/pipenv/issues/1888/labels{/name}","comments_url":"https://api.github.com/repos/pypa/pipenv/issues/1888/comments","events_url":"https://api.github.com/repos/pypa/pipenv/issues/1888/events","html_url":"https://github.com/pypa/pipenv/issues/1888","id":310327912,"number":1888,"title":"Delete Pipfile.lock as late as possible","user":{"login":"tsiq-oliverc","id":35069681,"avatar_url":"https://avatars0.githubusercontent.com/u/35069681?v=4","gravatar_id":"","url":"https://api.github.com/users/tsiq-oliverc","html_url":"https://github.com/tsiq-oliverc","followers_url":"https://api.github.com/users/tsiq-oliverc/followers","following_url":"https://api.github.com/users/tsiq-oliverc/following{/other_user}","gists_url":"https://api.github.com/users/tsiq-oliverc/gists{/gist_id}","starred_url":"https://api.github.com/users/tsiq-oliverc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsiq-oliverc/subscriptions","organizations_url":"https://api.github.com/users/tsiq-oliverc/orgs","repos_url":"https://api.github.com/users/tsiq-oliverc/repos","events_url":"https://api.github.com/users/tsiq-oliverc/events{/privacy}","received_events_url":"https://api.github.com/users/tsiq-oliverc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-01T14:33:19Z","updated_at":"2018-04-01T15:07:03Z","closed_at":null,"author_association":"NONE","body":"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][3], or [it crashes][4], etc.), then one is left with no lockfile.\r\n\r\nCould the behaviour be changed so that the [lockfile deletion][1] is performed **immediately** before the [serialisation of the new content][2]?  (FWIW, I'd be happy to attempt a PR for this.)\r\n\r\nI guess two rationales for the current behaviour:\r\n\r\n1. 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.\r\n2. 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 :wink:.\r\n\r\n[1]: https://github.com/pypa/pipenv/blob/master/pipenv/core.py#L1026\r\n[2]: https://github.com/pypa/pipenv/blob/master/pipenv/core.py#L1173\r\n[3]: https://github.com/pypa/pipenv/issues/1785\r\n[4]: https://github.com/pypa/pipenv/issues/1837\r\n\r\n------------\r\n\r\n##### Steps to replicate\r\n\r\n1. Start with an existing Pipenv environment (i.e. you have a working `Pipfile`/`Pipfile.lock`).\r\n2. Run `pipenv install <any_dep_that_takes_a_long_time>`.\r\n3. Hit Ctrl+C before it's finished.\r\n"},"comment":{"url":"https://api.github.com/repos/pypa/pipenv/issues/comments/377793038","html_url":"https://github.com/pypa/pipenv/issues/1888#issuecomment-377793038","issue_url":"https://api.github.com/repos/pypa/pipenv/issues/1888","id":377793038,"user":{"login":"uranusjr","id":605277,"avatar_url":"https://avatars1.githubusercontent.com/u/605277?v=4","gravatar_id":"","url":"https://api.github.com/users/uranusjr","html_url":"https://github.com/uranusjr","followers_url":"https://api.github.com/users/uranusjr/followers","following_url":"https://api.github.com/users/uranusjr/following{/other_user}","gists_url":"https://api.github.com/users/uranusjr/gists{/gist_id}","starred_url":"https://api.github.com/users/uranusjr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uranusjr/subscriptions","organizations_url":"https://api.github.com/users/uranusjr/orgs","repos_url":"https://api.github.com/users/uranusjr/repos","events_url":"https://api.github.com/users/uranusjr/events{/privacy}","received_events_url":"https://api.github.com/users/uranusjr/received_events","type":"User","site_admin":false},"created_at":"2018-04-01T15:07:03Z","updated_at":"2018-04-01T15:07:03Z","author_association":"COLLABORATOR","body":"Pull requests are welcomed :)"}}
{"actor":{"display_login":"uranusjr"}}