Skip to content

Commit dd11917

Browse files
committed
🐛 Removed level and serial from __version__
xtl.version:VersionInfo - New .string_safe property that returns a string representation in the form of {MAJOR}.{MINOR}.{MICRO} - Renamed .safe_tuple to .tuple_safe xtl.__version__ - This now equals to version.string_safe, rather than version.string - This previously caused an exception with setuptools when parsing the __version__ string
1 parent 353aec3 commit dd11917

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

src/xtl/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
from .version import version
77

8-
__version__ = version.string
9-
__version_tuple__ = version.safe_tuple
8+
__version__ = version.string_safe
9+
__version_tuple__ = version.tuple_safe
1010
__version_hex__ = version.hex
1111
__date__ = version.date
1212

src/xtl/config/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def _check_config_version(config_to_check):
211211
:return:
212212
"""
213213
current_version = __version_tuple__
214-
config_version = version_from_str(config_to_check['xtl']['version'].value).safe_tuple
214+
config_version = version_from_str(config_to_check['xtl']['version'].value).tuple_safe
215215
if config_version < current_version:
216216
warnings.warn(f'Using a config from an older version of XTL. Attempting to upgrade config...', ConfigWarning)
217217
config_to_check.upgrade_config()

src/xtl/version.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ def string(self):
5656
return (f'{self.major}.{self.minor}.{self.micro}{self.release_level}'
5757
f'{self.serial}')
5858

59+
@property
60+
def string_safe(self):
61+
"""
62+
Return a string representation of the version including only major, minor and
63+
micro levels (e.g., '1.2.3').
64+
"""
65+
return f'{self.major}.{self.minor}.{self.micro}'
66+
5967
@property
6068
def tuple(self) -> Tuple[int, int, int, str, int]:
6169
"""
@@ -64,7 +72,7 @@ def tuple(self) -> Tuple[int, int, int, str, int]:
6472
return self.major, self.minor, self.micro, self.release_level, self.serial
6573

6674
@property
67-
def safe_tuple(self) -> Tuple[int, int, int]:
75+
def tuple_safe(self) -> Tuple[int, int, int]:
6876
"""
6977
Return a tuple representation of the version including only major, minor and
7078
micro levels (e.g., (1, 2, 3)).
@@ -149,7 +157,7 @@ def version_from_hex(hex_str: str, date_str: str = None) -> VersionInfo:
149157
major=0,
150158
minor=1,
151159
micro=0,
152-
level=ReleaseLevel.ALPHA,
160+
level=ReleaseLevel.DEV,
153161
serial=0, # < 16
154162
date=datetime(year=2025, month=6, day=1),
155163
)

0 commit comments

Comments
 (0)