Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove __version__ from cli.py #323

Merged
merged 8 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions bittensor_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
# DEALINGS IN THE SOFTWARE.

from .cli import CLIManager
from .version import __version__, __version_as_int__


__version__ = "9.0.1"

__all__ = ["CLIManager", "__version__"]
__all__ = ["CLIManager"]
14 changes: 1 addition & 13 deletions bittensor_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
COLOR_PALETTE,
HYPERPARAMS,
)
from bittensor_cli.version import __version__, __version_as_int__
from bittensor_cli.src.bittensor import utils
from bittensor_cli.src.bittensor.balances import Balance
from async_substrate_interface.errors import SubstrateRequestException
Expand Down Expand Up @@ -73,21 +74,8 @@ class GitError(Exception):
pass


__version__ = "9.0.1"


_core_version = re.match(r"^\d+\.\d+\.\d+", __version__).group(0)
_version_split = _core_version.split(".")
__version_info__ = tuple(int(part) for part in _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

_epilog = "Made with [bold red]:heart:[/bold red] by The Openτensor Foundaτion"

np.set_printoptions(precision=8, suppress=True, floatmode="fixed")
Expand Down
18 changes: 18 additions & 0 deletions bittensor_cli/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import re

def version_as_int(version):
_core_version = re.match(r"^\d+\.\d+\.\d+", version).group(0)
_version_split = _core_version.split(".")
__version_info__ = tuple(int(part) for part in _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
return __version_as_int__

__version__ = "9.0.0"
__version_as_int__ = version_as_int(__version__)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def read_requirements(path):

# loading version from setup.py
with codecs.open(
os.path.join(here, "bittensor_cli/cli.py"), encoding="utf-8"
os.path.join(here, "bittensor_cli/version.py"), encoding="utf-8"
) as init_file:
version_match = re.search(
r"^__version__ = ['\"]([^'\"]*)['\"]", init_file.read(), re.M
Expand Down
Loading