Skip to content

Sort the return value of python_versions #1074

@angelo-peronio

Description

@angelo-peronio

How would this feature be useful?

If called with max_version=None, python_versions returns a list of versions read from the Trove classifiers. I propose to sort that list before returning it, so that the oldest supported Python version is python_versions()[0], and the most recent one python_versions()[-1].

Describe the solution you'd like

For instance:

from packaging.version import Version

then this line

return from_classifiers

becomes

    return sorted(from_classifiers, key=Version)

Describe alternatives you've considered

Of course, any sane pyproject.toml will have the classifiers already sorted, but should we rely on common sense?

Anything else?

I can prepare a pull request.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions