Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is private code not supported? #39

Open
attfarhan opened this issue Feb 28, 2018 · 3 comments
Open

Why is private code not supported? #39

attfarhan opened this issue Feb 28, 2018 · 3 comments

Comments

@attfarhan
Copy link

attfarhan commented Feb 28, 2018

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
Copy link
Collaborator

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
Copy link

kousu commented May 17, 2020

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.

@joshuacwnewton
Copy link

joshuacwnewton commented Nov 27, 2024

UserWarning: Private repos not supported. Skipping.

Please note that the warning emitted by requirements-parser has changed as of a8754ff:

warnings.warn('Private repos not supported. Skipping.', stacklevel=2)

The addition of stacklevel=2 interferes with any warnings filters meant for this warning. For example, if you use something like this:

    warnings.filterwarnings(action='ignore', category=UserWarning, module='requirements')
    
    for req in requirements.parse(requirements_txt):

stacklevel=2 means that requirements is no longer the module emitting the error, and this filter won't work.

The stacklevel determines where the warning is emitted. If it is 1 (the default), the warning is emitted at the direct caller of the deprecated object; if it is higher, it is emitted further up the stack.

Removing module= but adding message= will preserve the filter.

    warnings.filterwarnings(message='Private repos not supported', action='ignore', category=UserWarning)

cc: @madpah

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants