-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Use URL from response to support redirects #3198
Conversation
@jpyams appreciate your detailed description. That is definitely okay in lieu of an issue. Although, would be great if you can look for any existing issues that might be fixed with this. Couple of initial questions pop into mind.
In nexus deployments, the endpoint usually proxies mirrored packages instead of issueing a redirect. While this is a small change, it would be good to make sure that this beahviour is either allowed or is currently unspecified for legacy repsitories as per PyPA, warehouse or similar. Any references would be helpful. As for tests, it would definitely be great to have a test that atleast verifies the redirected url is used. This is to ensure that any we do not miss this scenario if (most likelt when) we rewrite parts of this code. A note regarding best practice considerations, would it be better to be more explicit about where your private packages come from and add artifactory mirror explicitly as a secondary or even primary source? I do not want to indicate that "this is the way to do it" as there are various reasons why your setup is required and might even be recommended. There are also conversations happening elsewhere to support PyPI mirrors as first class citizens in poetry, which might fit into this model. |
Thanks. I can't think of any security considerations that allowing redirects would introduce. pip has no problem here with installing packages through our system. Sure, I'll add a test for this. Regarding multiple sources (indexes/indices), that will not fit our use model. For security considerations, if there is a name conflict between one of our packages and something in PyPI, we want our package to win. pypiserver lets us do this with the redirects. pip with multiple indices treats all packages with the same name as identical, regardless of their source. |
@abn I added a test. Is there anything else I need to do before this pull request can be merged? |
Is there anything else I need to do on this pull request? |
@abn or somebody, can you please tell me what's holding up this PR or if there's something I need to do before it can be merged? |
It's just a matter of patience. One of the maintainers needs to find the time to get to it. |
@jpyams It would probably give the maintainers more confidence if you somehow managed to test this PR in a larger variety of environments (for example against other server softwares). @qiuwei You apparently encountered a similar issue in #3293, are you able to test this PR in your own environment and see if it fixes things for your workflow? |
I'm okay with either PR being the one which gets merged, let's plan on getting this one from @jpyams ready. I'll comment on this one with one small piece of feedback which I do think should be updated if this does get merged. The test implementation in this PR is simpler and therefore might be better. The implementation in my PR took a more system level approach relying on |
@neilvana good observation on the logging message! I have updated the pull request. Ditto with regard to being OK for either pull request. I just want to see this issue fixed! |
Made the change. One test is failing now, but it looks like something went wrong with the test runner at that moment in time. I don't know how to rerun that one test. Anyway, all the required tests are passing. |
Either there is a button in the UI to rerun the test (as author of the PR, you might be allowed to see it). Otherwise I guess maybe I would just amend the commit and force-push again. |
Thanks @sinoroc, that helped the tests pass! How do we get this issue to the attention of approvers? @abn sorry for pinging you repeatedly, but I don't know how to get anyone else who could get this approved. We're in the same boat as @neilvana: we want to use Poetry, but this issue is throwing a serious wrench in our ability to use it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jpyams a few minor suggestions otherwise looks good to me.
Co-authored-by: Arun Babu Neelicattu <arun.neelicattu@gmail.com>
Thanks for the feedback, @abn! Changes are implemented. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more minor suggestion :)
Co-authored-by: Arun Babu Neelicattu <arun.neelicattu@gmail.com>
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Pull Request Check List
I don't know if this change needs additional tests or documentation, since it is a small bugfix from an issue I've encountered. Also don't know if I should have created an issue first to report the bug. Any guidance here is appreciated.
On my team, we host our custom packages on a pypiserver that redirects to an Artifactory PyPI mirror if the package isn't a custom one. So we add a source section to our pyproject.toml.
However, when we have
default=True
, the installation fails.Tracking through the code, it appears the code uses the initially requested URL, but doesn't realize the request was redirected. So when requesting click, for example, it requests the URL
https://ourserver.example.com/pypiserver/click
, but that got redirected tohttps://artifactory.example.com/long/url/thing
. Further down the line, poetry tries to grab the resource using a relative URL and combining it with the first URL, when in fact it should be combining it with the second URL.