Skip to content

Commit

Permalink
fix that int str issue
Browse files Browse the repository at this point in the history
  • Loading branch information
chrishavlin committed Aug 2, 2023
1 parent 55f5834 commit b18fb99
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/yt_napari/schemas/_version_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from yt_napari._version import version, version_tuple
from yt_napari.logging import ytnapari_log

_version_tuple = tuple([int(i) for i in version_tuple[:3]])


def schema_version_is_valid(
schema_version: str, dev_version_check: bool = True
Expand All @@ -16,7 +18,7 @@ def schema_version_is_valid(
# now we check the actual version. since the schema prefix (yt-napari) is
# in the supplied schema_version, we can assume a form of yt-napari_x.x.x.json
sc_version = _schema_version_tuple_from_str(schema_version)
if sc_version < version_tuple[:3]:
if sc_version < _version_tuple:
# using an old schema. lets try anyway, but pass along a warning.
msg = (
f"The version of the supplied schema:\n {schema_version} \n"
Expand All @@ -26,7 +28,7 @@ def schema_version_is_valid(
f" yt-napari version that matches your specified schema."
)
ytnapari_log.warning(msg)
elif sc_version > version_tuple[:3]:
elif sc_version > _version_tuple:
if dev_version_check and "dev" in version:
msg = (
"You are running a development version of yt-napari, so your "
Expand All @@ -50,7 +52,7 @@ def _schema_version_tuple_from_str(schema_version_raw: str) -> Tuple[int, int, i
# schema_version_raw may be a single string or a file-like address

if "yt-napari_latest" in schema_version_raw:
return version_tuple[:3]
return _version_tuple

schema_end = schema_version_raw.split("/")[-1]
v_schema = schema_end.replace(InputModel._schema_prefix, "")
Expand Down

0 comments on commit b18fb99

Please sign in to comment.