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 version numbers such as 1.10.0 #115

Open
Peetz0r opened this issue Jun 29, 2022 · 0 comments
Open

Sorting of version numbers such as 1.10.0 #115

Peetz0r opened this issue Jun 29, 2022 · 0 comments

Comments

@Peetz0r
Copy link

Peetz0r commented Jun 29, 2022

1.10.0 is sorted between 1.1.0 and 1.2.0, not after (or before, really) 1.9.0.

There's multiple potential fixes:

  • use https://pypi.org/project/natsort/
  • use list.sort(key=lambda x: '{0:0>8}'.format(x).lower())
  • use list.sort(key=lambda x: [int(c) if c.isdigit() else c for c in re.split(r'(\d+)', x)])
  • leave it as an exercise for the user to find the latest version
    • use random.shuffle(list) but maybe only on april fools

Probably somewhere around https://github.com/theironrobin/siglo/blob/main/src/quick_deploy.py#L51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant