GoogleCloudPlatform / GoogleCloudPlatform/artifact-registry-python-tools
Unable to redirect to a GCP Artifact Registry Python repository with pip
- Dominant language
- Python
- Stars
- 23
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
Related to #29
## Description
When following redirects that don't point to one of the configured indexes pip will request credentials from the keyrings using the netloc taken from the target's location url ([ref](https://github.com/pypa/pip/blob/main/src/pip/_internal/network/auth.py#L156)).
The present implementation relies on urlib.urlparse to determine hostname (which is part of netloc). urlparse requires urls to have a schema (or at least //) in order to detect a netloc ([ref](https://docs.python.org/3.7/library/urllib.parse.html?highlight=urlparse#url-parsing)), which makes it misclassify a previously parsed netloc as a path ([ref](https://stackoverflow.com/questions/53816559/python-3-netloc-value-in-urllib-parse-is-empty-if-url-doesnt-have#answer-53816615)).
I proposed falling back to using the service as is when a hostname cannot be found (ex. when service is just a url's netloc).
## Example
Using a private pypi server that redirects to a GCP Artifact Registry Python repository for certain dependencies.
Contributor guide
Assessment
This issue has not been assessed yet.