-1

I need to ensure support up to and including the latest minor version of Python 3.x. How could I go about determining the latest version of Python 3 currently released, programatically from the command line in Bash?

I recognize that this will likely require querying some external source via the internet, which is acceptable. I just need to know how to do so.

Vinny
  • 154
  • 5
  • If you mean the most recent (minor) version of CPython, you could try and grab the information from https://www.python.org/ . – 9769953 Mar 30 '23 at 12:12
  • More specifically, here https://www.python.org/downloads/ you have a *Download the latest version* header with a link under it (currently *"Download Python 3.11.2"*) – Tomerikoo Mar 30 '23 at 12:14
  • This: `sed -e < <(wget -qO- https://www.python.org/downloads/) '/latest.*ftp.python/{s#.*hon/\([0-9.]\+\)/Pyt.*#\1#;q };d'` – F. Hauri - Give Up GitHub Mar 30 '23 at 12:38
  • Might a duplicate of https://stackoverflow.com/questions/65311659/getting-the-latest-python-3-version-programmatically – j_b Mar 30 '23 at 20:59

1 Answers1

1
version=$(curl https://www.python.org/ | grep 'Latest:' | sed -E 's/^.*?([0-9]\.[0-9]+)\.[0-9]+.*$/\1/')
echo $version
3.11
9769953
  • 10,344
  • 3
  • 26
  • 37