pipenv: Pipenv 2023.8.21 parse error with packages from git
I have this in my Pipfile:
foobar_pkg_name = {ref = "v2023.08.18.1", git = "https://gitlab%2Bdeploy-token:TheToken@gitlab.example.tld/group_name/foobar_pkg_name.git"}
Results in Pipfile.lock to:
"foobar_pkg_name": {
"git": "https://gitlab+deploy-token:TheToken@gitlab.example.tld/group_name/foobar_pkg_name.git",
"ref": "0000-the-pkg-hash-0000"
},
The installation results in a error, because of completely wrong URI:
[pipenv.exceptions.InstallError]: Looking in indexes: https://pypi.python.org/simple
[pipenv.exceptions.InstallError]: Collecting foobar_pkg_name@ git+https://gitlab+deploy-token:TheToken@0000-the-pkg-hash-0000 (from -r /tmp/pipenv-cn09v7m7-requirements/pipenv-98f1ayok-reqs.txt (line 1))
[pipenv.exceptions.InstallError]: Cloning https://gitlab%2Bdeploy-token:****@0000-the-pkg-hash-0000 to /tmp/pip-install-5uk38bc4/foobar_pkg_name_4300623bc17942a0ae003fe8d1f0500e
The same works with older Pipenv v2023.7.23
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Reactions: 3
- Comments: 19 (10 by maintainers)
Ah bummer, sorry about this! This is tricky because some folks have the @ symbol as an extra ref and so I was thinking that would be easier to peel back off, but that breaks ssh:// without the extra @ symbol. 🤔
I have the same problem with editable GitHub dependecies.
Pipfile:
Pipfile.lock:
Error:
If I’m not mistaken the bug came in with this PR by @matteius: https://github.com/pypa/pipenv/pull/5845
@julio-tl Are you able to check the tagged draft PR to see if it fixes the regression in your case? Also, I apologize for the inconvenience.
@bpicardat That might be viable, but if I recall when working on the original refactor I was having some trouble with urllib parse but I can’t recall specifically if it was about evaluating the netloc env vars and loosing them in the evaluated string (they get masked) or something similar that makes it hard to reconstruct back to the original line after parsing it. I opened an alternative PR that I think might solve it, assuming there aren’t examples that lack a slash after the netloc
@
Maybe with urllib.parse.urlparse? Only remove the trailing @ and ref string from the “path” but don’t touch the “netloc”
Thanks @matteius , your PR fixed the issue for my case 👍