bittensor-cli 9.2.0__py3-none-any.whl → 9.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  import asyncio
2
+ import json
2
3
  import os
3
4
  from datetime import datetime, timedelta
4
5
  from typing import TYPE_CHECKING
@@ -9,7 +10,12 @@ from numpy.typing import NDArray
9
10
  from rich.prompt import Confirm
10
11
  from async_substrate_interface.errors import SubstrateRequestException
11
12
 
12
- from bittensor_cli.src.bittensor.utils import err_console, console, format_error_message
13
+ from bittensor_cli.src.bittensor.utils import (
14
+ err_console,
15
+ console,
16
+ format_error_message,
17
+ json_console,
18
+ )
13
19
  from bittensor_cli.src.bittensor.extrinsics.root import (
14
20
  convert_weights_and_uids_for_emit,
15
21
  generate_weight_hash,
@@ -260,7 +266,6 @@ class SetWeightsExtrinsic:
260
266
  if not self.wait_for_finalization and not self.wait_for_inclusion:
261
267
  return True, "Not waiting for finalization or inclusion."
262
268
 
263
- await response.process_events()
264
269
  if await response.is_success:
265
270
  return True, "Successfully set weights."
266
271
  else:
@@ -316,7 +321,6 @@ class SetWeightsExtrinsic:
316
321
  success, error_message = True, ""
317
322
 
318
323
  else:
319
- await response.process_events()
320
324
  if await response.is_success:
321
325
  success, error_message = True, ""
322
326
  else:
@@ -354,7 +358,6 @@ class SetWeightsExtrinsic:
354
358
  if not self.wait_for_finalization and not self.wait_for_inclusion:
355
359
  return True, None
356
360
 
357
- await response.process_events()
358
361
  if await response.is_success:
359
362
  return True, None
360
363
  else:
@@ -372,6 +375,7 @@ async def reveal_weights(
372
375
  weights: list[float],
373
376
  salt: list[int],
374
377
  version: int,
378
+ json_output: bool = False,
375
379
  prompt: bool = True,
376
380
  ) -> None:
377
381
  """Reveal weights for a specific subnet."""
@@ -395,11 +399,13 @@ async def reveal_weights(
395
399
  subtensor, wallet, netuid, uids_, weights_, list(salt_), version, prompt=prompt
396
400
  )
397
401
  success, message = await extrinsic.reveal(weight_uids, weight_vals)
398
-
399
- if success:
400
- console.print("Weights revealed successfully")
402
+ if json_output:
403
+ json_console.print(json.dumps({"success": success, "message": message}))
401
404
  else:
402
- err_console.print(f"Failed to reveal weights: {message}")
405
+ if success:
406
+ console.print("Weights revealed successfully")
407
+ else:
408
+ err_console.print(f"Failed to reveal weights: {message}")
403
409
 
404
410
 
405
411
  async def commit_weights(
@@ -410,6 +416,7 @@ async def commit_weights(
410
416
  weights: list[float],
411
417
  salt: list[int],
412
418
  version: int,
419
+ json_output: bool = False,
413
420
  prompt: bool = True,
414
421
  ):
415
422
  """Commits weights and then reveals them for a specific subnet"""
@@ -429,7 +436,10 @@ async def commit_weights(
429
436
  subtensor, wallet, netuid, uids_, weights_, list(salt_), version, prompt=prompt
430
437
  )
431
438
  success, message = await extrinsic.set_weights_extrinsic()
432
- if success:
433
- console.print("Weights set successfully")
439
+ if json_output:
440
+ json_console.print(json.dumps({"success": success, "message": message}))
434
441
  else:
435
- err_console.print(f"Failed to commit weights: {message}")
442
+ if success:
443
+ console.print("Weights set successfully")
444
+ else:
445
+ err_console.print(f"Failed to commit weights: {message}")
bittensor_cli/version.py CHANGED
@@ -1,20 +1,23 @@
1
+ import importlib.metadata
1
2
  import re
2
3
 
3
4
 
4
5
  def version_as_int(version):
5
- _core_version = re.match(r"^\d+\.\d+\.\d+", version).group(0)
6
- _version_split = _core_version.split(".")
7
- __version_info__ = tuple(int(part) for part in _version_split)
8
- _version_int_base = 1000
9
- assert max(__version_info__) < _version_int_base
6
+ match = re.match(r"^\d+\.\d+\.\d+", version)
7
+ if not match:
8
+ raise ValueError(f"Invalid version format: {version}")
9
+ core_version = match.group(0)
10
+ version_split = core_version.split(".")
11
+ version_info = tuple(int(part) for part in version_split)
12
+ version_int_base = 1000
13
+ assert max(version_info) < version_int_base
10
14
 
11
- __version_as_int__: int = sum(
12
- e * (_version_int_base**i) for i, e in enumerate(reversed(__version_info__))
15
+ version_as_int_: int = sum(
16
+ e * (version_int_base**i) for i, e in enumerate(reversed(version_info))
13
17
  )
14
- assert __version_as_int__ < 2**31 # fits in int32
15
- __new_signature_version__ = 360
16
- return __version_as_int__
18
+ assert version_as_int_ < 2**31 # fits in int32
19
+ return version_as_int_
17
20
 
18
21
 
19
- __version__ = "9.1.4"
22
+ __version__ = importlib.metadata.version("bittensor-cli")
20
23
  __version_as_int__ = version_as_int(__version__)
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: bittensor-cli
3
- Version: 9.2.0
3
+ Version: 9.4.0
4
4
  Summary: Bittensor CLI
5
5
  Author: bittensor.com
6
6
  Project-URL: homepage, https://github.com/opentensor/btcli
@@ -9,28 +9,27 @@ Requires-Python: <3.14,>=3.9
9
9
  Description-Content-Type: text/markdown
10
10
  Requires-Dist: wheel
11
11
  Requires-Dist: async-property==0.2.2
12
- Requires-Dist: async-substrate-interface>=1.0.8
12
+ Requires-Dist: async-substrate-interface>=1.1.0
13
13
  Requires-Dist: aiohttp~=3.10.2
14
14
  Requires-Dist: backoff~=2.2.1
15
15
  Requires-Dist: GitPython>=3.0.0
16
16
  Requires-Dist: fuzzywuzzy~=0.18.0
17
17
  Requires-Dist: netaddr~=1.3.0
18
- Requires-Dist: numpy>=2.0.1
18
+ Requires-Dist: numpy<3.0.0,>=2.0.1
19
19
  Requires-Dist: Jinja2
20
20
  Requires-Dist: pycryptodome<4.0.0,>=3.0.0
21
21
  Requires-Dist: PyYAML~=6.0.1
22
22
  Requires-Dist: pytest
23
23
  Requires-Dist: python-Levenshtein
24
- Requires-Dist: rich~=13.7
24
+ Requires-Dist: rich<15.0,>=13.7
25
25
  Requires-Dist: scalecodec==1.2.11
26
- Requires-Dist: typer~=0.12
27
- Requires-Dist: websockets>=14.1
28
- Requires-Dist: bittensor-wallet>=3.0.4
26
+ Requires-Dist: typer<0.16,>=0.12
27
+ Requires-Dist: bittensor-wallet>=3.0.7
29
28
  Requires-Dist: plotille>=5.0.0
30
29
  Requires-Dist: pywry>=0.6.2
31
30
  Requires-Dist: plotly>=6.0.0
32
31
  Provides-Extra: cuda
33
- Requires-Dist: torch<2.6.0,>=1.13.1; extra == "cuda"
32
+ Requires-Dist: torch<3.0,>=1.13.1; extra == "cuda"
34
33
 
35
34
  <div align="center">
36
35
 
@@ -0,0 +1,35 @@
1
+ bittensor_cli/__init__.py,sha256=Lpv4NkbAQgwrfqFOnTMuR_S-fqGdaWCSLhxnFnGTHM0,1232
2
+ bittensor_cli/cli.py,sha256=4EMdoHWqaf7rDZ-rpaVRpwfHRivd4WA2oFGCxx6hoTU,215699
3
+ bittensor_cli/doc_generation_helper.py,sha256=GexqjEIKulWg84hpNBEchJ840oOgOi7DWpt447nsdNI,91
4
+ bittensor_cli/version.py,sha256=dU1xsa3mG5FPdhzvqlzDByNcCHmzcFQH3q1pQr4u76g,720
5
+ bittensor_cli/src/__init__.py,sha256=XKTcdTy31G6NTJd9KqQmiDBeKbqgqJJcVPg3NbcRQaw,33858
6
+ bittensor_cli/src/bittensor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ bittensor_cli/src/bittensor/balances.py,sha256=q5KkxF8wmUguWAFddEKstfDKTxPe5ISHpT6br8x32rc,11148
8
+ bittensor_cli/src/bittensor/chain_data.py,sha256=yOQyPZ472BlfhAfaemdi22qunEGHlVvugRdUeYpZxwQ,41663
9
+ bittensor_cli/src/bittensor/minigraph.py,sha256=BIzmSVLfBYiRAeGD_i1LAC8Cw7zxp38a91SIFEPMqYc,10479
10
+ bittensor_cli/src/bittensor/networking.py,sha256=pZLMs8YXpZzDMLXWMBb_Bj6TVkm_q9khyY-lnbwVMuE,462
11
+ bittensor_cli/src/bittensor/subtensor_interface.py,sha256=JqbraGNGfEfUFff5ZwQJSzIep2IDfuuyFJzzxCr2NLA,58883
12
+ bittensor_cli/src/bittensor/utils.py,sha256=L8BW1bjC6X22nQDuq0kghoVGc0MC4Axp7AK8MKqbXBM,47647
13
+ bittensor_cli/src/bittensor/extrinsics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
+ bittensor_cli/src/bittensor/extrinsics/registration.py,sha256=mZt6z8PRK5MaIczLygmVvAUnfl_dl5zDF7ysIFkwHvs,64511
15
+ bittensor_cli/src/bittensor/extrinsics/root.py,sha256=rVogWhT28NJ1CrVXtbq_Pyi7etB_zTZicbjiHAHLdSs,19214
16
+ bittensor_cli/src/bittensor/extrinsics/transfer.py,sha256=vxLzKQkTSsV-ark7WAJjEN4QasEJI_9MXt2Dg8eR2j4,8569
17
+ bittensor_cli/src/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
+ bittensor_cli/src/commands/sudo.py,sha256=y5PTJEa7LI6vUXazRjXsphMA4lQdKR8axcLZXQSdyp4,32993
19
+ bittensor_cli/src/commands/view.py,sha256=2MdhWWbY9rwGqDilzs8r2ioa0l2GzrYxe8pKkavEVWs,109517
20
+ bittensor_cli/src/commands/wallets.py,sha256=N3ERh4Iw0juJSy9-AUQaTC1SfZsklD-lxCcFfODfcGE,73142
21
+ bittensor_cli/src/commands/weights.py,sha256=BCJm_mlw0pVK4YEZuEMqQBpvvOoB7B1rzdvMeN3uTfM,16503
22
+ bittensor_cli/src/commands/stake/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
+ bittensor_cli/src/commands/stake/add.py,sha256=Pe4N_I8DKlfN_Ks-X9yu2pMP5jBs__fa2TPLcb6oBKc,26935
24
+ bittensor_cli/src/commands/stake/children_hotkeys.py,sha256=lMiV-Z3SGZUEapdy0LRthFLx0RlFK0KVxytE47ybdEc,31746
25
+ bittensor_cli/src/commands/stake/list.py,sha256=xLHqEflRLg3vmMop92JgAn88oAy4YdhaIGBcHOYgCak,30038
26
+ bittensor_cli/src/commands/stake/move.py,sha256=AVeo0l4bvGAtjbdzx2Fn7_-jiI28B7LMlJGVZWT6mKg,35881
27
+ bittensor_cli/src/commands/stake/remove.py,sha256=l7TtLK2Z6-TJ5-DEwUzm6HT2GQC-MhKZS9SONS9DKtA,49902
28
+ bittensor_cli/src/commands/subnets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
+ bittensor_cli/src/commands/subnets/price.py,sha256=O8oK12hCtm1asQGx2MR1xtYA9ygkklhFtXvBON4DcGM,30069
30
+ bittensor_cli/src/commands/subnets/subnets.py,sha256=yTQYKOddAtxvL7AUXvJx7Y_tDSZa5QjMrDMwtQOukWM,93353
31
+ bittensor_cli-9.4.0.dist-info/METADATA,sha256=NYNjeKf3zEhyK6hHK9v6aMX9yYwzwQqLLwtFdIrMi7o,6460
32
+ bittensor_cli-9.4.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
33
+ bittensor_cli-9.4.0.dist-info/entry_points.txt,sha256=hBTLGLbVxmAKy69XSKaUZvjTCmyEzDGZKq4S8UOto8I,49
34
+ bittensor_cli-9.4.0.dist-info/top_level.txt,sha256=DvgvXpmTtI_Q1BbDZMlK90LFcGFCreN1daViEPV2iFw,14
35
+ bittensor_cli-9.4.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.45.1)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,35 +0,0 @@
1
- bittensor_cli/__init__.py,sha256=Lpv4NkbAQgwrfqFOnTMuR_S-fqGdaWCSLhxnFnGTHM0,1232
2
- bittensor_cli/cli.py,sha256=HbU3AOCiAmicOLA9U-7q92NC9Cmf0p_8qjlabSscaWc,197905
3
- bittensor_cli/doc_generation_helper.py,sha256=GexqjEIKulWg84hpNBEchJ840oOgOi7DWpt447nsdNI,91
4
- bittensor_cli/version.py,sha256=laVzyT8eo7SMikK5aTb16S3zsLEpmIzwpNLCcb_IU1w,623
5
- bittensor_cli/src/__init__.py,sha256=gSRsPtIDWe5FM93ItTjLDp3ZRwS6szo44sOYyMyFlso,27679
6
- bittensor_cli/src/bittensor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- bittensor_cli/src/bittensor/balances.py,sha256=q5KkxF8wmUguWAFddEKstfDKTxPe5ISHpT6br8x32rc,11148
8
- bittensor_cli/src/bittensor/chain_data.py,sha256=IPgimCD3US5xZqoIBvH4jQza4LDbfUIpFfl_Orgok1Q,41637
9
- bittensor_cli/src/bittensor/minigraph.py,sha256=BIzmSVLfBYiRAeGD_i1LAC8Cw7zxp38a91SIFEPMqYc,10479
10
- bittensor_cli/src/bittensor/networking.py,sha256=pZLMs8YXpZzDMLXWMBb_Bj6TVkm_q9khyY-lnbwVMuE,462
11
- bittensor_cli/src/bittensor/subtensor_interface.py,sha256=FM3wiKPIDeclHQNFvzLlvCfLrncPPSYIUtU8HYFEXmE,56982
12
- bittensor_cli/src/bittensor/utils.py,sha256=6oJmqiW-ECEobs0z37Eyzu__MfvEU0DyAD_j3FCfzmI,47530
13
- bittensor_cli/src/bittensor/extrinsics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- bittensor_cli/src/bittensor/extrinsics/registration.py,sha256=3mJZ3hw_wZEa-8I0R8WVuKjMQi4Y9EV5FjTCvbY37Iw,63780
15
- bittensor_cli/src/bittensor/extrinsics/root.py,sha256=N9Fg4VaveRRP1ZN4EZjIWCe04FpTNBKWFqx8USKp9uQ,19062
16
- bittensor_cli/src/bittensor/extrinsics/transfer.py,sha256=FyrRo3yk-065toN4f-1Xes23CE5tqP5KU0dBJkKofUc,8476
17
- bittensor_cli/src/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
- bittensor_cli/src/commands/sudo.py,sha256=bSS9nIWeCYf4nqqBYuoTkVDDA2Fm2Di3UG5xlUMJ6yM,31372
19
- bittensor_cli/src/commands/view.py,sha256=2MdhWWbY9rwGqDilzs8r2ioa0l2GzrYxe8pKkavEVWs,109517
20
- bittensor_cli/src/commands/wallets.py,sha256=AGV8JFCvRE_OOJv6NozxmyO4Cvf4y5HYXVfI_1kl70M,50736
21
- bittensor_cli/src/commands/weights.py,sha256=uI7aACKD90JOtYt61VdKL76z7Fe_wh4WtdwMXL6ydD4,16269
22
- bittensor_cli/src/commands/stake/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
- bittensor_cli/src/commands/stake/add.py,sha256=xJLVcU7RZmksxU29gNh22WLiL5ZWcIm1dKEeYo4IfMc,25816
24
- bittensor_cli/src/commands/stake/children_hotkeys.py,sha256=Eg0Rq_R2DYBsjEBqqNHElJchQ6MlZePkW_oWlifXfSY,29782
25
- bittensor_cli/src/commands/stake/list.py,sha256=G7YLP68sq-qmWKPuIy2s6cMYK7XTz0oaMDK4JWR7aBE,28577
26
- bittensor_cli/src/commands/stake/move.py,sha256=T9sP3CnZW2hWB2gI0J5mVvT_CGooFMjJQoB95otiS2w,35821
27
- bittensor_cli/src/commands/stake/remove.py,sha256=huHinuNYCZx9fLwYcYELGS13X3rDG3OsKMsqICOtXDM,49486
28
- bittensor_cli/src/commands/subnets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
- bittensor_cli/src/commands/subnets/price.py,sha256=TWcRXUFeS_Q-pfyv0YIluAL8SE7d2gzTODK-9M2J5pw,29878
30
- bittensor_cli/src/commands/subnets/subnets.py,sha256=d41oWtxOfr4a2QxW3v_P2weELtUOr1vRx4Vi0HzN87s,83935
31
- bittensor_cli-9.2.0.dist-info/METADATA,sha256=yi6Yd5E8dLmt9UeUcmhewA7GOITtGkLufezrn2tuS78,6475
32
- bittensor_cli-9.2.0.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
33
- bittensor_cli-9.2.0.dist-info/entry_points.txt,sha256=hBTLGLbVxmAKy69XSKaUZvjTCmyEzDGZKq4S8UOto8I,49
34
- bittensor_cli-9.2.0.dist-info/top_level.txt,sha256=DvgvXpmTtI_Q1BbDZMlK90LFcGFCreN1daViEPV2iFw,14
35
- bittensor_cli-9.2.0.dist-info/RECORD,,