FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Parse dlc versions · DeepLabCut/DeepLabCut@4dfe156 · GitHub

Commit 4dfe156

Browse files
committed
Parse dlc versions
1 parent 0ba016c commit 4dfe156

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

‎deeplabcut/gui/utils.py‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
#
99
# Licensed under GNU Lesser General Public License v3.0
1010
#
11+
from typing import Tuple
12+
1113
from PySide6 import QtCore
14+
import re
1215

1316

1417
class Worker(QtCore.QObject):
@@ -38,6 +41,17 @@ def stop_thread():
3841
return worker, thread
3942

4043

44+
def parse_version(version: str) -> Tuple[int, int, int]:
45+
"""
46+
Parses a version string into a tuple of (major, minor, patch).
47+
"""
48+
match = re.search(r"(\d+)\.(\d+)\.(\d+)", version)
49+
if match:
50+
return tuple(int(part) for part in match.groups())
51+
else:
52+
raise ValueError(f"Invalid version format: {version}")
53+
54+
4155
def is_latest_deeplabcut_version():
4256
import json
4357
import urllib.request
@@ -46,4 +60,4 @@ def is_latest_deeplabcut_version():
4660
url = "https://pypi.org/pypi/deeplabcut/json"
4761
contents = urllib.request.urlopen(url).read()
4862
latest_version = json.loads(contents)["info"]["version"]
49-
return VERSION == latest_version, latest_version
63+
return parse_version(VERSION) >= parse_version(latest_version), latest_version

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL