madpah / requirements-parser

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

Why is private code not supported? #39

Open attfarhan opened 6 years ago

attfarhan commented 6 years ago

I'm looking to use this in a project, but saw that private code (using --index-url or --extra-index-url) is not supported. I wanted to ask what the reason was? Is it simply because it has not yet been implemented or is there some other reason (security etc.)? Thanks for your work on this!

davidfischer commented 6 years ago

I'm not opposed to some basic level of support. However, ideally the requirement parser should not require connecting to any other server to complete its parsing.

kousu commented 4 years ago

Great! If we can work out a solution you'd be happy with I'd be happy to write a patch. The parser doesn't need to talk to anything. It just needs a way to return the URL to the caller.

It's a bit awkward since the API only returns Requirements as an iterator, so there's no place to shove in Repositories. Thinking out loud here, maybe you could say you return a iterator of Requirement | Repository. Maybe the API should change from requirements.parse(file) to requirements.requirements(file) with a separate requirements.repositories(file) (more expensive but more okay to work with).

And yes, thank you for putting this together! This should really be part of pypa.