close
The Wayback Machine - https://web.archive.org/web/20200304105835/https://github.com/python/pythondotorg/issues/1352
Skip to content
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

API to check for releases by major/minor version #1352

Open
uranusjr opened this issue Nov 4, 2018 · 2 comments
Open

API to check for releases by major/minor version #1352

uranusjr opened this issue Nov 4, 2018 · 2 comments
Labels

Comments

@uranusjr
Copy link

@uranusjr uranusjr commented Nov 4, 2018

Is your feature request related to a problem? Please describe.

The question I want to answer is e.g. “what is the latest release for a given Python version X.Y”?

I build a CPython installation automation tool for Windows. It can be used to install a Python directly from the command line, e.g. pythonup install 3.6. Currently I maintain a hard-coded mapping file to point 3.6 to 3.6.7, but this means I need to release a new version every time CPython does.

I wish to automate the process by asking the python.org API for this information, but the current API design makes it very awkward. From what I can tell, I need to

  1. Request /downloads/release/ to get a long list of available releases.
  2. Parse the name manually to find releases starting with 3.6., and choose the latest.
  3. Parse the URI to get the release ID.
  4. Request /downloads/release_file/ with the request ID to get a list of files for that release.
  5. Parse the file names to find what I want.

Describe the solution you'd like

There are several things I would like to have to make the process more robust, but things that would benefit my workflow most would be

  • Allow more advanced filtering on /downloads/release/. The most ideal is like version_xy=3.6, but even something like slug__startswith=python-36 would be tremendously helpful.
  • Add the resource ID in /downloads/release/’s returned payload, or allow /downloads/release_file/ to be filtered on slug or resource URI. Currently release only has slug and resource_uri, but neither of them can be used to filter release_file.
@berkerpeksag

This comment has been minimized.

Copy link
Member

@berkerpeksag berkerpeksag commented Nov 4, 2018

Thanks for the report. Yes, we can definitely improve the API. However, the API v1 is sort of deprecated. There is a new API at https://staging.python.org/api/v2/ (not deployed on production yet) but I don't think its behavior is any better than the current one (my goal was to make it backwards compatible with v1) We can definitely add a name__startswith filter at https://github.com/python/pythondotorg/blob/master/downloads/api.py#L73 and make getting files for a specific release easier.

@uranusjr

This comment has been minimized.

Copy link
Author

@uranusjr uranusjr commented Nov 4, 2018

On a related note, v2’s ALL_WITH_RELATIONS filters don’t seem to work correctly (probably because of some Tastypie-DRF implementation details). I could do

/api/v1/downloads/release_file/?os=1&release__name=Python%203.6.4

but not

/api/v2/downloads/release_file/?os=1&release__name=Python%203.6.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.