madpah / madpah/requirements-parser
Cannot create requirement from this particular pip freeze output
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 141
- Forks
- 42
- PR merge metrics
- No merged PRs in 30d
Description
If you install a package in a subdirectory from git, e.g.
```
git+ssh://git@github.com/my/repo.git@project25#egg=PACKAGE_NAME&subdirectory=SUB_DIR/
```
and then do a `pip freeze` you'll instead get:
```
PACKAGE_NAME @ git+ssh://git@github.com/my/repo.git@3684f02bf928cae39d10d1d9b478d95d2267b2af#subdirectory=SUB_DIR/
```
In which case this cannot be parsed (redacted with parts I can't share):
```
File "/stitchfix/z-pyenv/pyenv/versions/3.6/lib/python3.6/site-packages/requirements/parser.py", line 50, in parse yield Requirement.parse(line)
File "/stitchfix/z-pyenv/pyenv/versions/3.6/lib/python3.6/site-packages/requirements/requirement.py", line 220, in parse return cls.parse_line(line)
File "/stitchfix/z-pyenv/pyenv/versions/3.6/lib/python3.6/site-packages/requirements/requirement.py", line 198, in parse_line pkg_req = Req.parse(line)
File "/stitchfix/z-pyenv/pyenv/versions/3.6/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3155, in parse req, = parse_requirements(s)
Traceback (most recent call last):
File "/stitchfix/z-pyenv/pyenv/versions/3.6/lib/python3.6/site-packages/pkg_resources/__init__.py", line 3108, in __init__ super(Requirement, self).__init__(requirement_string)
File "/stitchfix/z-pyenv/pyenv/versions/3.6/lib/python3.6/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 101, in __init__ raise InvalidRequirement("Invalid URL given")
pkg_resources.extern.packaging.requirements.InvalidRequirement: Invalid URL given
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with the pip freeze line shown in the issue, then inspect requirements/parser.py and requirements/requirement.py around the reported parsing calls. Done means the git URL with the package name and subdirectory is accepted and parsed without the Invalid URL given error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100