Skip to content

Commit

Permalink
fix __version_as_int__ for >10 minor/patch release vers (resolves ope…
Browse files Browse the repository at this point in the history
  • Loading branch information
mjurbanski-reef committed Jun 8, 2024
1 parent 27c9908 commit 11645e6
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions bittensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,15 @@
# Bittensor code and protocol version.
__version__ = "7.0.0"

version_split = __version__.split(".")
__version_as_int__: int = (
(100 * int(version_split[0]))
+ (10 * int(version_split[1]))
+ (1 * int(version_split[2]))
_version_split = __version__.split(".")
__version_info__ = tuple(map(int, _version_split))
_version_int_base = 1000
assert max(__version_info__) < _version_int_base

__version_as_int__: int = sum(
e * (_version_int_base**i) for i, e in enumerate(reversed(__version_info__))
)
assert __version_as_int__ < 2**31 # fits in int32
__new_signature_version__ = 360

# Rich console.
Expand All @@ -58,6 +61,16 @@
install(show_locals=False)


def __getattr__(name):
if name == "version_split":
warnings.warn(
"version_split is deprecated and will be removed in future versions. Use __version__ instead.",
DeprecationWarning,
)
return _version_split
raise AttributeError(f"module {__name__} has no attribute {name}")


def turn_console_off():
global __use_console__
global __console__
Expand Down

0 comments on commit 11645e6

Please sign in to comment.