How to programmatically get CPython releases and release dates

Hello. I want to query CPython releases and release dates in order to programmatically check for some criteria. GitHub repo python/cpython only has tags and not GitHub releases. And looks like the GitHub API does not return timestamp for tags. I see you have a table at Download Python | with what I need but is there a way I can just get a plain JSON with release tag and release date? Maybe something like python - Is there a way to get the release date of pip packages programatically? - Stack Overflow but for CPython? Thanks!

This might only be a fun text processing hack. Clone the python/peps repo and search PEP 0 for “release schedule.” Check those documents for release dates.

SMOP. :smiley:

1 Like

That’s because tags (except for annotated tags) aren’t really objects but refs. You can take the commit date of the tagged commit, e.g. using PyGithub:

In [13]: t
Out[13]: Tag(name="v3.11.0", commit=Commit(sha="deaf509e8fc6e0363bd6f26d52ad42f976ec42f2"))
In [27]:
Out[27]: datetime.datetime(2022, 10, 24, 17, 35, 39)
1 Like

That looks promising and cleaner than scrapping HTML. Thanks!

Just to wrap this up, I got the tag check to work, though it does need a GitHub API token because the anon limit will be exceeded just by the sheer amount of tags present, and each tag query is its own URL request. Thanks again!

If API limits are a problem, you could instead clone the repository and work locally. That could be a fair bit of downloading the first time, but after that, just git pull and keep looking at tags on your own system.

1 Like