Refactor wheel_resolver to allow for non-PyPI downloads#167
Refactor wheel_resolver to allow for non-PyPI downloads#167tm-jdelapuente merged 4 commits intomasterfrom
Conversation
| @click_log.simple_verbosity_option(_LOGGER) | ||
| def main( | ||
| url: typing.List[str], | ||
| url: typing.Tuple[str], |
There was a problem hiding this comment.
Nit: If we're using python 3.9 onwards, you can just use tuple here, rather than typing.Tuple, btw.
| url: typing.Tuple[str], | |
| url: tuple[str], |
There was a problem hiding this comment.
Alternatively, Iterable if you don't much mind what kind of iterable it is? from collections.abc import Iterable
There was a problem hiding this comment.
python-rules still supports 3.8
This changes is because click passes it as a tuple rather than list - it's a bad type hint from the original commit
|
|
||
| # We're currently hardcoding PyPI but we should consider allowing other | ||
| # repositories | ||
| # TODO (tm-jdelapuente): allow downloads from other package repositories |
There was a problem hiding this comment.
Why removing this TODO, if not done? I wonder whether a flag could be added with a default?
There was a problem hiding this comment.
IMO we're (to a great extent) satisfying this requirement because we're now handling downloads if a URL is passed.
What we don't support is resolving the wheel to download from multiple options in a single repo. Maybe we can create an issue for that if someone feels strongly about it, otherwise this feels like a wishlist item to me
A pending problem (see this comment) was to allow downloads outside PyPI.
This PR refactors wheel_resolver to allow that.
Core logic
1, Try to download from the links passed to
--urlsfirst2. If it doesn't download the package, check if PyPI has a URL for that package
3. If there is a URL, use it to try to download from there
Testing
I've covered all the exit points of
main.