siglo icon indicating copy to clipboard operation
siglo copied to clipboard

Sorting of version numbers such as 1.10.0

Open Peetz0r opened this issue 2 years ago • 0 comments

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

Peetz0r avatar Jun 29 '22 16:06 Peetz0r