Skip to content

Commit f2af18b

Browse files
committed
Pull the version from the toml file.
1 parent 6c82ee8 commit f2af18b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

bittensor_cli/version.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
import re
2+
import toml
3+
import pathlib
4+
5+
6+
def get_toml_version():
7+
toml_file = pathlib.Path(__file__).parent.parent / "pyproject.toml"
8+
with open(toml_file, "r") as f:
9+
tf = toml.load(f)
10+
return tf["project"]["version"]
211

312

413
def version_as_int(version):
@@ -16,5 +25,9 @@ def version_as_int(version):
1625
return __version_as_int__
1726

1827

19-
__version__ = "9.2.0"
28+
__version__ = get_toml_version()
2029
__version_as_int__ = version_as_int(__version__)
30+
31+
32+
if __name__ == "__main__":
33+
print(get_toml_version())

0 commit comments

Comments
 (0)