madpah / requirements-parser

A Pip requirements file parser.
https://requirements-parser.readthedocs.io
Apache License 2.0
125 stars 41 forks source link

[FEATURE] Support parsing of VCS requirements of the form `SomeProject@git+https://git.repo/some_pkg.git@1.3.1` #74

Closed madpah closed 2 months ago

madpah commented 2 years ago

Currently this library fails to parse requirement lines of the form: SomeProject@git+https://git.repo/some_pkg.git@1.3.1[extra]

This feature should parse the above example to a Requirements as follows:

{
   "line": "SomeProject@git+https://git.repo/some_pkg.git@1.3.1[extra]",
   "editable": false,
   "local_file": false,
   "specifier": false,
   "vcs": "git+https",
   "revision": "1.3.1",
   "name": "SomeProject",
   "uri": "git+https://git.repo/some_pkg.git",
   "subdirectory": null,
   "path": null,
   "hash_name": null,
   "hash": null,
   "extras": ["extra"],
   "specs": []
}

Update: Removed version from specs as @1.3.1 might be a branch or tag name, so this should only map to the revision.

FlorentJeannot commented 2 years ago

Hello,

I think this should be:

SomeProject[extra]@git+https://git.repo/some_pkg.git@1.3.1

And the parser should work with spaces too:

SomeProject[extra] @ git+https://git.repo/some_pkg.git@1.3.1

See my example there: https://github.com/madpah/requirements-parser/issues/75#issuecomment-1131416862