requirements-parser
requirements-parser copied to clipboard
[FEATURE] Support PEP 440 direct references to source packages
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": []
}
Hello @madpah
I'm very interested by this fix and some others, and I was wondering if this is going to support the extra requirements out of the box?
For example, you can try this:
pip install 'uvicorn[standard] @ git+https://github.com/encode/uvicorn.git'
You'll see that the command works and installs everything that is specified as extra requirements. https://github.com/encode/uvicorn/blob/0.17.6/setup.py#L54
Also if you need help I can try to work on some issues, but I am not very fluent in regex (just the basics) and it looks like your tool is using them extensively.
EDIT: Sorry I see this one is for source packages only, I should have written my question in issue https://github.com/madpah/requirements-parser/issues/74 instead. Although, I think my question still applies to both issues.