bittensor-cli 9.0.0rc3__py3-none-any.whl → 9.0.0rc4__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.
bittensor_cli/__init__.py CHANGED
@@ -18,6 +18,6 @@
18
18
  from .cli import CLIManager
19
19
 
20
20
 
21
- __version__ = "9.0.0rc3"
21
+ __version__ = "9.0.0rc4"
22
22
 
23
23
  __all__ = [CLIManager, __version__]
bittensor_cli/cli.py CHANGED
@@ -72,7 +72,7 @@ except ImportError:
72
72
  pass
73
73
 
74
74
 
75
- __version__ = "9.0.0rc3"
75
+ __version__ = "9.0.0rc4"
76
76
 
77
77
 
78
78
  _core_version = re.match(r"^\d+\.\d+\.\d+", __version__).group(0)
@@ -2919,6 +2919,7 @@ class CLIManager:
2919
2919
  subnets.show(
2920
2920
  subtensor=self.initialize_chain(network),
2921
2921
  netuid=netuid,
2922
+ sort=False,
2922
2923
  max_rows=12,
2923
2924
  prompt=False,
2924
2925
  delegate_selection=True,
@@ -4327,6 +4328,11 @@ class CLIManager:
4327
4328
  self,
4328
4329
  network: Optional[list[str]] = Options.network,
4329
4330
  netuid: int = Options.netuid,
4331
+ sort: bool = typer.Option(
4332
+ False,
4333
+ "--sort",
4334
+ help="Sort the subnets by uid.",
4335
+ ),
4330
4336
  quiet: bool = Options.quiet,
4331
4337
  verbose: bool = Options.verbose,
4332
4338
  prompt: bool = Options.prompt,
@@ -4342,8 +4348,11 @@ class CLIManager:
4342
4348
  subtensor = self.initialize_chain(network)
4343
4349
  return self._run_command(
4344
4350
  subnets.show(
4345
- subtensor,
4346
- netuid,
4351
+ subtensor=subtensor,
4352
+ netuid=netuid,
4353
+ sort=sort,
4354
+ max_rows=None,
4355
+ delegate_selection=False,
4347
4356
  verbose=verbose,
4348
4357
  prompt=prompt,
4349
4358
  )
@@ -326,7 +326,7 @@ async def subnets_list(
326
326
  if netuid == 0:
327
327
  emission_tao = 0.0
328
328
  else:
329
- emission_tao = subnet.emission.tao
329
+ emission_tao = subnet.tao_in_emission.tao
330
330
 
331
331
  alpha_in_value = (
332
332
  f"{millify_tao(subnet.alpha_in.tao)}"
@@ -399,7 +399,7 @@ async def subnets_list(
399
399
  )
400
400
 
401
401
  total_emissions = round(
402
- sum(float(subnet.emission.tao) for subnet in subnets if subnet.netuid != 0),
402
+ sum(subnet.tao_in_emission.tao for subnet in subnets if subnet.netuid != 0),
403
403
  4,
404
404
  )
405
405
  total_rate = round(
@@ -528,7 +528,7 @@ async def subnets_list(
528
528
  if netuid == 0:
529
529
  emission_tao = 0.0
530
530
  else:
531
- emission_tao = subnet.emission.tao
531
+ emission_tao = subnet.tao_in_emission.tao
532
532
 
533
533
  market_cap = (subnet.alpha_in.tao + subnet.alpha_out.tao) * subnet.price.tao
534
534
  supply = subnet.alpha_in.tao + subnet.alpha_out.tao
@@ -657,7 +657,7 @@ async def subnets_list(
657
657
  # Calculate totals
658
658
  total_netuids = len(subnets)
659
659
  _total_emissions = sum(
660
- float(subnet.emission.tao) for subnet in subnets if subnet.netuid != 0
660
+ subnet.tao_in_emission.tao for subnet in subnets if subnet.netuid != 0
661
661
  )
662
662
  total_emissions = (
663
663
  f"{millify_tao(_total_emissions)}"
@@ -665,9 +665,7 @@ async def subnets_list(
665
665
  else f"{_total_emissions:,.2f}"
666
666
  )
667
667
 
668
- total_rate = sum(
669
- float(subnet.price.tao) for subnet in subnets if subnet.netuid != 0
670
- )
668
+ total_rate = sum(subnet.price.tao for subnet in subnets if subnet.netuid != 0)
671
669
  total_rate = (
672
670
  f"{millify_tao(total_rate)}" if not verbose else f"{total_rate:,.2f}"
673
671
  )
@@ -804,6 +802,7 @@ async def subnets_list(
804
802
  async def show(
805
803
  subtensor: "SubtensorInterface",
806
804
  netuid: int,
805
+ sort: bool = False,
807
806
  max_rows: Optional[int] = None,
808
807
  delegate_selection: bool = False,
809
808
  verbose: bool = False,
@@ -850,18 +849,6 @@ async def show(
850
849
  )
851
850
 
852
851
  table.add_column("[bold white]Position", style="white", justify="center")
853
- # table.add_column(
854
- # f"[bold white]Total Stake ({Balance.get_unit(0)})",
855
- # style=COLOR_PALETTE["POOLS"]["ALPHA_IN"],
856
- # justify="center",
857
- # )
858
- # ------- Temporary columns for testing -------
859
- # table.add_column(
860
- # "Alpha (τ)",
861
- # style=COLOR_PALETTE["POOLS"]["EXTRA_2"],
862
- # no_wrap=True,
863
- # justify="right",
864
- # )
865
852
  table.add_column(
866
853
  "Tao (τ)",
867
854
  style=COLOR_PALETTE["POOLS"]["EXTRA_2"],
@@ -869,7 +856,6 @@ async def show(
869
856
  justify="right",
870
857
  footer=f"{tao_sum:.4f} τ" if verbose else f"{millify_tao(tao_sum)} τ",
871
858
  )
872
- # ------- End Temporary columns for testing -------
873
859
  table.add_column(
874
860
  f"[bold white]Emission ({Balance.get_unit(0)}/block)",
875
861
  style=COLOR_PALETTE["POOLS"]["EMISSION"],
@@ -1075,14 +1061,6 @@ async def show(
1075
1061
  pad_edge=True,
1076
1062
  )
1077
1063
 
1078
- # For hotkey_block_emission calculation
1079
- emission_sum = sum(
1080
- [
1081
- subnet_state.emission[idx].tao
1082
- for idx in range(len(subnet_state.emission))
1083
- ]
1084
- )
1085
-
1086
1064
  # For table footers
1087
1065
  alpha_sum = sum(
1088
1066
  [
@@ -1102,7 +1080,16 @@ async def show(
1102
1080
  for idx in range(len(subnet_state.tao_stake))
1103
1081
  ]
1104
1082
  )
1105
- relative_emissions_sum = 0
1083
+ dividends_sum = sum(
1084
+ subnet_state.dividends[idx] for idx in range(len(subnet_state.dividends))
1085
+ )
1086
+ emission_sum = sum(
1087
+ [
1088
+ subnet_state.emission[idx].tao
1089
+ for idx in range(len(subnet_state.emission))
1090
+ ]
1091
+ )
1092
+
1106
1093
  owner_hotkeys = await subtensor.get_owned_hotkeys(subnet_info.owner_coldkey)
1107
1094
  if subnet_info.owner_hotkey not in owner_hotkeys:
1108
1095
  owner_hotkeys.append(subnet_info.owner_hotkey)
@@ -1118,25 +1105,24 @@ async def show(
1118
1105
  sorted_indices = sorted(
1119
1106
  range(len(subnet_state.hotkeys)),
1120
1107
  key=lambda i: (
1121
- # Sort by owner status first
1122
- not (
1123
- subnet_state.coldkeys[i] == subnet_info.owner_coldkey
1124
- or subnet_state.hotkeys[i] in owner_hotkeys
1125
- ),
1126
- # Then sort by stake amount (higher stakes first)
1127
- -subnet_state.total_stake[i].tao,
1108
+ # If sort is True, sort only by UIDs
1109
+ i
1110
+ if sort
1111
+ else (
1112
+ # Otherwise
1113
+ # Sort by owner status first
1114
+ not (
1115
+ subnet_state.coldkeys[i] == subnet_info.owner_coldkey
1116
+ or subnet_state.hotkeys[i] in owner_hotkeys
1117
+ ),
1118
+ # Then sort by stake amount (higher stakes first)
1119
+ -subnet_state.total_stake[i].tao,
1120
+ )
1128
1121
  ),
1129
1122
  )
1130
1123
 
1131
1124
  rows = []
1132
1125
  for idx in sorted_indices:
1133
- hotkey_block_emission = (
1134
- subnet_state.emission[idx].tao / emission_sum
1135
- if emission_sum != 0
1136
- else 0
1137
- )
1138
- relative_emissions_sum += hotkey_block_emission
1139
-
1140
1126
  # Get identity for this uid
1141
1127
  coldkey_identity = identities.get(subnet_state.coldkeys[idx], {}).get(
1142
1128
  "name", ""
@@ -1175,11 +1161,9 @@ async def show(
1175
1161
  f"τ {tao_stake.tao:.4f}"
1176
1162
  if verbose
1177
1163
  else f"τ {millify_tao(tao_stake)}", # Tao Stake
1178
- # str(subnet_state.dividends[idx]),
1179
- f"{Balance.from_tao(hotkey_block_emission).set_unit(netuid_).tao:.5f}", # Dividends
1180
- f"{subnet_state.incentives[idx]:.4f}", # Incentive
1181
- # f"{Balance.from_tao(hotkey_block_emission).set_unit(netuid_).tao:.5f}", # Emissions relative
1182
- f"{Balance.from_tao(subnet_state.emission[idx].tao).set_unit(netuid_).tao:.5f} {subnet_info.symbol}", # Emissions
1164
+ f"{subnet_state.dividends[idx]:.6f}", # Dividends
1165
+ f"{subnet_state.incentives[idx]:.6f}", # Incentive
1166
+ f"{Balance.from_tao(subnet_state.emission[idx].tao).set_unit(netuid_).tao:.6f} {subnet_info.symbol}", # Emissions
1183
1167
  f"{subnet_state.hotkeys[idx][:6]}"
1184
1168
  if not verbose
1185
1169
  else f"{subnet_state.hotkeys[idx]}", # Hotkey
@@ -1201,7 +1185,6 @@ async def show(
1201
1185
  if verbose
1202
1186
  else f"{millify_tao(stake_sum)} {subnet_info.symbol}",
1203
1187
  )
1204
- # ------- Temporary columns for testing -------
1205
1188
  table.add_column(
1206
1189
  f"Alpha ({Balance.get_unit(netuid_)})",
1207
1190
  style=COLOR_PALETTE["POOLS"]["EXTRA_2"],
@@ -1220,24 +1203,14 @@ async def show(
1220
1203
  if verbose
1221
1204
  else f"{millify_tao(tao_sum)} {subnet_info.symbol}",
1222
1205
  )
1223
- # ------- End Temporary columns for testing -------
1224
1206
  table.add_column(
1225
1207
  "Dividends",
1226
1208
  style=COLOR_PALETTE["POOLS"]["EMISSION"],
1227
1209
  no_wrap=True,
1228
1210
  justify="center",
1229
- footer=f"{relative_emissions_sum:.3f}",
1211
+ footer=f"{dividends_sum:.3f}",
1230
1212
  )
1231
1213
  table.add_column("Incentive", style="#5fd7ff", no_wrap=True, justify="center")
1232
-
1233
- # Hiding relative emissions for now
1234
- # table.add_column(
1235
- # "Emissions",
1236
- # style="light_goldenrod2",
1237
- # no_wrap=True,
1238
- # justify="center",
1239
- # footer=f"{relative_emissions_sum:.3f}",
1240
- # )
1241
1214
  table.add_column(
1242
1215
  f"Emissions ({Balance.get_unit(netuid_)})",
1243
1216
  style=COLOR_PALETTE["POOLS"]["EMISSION"],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bittensor-cli
3
- Version: 9.0.0rc3
3
+ Version: 9.0.0rc4
4
4
  Summary: Bittensor CLI
5
5
  Home-page: https://github.com/opentensor/btcli
6
6
  Author: bittensor.com
@@ -1,5 +1,5 @@
1
- bittensor_cli/__init__.py,sha256=YX8OskQfG3JniPn1PBQiNGwKoaZdWQq6dZzuKf-AEiU,1216
2
- bittensor_cli/cli.py,sha256=7iJeZaaWrNDkxDCfxBnQDPnNo00kkvFNvjqfOsyloYU,186413
1
+ bittensor_cli/__init__.py,sha256=9HvyLfJ2pUxwPjgT8Aqp6uWbkuD-TKrpVMLUBeD9U9A,1216
2
+ bittensor_cli/cli.py,sha256=LHeltSOQArKSc2Fct6dIUwXPoJs1pJoA4Y0aHvDGC_g,186698
3
3
  bittensor_cli/doc_generation_helper.py,sha256=GexqjEIKulWg84hpNBEchJ840oOgOi7DWpt447nsdNI,91
4
4
  bittensor_cli/src/__init__.py,sha256=CBUMVER1JwPi2bWXhpPJ4xtZqPZyvekExOS7Fv6HtAE,25531
5
5
  bittensor_cli/src/bittensor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -26,9 +26,9 @@ bittensor_cli/src/commands/stake/move.py,sha256=YEXz5BfhAaQUJYyG11qnhXvFsSmz6ZJ6
26
26
  bittensor_cli/src/commands/stake/remove.py,sha256=T8poiXia_9hexiVXdi7YG6SzicoEt2sIybN2SIFDyP4,43393
27
27
  bittensor_cli/src/commands/subnets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  bittensor_cli/src/commands/subnets/price.py,sha256=TWcRXUFeS_Q-pfyv0YIluAL8SE7d2gzTODK-9M2J5pw,29878
29
- bittensor_cli/src/commands/subnets/subnets.py,sha256=a4g5Dcx28Jzrlh2HE2VQ7iEpRSnx9XUFyy1gGGPM0v0,80882
30
- bittensor_cli-9.0.0rc3.dist-info/METADATA,sha256=1_1g0nfhxebpyTfBUV5Td8HtosC3TkHrlhfK4U7njH4,6862
31
- bittensor_cli-9.0.0rc3.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
32
- bittensor_cli-9.0.0rc3.dist-info/entry_points.txt,sha256=hBTLGLbVxmAKy69XSKaUZvjTCmyEzDGZKq4S8UOto8I,49
33
- bittensor_cli-9.0.0rc3.dist-info/top_level.txt,sha256=DvgvXpmTtI_Q1BbDZMlK90LFcGFCreN1daViEPV2iFw,14
34
- bittensor_cli-9.0.0rc3.dist-info/RECORD,,
29
+ bittensor_cli/src/commands/subnets/subnets.py,sha256=ydCKUvmEwJK3hVns4QaV_Cw4sZTajrQk0CVGs_ynBcM,79805
30
+ bittensor_cli-9.0.0rc4.dist-info/METADATA,sha256=j_Ocs-LAFHWU_LhNEkSN6ZET6LHuHQVpX_LdOQ4cqm0,6862
31
+ bittensor_cli-9.0.0rc4.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
32
+ bittensor_cli-9.0.0rc4.dist-info/entry_points.txt,sha256=hBTLGLbVxmAKy69XSKaUZvjTCmyEzDGZKq4S8UOto8I,49
33
+ bittensor_cli-9.0.0rc4.dist-info/top_level.txt,sha256=DvgvXpmTtI_Q1BbDZMlK90LFcGFCreN1daViEPV2iFw,14
34
+ bittensor_cli-9.0.0rc4.dist-info/RECORD,,