Skip to content

JSON endpoint for project is 404 if only yanked releases are available #8966

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

Closed
di opened this issue Jan 6, 2021 · 5 comments · Fixed by #9411
Closed

JSON endpoint for project is 404 if only yanked releases are available #8966

di opened this issue Jan 6, 2021 · 5 comments · Fixed by #9411

Comments

@di
Copy link
Member

di commented Jan 6, 2021

From #3709 (comment), it appears that the JSON API for a project is 404 if the only releases available are yanked releases.

E.g. https://pypi.org/pypi/django-twilio2/json should probably look like https://pypi.org/pypi/django-twilio2/0.9.0/json instead of being 404.

@AustinTSchaffer
Copy link
Contributor

@di Do you know if anyone is working on this? I'm interested in taking a crack at it. I'm working through the getting-started and submitting-patches guides, just didn't want to duplicate any efforts.

@di
Copy link
Member Author

di commented Apr 22, 2021

It does not appear that anyone is working on this at the moment!

@AustinTSchaffer
Copy link
Contributor

AustinTSchaffer commented Apr 22, 2021

Sweet! I have a hopefully quick followup question about this. In the case where all non-prerelease versions of a package are yanked, but there are prerelease versions available that are not yanked, should this endpoint default to a yanked version or a prerelease version?

I'm currently thinking that this can be fixed by moving the yanked check from the "where" to the "order by" in the json_project method from warehouse/legacy/api/json.py.

https://github.com/AustinTSchaffer/warehouse/commit/2ac42a1a8953b9de3fcfd4418df45336aaa2180f

@di
Copy link
Member Author

di commented Apr 22, 2021

Sweet! I have a hopefully quick followup question about this. In the case where all non-prerelease versions of a package are yanked, but there are prerelease versions available that are not yanked, should this endpoint default to a yanked version or a prerelease version?

I think we should return a yanked release only if there are no other non-yanked releases available.

@AustinTSchaffer
Copy link
Contributor

Thanks for all of the swift responses, I believe this is all finalized and ready for review.

@di di closed this as completed in #9411 Apr 22, 2021
di pushed a commit that referenced this issue Apr 22, 2021
* Potential fix to 404 issue

Addresses #8966

* Reformatted

* Added unit tests for 404 issue

* Added an additional yanked test

* Swapped prioritization in release ordering
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants