Skip to content

Commit

Permalink
Fix ordering of versions for alphas > 9 (#129)
Browse files Browse the repository at this point in the history
* Fix ordering of versions for alphas > 9

* Account for the unlikely event that the versions have a v prepended
  • Loading branch information
sneridagh committed Mar 21, 2024
1 parent 6c644d4 commit 61c870e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions local_extensions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import List, Optional

import requests
import semver
from cookiecutter.utils import simple_filter

REGISTRIES = {
Expand Down Expand Up @@ -62,8 +63,10 @@ def latest_version(
version=v, min_version=min_version, max_version=max_version
)
],
key=lambda v: semver.VersionInfo.parse(v.replace("v", "")),
reverse=True,
)

if not include_alphas:
valid = [v for v in valid if "-" not in v]
return valid[0]
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ requests_mock
pytest
pytest-cookies
wheel
semver

0 comments on commit 61c870e

Please sign in to comment.