Skip to content

Commit

Permalink
requirements parsing: do not include egg name twice
Browse files Browse the repository at this point in the history
Requirements with a wheel path with extras caused a constraint line with
egg name which was included twice.
For example:

```
'spacy = {file = "https://files.pythonhosted.org/packages/.../spacy-3.4.3-cp39-..._x86_64.whl", extras = ["transformers"]}'
```

Produced a constraint line like the following:
```
https://files.pythonhosted.org/.../spacy-3.4.3-..._x86_64.whl#egg=spacy#egg=spacy[transformers]
```

This line triggered an unhandled excpetion `pipenv.exceptions.ResolutionFailure`,
as in #5536.

The should be submitted actually to requirementslib. However, I am
publishing it here so others can confirm it too.

Signed-off-by: Oz Tiram <[email protected]>
  • Loading branch information
oz123 committed Dec 21, 2022
1 parent fa2e035 commit 20a7ce8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pipenv/vendor/requirementslib/models/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -1831,8 +1831,9 @@ def from_pipfile(cls, name, pipfile):
line = "{0}&subdirectory={1}".format(line, pipfile["subdirectory"])
if editable:
line = "-e {0}".format(line)
arg_dict["parsed_line"] = Line(line)
arg_dict["parsed_line"] = Line(line, extras=extras)
arg_dict["setup_info"] = arg_dict["parsed_line"].setup_info

return cls(**arg_dict) # type: ignore

@property
Expand Down Expand Up @@ -2525,6 +2526,8 @@ def get_line_instance(self):
self.is_file_or_url
and not local_editable
and not self.req.get_uri().startswith("file://")
# fix for file uri with egg names and extras
and not len(self.req.line_part.split("#")) > 1
):
line_parts.append(f"#egg={self._name}{self.extras_as_pip}")
else:
Expand Down

0 comments on commit 20a7ce8

Please sign in to comment.