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

sorting of Python versions: python-3.10-dev listed before python-3.9 #3022

Open
johnyf opened this issue May 31, 2021 · 2 comments
Open

sorting of Python versions: python-3.10-dev listed before python-3.9 #3022

johnyf opened this issue May 31, 2021 · 2 comments
Labels

Comments

@johnyf
Copy link

johnyf commented May 31, 2021

The page "Building a Python Project" lists archives that are available for installation, in the section "Python versions". This table appears to list archives sorted by Python version, so that smaller versions are listed before larger versions. From this, it is expected that Python 3.9 would appear listed before Python 3.10.

However, Python 3.10 is listed before Python 3.9 (in fact before all CPython versions between 3.4 and 3.9). This listing is unexpected. One would expect to find Python 3.10 listed after Python 3.9. I, for one, had thought for some time now that Python 3.10 is not yet available on Travis CI in any form. This impression was from reading the documentation of Travis CI and expecting to read Python 3.10 listed after Python 3.9. Not finding Python 3.10, I thought that it was only available as python-nightly.tar.bz2 (which now I believe is the development version of Python 3.11). (Searching the page for the string 3.10 would have revealed that 3.10-dev is available, but that I did only later.)

The specific table lines that I read when "16.04" has been selected for "Release" and "x86_64" for "Arch" are:

16.04 | x86_64 | python-3.10-dev.tar.bz2

and later

16.04 | x86_64 | python-3.9.tar.bz2

The reason for this listing appears to be sorting according to lexicographic order the file names. Perhaps another order could be used, in particular one that sorts the set of strings {'3.10', '3.9'} as ('3.9', '3.10'), instead of ('3.10', '3.9'). For example, the Python package natsort appears to give such a result:

import natsort

a = natsort.natsorted(['3.10', '3.9'])
b = list(sorted(['3.9', '3.10']))
print(f'natsort:  {a}')
print(f'lexicographic:  {b}')

The above code prints:

natsort:  ['3.9', '3.10']
lexicographic:  ['3.10', '3.9']

My understanding is that the source for this webpage is: https://github.com/travis-ci/docs-travis-ci-com/blob/58c95e03d543058e817801ce7cabee92ce2507a3/user/languages/python.md#python-versions
As indicated by that Markdown file, the table is autogenerated, so this issue appears to relate to the code that generates the table of Python archives.

It seems that with the existing sorting algorithm, when python-3.10.tar.bz2 becomes available later in 2021, and python-3.11-dev.tar.bz2 at some point in the future

@johnyf
Copy link
Author

johnyf commented May 31, 2021

It might also be relevant to list "3.10" in the section "Specifying Python versions".

@stale
Copy link

stale bot commented Jan 9, 2022

Thanks for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please do feel free to either reopen this issue or open a new one. We'll gladly take a look again! You can read more here: https://blog.travis-ci.com/2018-03-09-closing-old-issues

@stale stale bot added the stale label Jan 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant