madpah / madpah/requirements-parser

[FEATURE] Support PEP 440 direct references to source packages

Open
#75 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
141
Forks
42
PR merge metrics
No merged PRs in 30d

Description

As documented https://pip.pypa.io/en/stable/cli/pip_install/#examples (point 9), it is possible to define requirements as follows, which this library cannot parse at present:

```
python -m pip install SomeProject@http://my.package.repo/SomeProject-1.2.3-py33-none-any.whl
python -m pip install "SomeProject @ http://my.package.repo/SomeProject-1.2.3-py33-none-any.whl"
python -m pip install SomeProject@http://my.package.repo/1.2.3.tar.gz
```

Validating the above with `pip` `22.0.4` as follows:
```
> python -m pip install "Jake @ https://files.pythonhosted.org/packages/d1/aa/e1be071cde813cafca797678c728b9fa686aa7d72c3e10c512ac7a5599d2/jake-2.0.0-py3-none-any.whl"
...

> pip freeze
...
jake @ https://files.pythonhosted.org/packages/d1/aa/e1be071cde813cafca797678c728b9fa686aa7d72c3e10c512ac7a5599d2/jake-2.0.0-py3-none-any.whl
...
```

This feature should parse the above example to a `Requirement` as follows:
```
{
"line": "jake @ https://files.pythonhosted.org/packages/d1/aa/e1be071cde813cafca797678c728b9fa686aa7d72c3e10c512ac7a5599d2/jake-2.0.0-py3-none-any.whl",
"editable": false,
"local_file": false,
"specifier": false,
"vcs": null,
"revision": null,
"name": "jake",
"uri": "https://files.pythonhosted.org/packages/d1/aa/e1be071cde813cafca797678c728b9fa686aa7d72c3e10c512ac7a5599d2/jake-2.0.0-py3-none-any.whl",
"subdirectory": null,
"path": null,
"hash_name": null,
"hash": null,
"extras": [],
"specs": []
}
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the documented PEP 440 direct-reference examples with pip 22.0.4 and trace how the parser currently handles these requirement lines. The work is done when the examples produce a Requirement with the fields and values shown in the issue, including the package name and URI.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.