pipenv: Private packages not updated unless environment is removed
Issue description
Private packages defined with an object like mylib = {ref = "dev" git = "ssh://git.mycompany.com/my-lib.git"} are not being updated on my virtual env, even after the pipenv update creates a new Pipfile.lock with the correct commit id.
Expected result
After calling pipenv update, I expect the Pipfile.lock ref to change and also the code in my environment to change, such that I have access to the new code within my project.
Actual result
I see the Pipfile.lock ref change, but the actual code for my dependency does not change.
If I do pipenv --rm to remove the environment and then re-create the environment, I can get the actual code change to replicate on disk.
Steps to replicate
Update my-lib with some code change, commit and push. On my project, do pipenv update and wait for the process to finish.
Check that the Pipfile.lock has changed and has the correct ref for the new commit in my-lib.
Check that the code for my-lib hasnt actually changed within my original projects virtual env.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 24 (12 by maintainers)
@joaomcarlos
2023.8.19has been released š¤@matteius OK, Iāll share my findings here first, then Iāll submit a PR depending on your feedback.
TL;DR ā A quick workaround that Iāve been using
In case @joaomcarlos and/or @AndreGraca98 are still affected by this bug and want to try out a workaround, without trawling through the extended discussion below.
Based on the latest release (v2024.0.1):
https://github.com/pypa/pipenv/blob/7493d181b2ede1bf5820189c128020d156cb51f2/pipenv/environment.py#L731-L735
Add the following two lines:
Identifying the regression
v2023.9.8 was the last working version for me, so I used that to help narrow down my
git bisectrange. I found that the regression was introduced in:Running interactive debugging, I could see that my VCS-based entries were entering this
ifclause that had been moved to the top and were now returningTrue:https://github.com/pypa/pipenv/blob/85c1ba5234ff7228cc64cb18c08f8b8fd9fd3e23/pipenv/environment.py#L772-L775
I.e. These entries were no longer getting to the specific conditional they were supposed to reach.
Hitting a traceback with the first attempted workaround
The obvious workaround to attempt first was to bring the specific conditional back to the top. So based on the current latest commit in the
mainbranch, Iām referring to this block:https://github.com/pypa/pipenv/blob/b99ea6bcf8149312b1ac43de6679d4c801299029/pipenv/environment.py#L746-L750
However, this led to a traceback due to the
match.has_metadata("direct_url.json")clause:With a bit more digging, I found that this was something that slipped through during the
pkg_resources=>importlib-metadataconversion in b1c14a2e18e90b3b77467d0fb19b70ce410be396.Finalising the workaround
Not to be presumptuous about the correct fix for this, I expunged the clause mercilessly! This led to the fuller form of the workaround, which may be the basis of a potential fix:
@matteius all is gut š No rush. I hope your holiday was good!
I saw, just donāt have time at the momentāgetting back to work after two weeks off š
Right, we tested it and we saw the same behavior.
Lets re-cap:
We ran, on me and Andres machine, the following two commands:
At this point, we established a baseline for pipenv.
We commit a āpotatoes 2ā print to our package on the dev branch and run
pipenv update, we see that the commit ref has been updated successfully but no change in the files under our virtual env specifically(/Users/joao.carlos/.local/share/virtualenvs/package-5xV1os6e/src/package-name/module/file.pyWe tried a bunch of variations and none worked.
We did however manage to get it updating by adding the
editable=trueto the Pipfile.With editable=true, we see both the change in ref and the change in the file.
Does this help with debugging the issue?
I saw your reply, but I cannot reproduce it, so leaving it open for now in case someone can help you.
Hi,
This is actually still happening. The refs get updated on the lock file but the code does not change until you --rm it