Add support for extra variants of relative urls for simple html pypi API - #174
Merged
ryanking13 merged 4 commits intoJan 21, 2025
Merged
Conversation
ryanking13
approved these changes
Jan 20, 2025
ryanking13
left a comment
Member
There was a problem hiding this comment.
Looks good to me. Thanks. Could you please update the changelog?
| <html> | ||
| <head> | ||
| <meta name="pypi:repository-version" content="1.1"> | ||
| <title>Links for fake-pkg-micropip-test</title> |
Member
There was a problem hiding this comment.
Could you please update the filename? So the readers can easily know that it is for testing the relative url.
Contributor
Author
There was a problem hiding this comment.
Yep, thanks, I've updated changelog (I assume I have to put my changes under Unreleased section) and renamed new fixtures file.
for more information, see https://pre-commit.ci
Member
|
Thanks @artem-samokhin! |
Closed
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why:
I have a private python packages repository powered by Sonatype Nexus Repository software.
This repo unfortunatelly only supports simple HTTP API, and, additionally, list of packages from Nexus looks like that:
GET https://self-hosted-nexus-repo.example/repository/pypi/simple/example-python-package/
And because urls starts with
., micropip thinks that they are not relative urls and does not append index url to it.So, for example, if we are installing example-python-package==0.1 from web page called
my-web-page.example, web brouser receives GET request to../../packages/example-python-package/0.1/example_python_package-0.1-py2.py3-none-any.whl#sha256=<hash>from micropip and interpretes it ashttps://my-web-page.example/repository/pypi/packages/example-python-package/0.1/example_python_package-0.1-py2.py3-none-any.whl#sha256=<hash>instead ofhttps://self-hosted-nexus-repo.example/packages/example-python-package/0.1/example_python_package-0.1-py2.py3-none-any.whl#sha256=<hash>.What: better check for relative vs absolute url when dealing with simple HTTP API.
P.S. I can't figure out how to make tests that require spawn_web_server to work properly. But my part should not affect those, so I hope it is fine.