From a897ee551a331fe17d3557ccfc9c05a30be2cbeb Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Wed, 28 May 2025 18:36:05 +0200 Subject: [PATCH 1/6] Fix output in wallets overview to not display scientific notation. --- bittensor_cli/src/commands/wallets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bittensor_cli/src/commands/wallets.py b/bittensor_cli/src/commands/wallets.py index ae6a01ab8..6b4a6f50b 100644 --- a/bittensor_cli/src/commands/wallets.py +++ b/bittensor_cli/src/commands/wallets.py @@ -1259,8 +1259,8 @@ def overview_sort_function(row_): grid.add_row(table) - caption = "\n[italic][dim][bright_cyan]Wallet balance: [dark_orange]\u03c4" + str( - total_balance.tao + caption = ( + f"\n[italic][dim][bright_cyan]Wallet free balance: [dark_orange]{total_balance}" ) data_dict["total_balance"] = total_balance.tao grid.add_row(Align(caption, vertical="middle", align="center")) From da23841d36b72043406f3dd7482b1c7fc1a4cad2 Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Wed, 28 May 2025 18:37:12 +0200 Subject: [PATCH 2/6] Use the generic `dict` and `list` in `view.py` instead of `typing.Dict` and `typing.List` --- bittensor_cli/src/commands/view.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bittensor_cli/src/commands/view.py b/bittensor_cli/src/commands/view.py index 4108bdefa..3262b262c 100644 --- a/bittensor_cli/src/commands/view.py +++ b/bittensor_cli/src/commands/view.py @@ -5,7 +5,7 @@ import webbrowser import netaddr from dataclasses import asdict, is_dataclass -from typing import Any, Dict, List +from typing import Any from pywry import PyWry from bittensor_cli.src.bittensor.balances import Balance @@ -149,7 +149,7 @@ def get_identity( async def fetch_subnet_data( wallet: Wallet, subtensor: "SubtensorInterface" -) -> Dict[str, Any]: +) -> dict[str, Any]: """ Fetch subnet data from the network. """ @@ -187,7 +187,7 @@ async def fetch_subnet_data( } -def process_subnet_data(raw_data: Dict[str, Any]) -> Dict[str, Any]: +def process_subnet_data(raw_data: dict[str, Any]) -> dict[str, Any]: """ Process and prepare subnet data. """ @@ -206,7 +206,7 @@ def process_subnet_data(raw_data: Dict[str, Any]) -> Dict[str, Any]: total_slippage_value = Balance.from_tao(0) # Process stake - stake_dict: Dict[int, List[Dict[str, Any]]] = {} + stake_dict: dict[int, list[dict[str, Any]]] = {} for stake in stake_info: if stake.stake.tao > 0: slippage_value, _, slippage_percentage = pool_info[ @@ -367,7 +367,7 @@ def _has_exited(handler) -> bool: ) -def generate_full_page(data: Dict[str, Any]) -> str: +def generate_full_page(data: dict[str, Any]) -> str: """ Generate full HTML content for the interface. """ @@ -673,7 +673,7 @@ def generate_neuron_details() -> str: """ -def generate_main_header(wallet_info: Dict[str, Any], block_number: int) -> str: +def generate_main_header(wallet_info: dict[str, Any], block_number: int) -> str: truncated_coldkey = f"{wallet_info['coldkey'][:6]}...{wallet_info['coldkey'][-6:]}" # Calculate slippage percentage @@ -746,7 +746,7 @@ def generate_main_filters() -> str: """ -def generate_subnets_table(subnets: List[Dict[str, Any]]) -> str: +def generate_subnets_table(subnets: list[dict[str, Any]]) -> str: rows = [] for subnet in subnets: total_your_stake = sum(stake["amount"] for stake in subnet["your_stakes"]) From ef8ad9a65d1407fa322be0efe932420eccd3fc4c Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Wed, 28 May 2025 21:19:38 +0200 Subject: [PATCH 3/6] Removes unused `async-property` dependency --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 453f1ac1d..d709502c8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,6 @@ scripts = { btcli = "bittensor_cli.cli:main" } requires-python = ">=3.9,<3.14" dependencies = [ "wheel", - "async-property==0.2.2", "async-substrate-interface>=1.1.0", "aiohttp~=3.10.2", "backoff~=2.2.1", From a9fee3dc523320b9314d141002a7c9068c4063c6 Mon Sep 17 00:00:00 2001 From: Maximilian Hubert <64627729+gap-editor@users.noreply.github.com> Date: Wed, 28 May 2025 21:54:48 +0200 Subject: [PATCH 4/6] fix typo "accross" --- bittensor_cli/src/commands/subnets/subnets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bittensor_cli/src/commands/subnets/subnets.py b/bittensor_cli/src/commands/subnets/subnets.py index c8bba8436..29e096838 100644 --- a/bittensor_cli/src/commands/subnets/subnets.py +++ b/bittensor_cli/src/commands/subnets/subnets.py @@ -1028,7 +1028,7 @@ async def show_root(): The table displays the root subnet participants and their metrics. The columns are as follows: - Position: The sorted position of the hotkey by total TAO. - - TAO: The sum of all TAO balances for this hotkey accross all subnets. + - TAO: The sum of all TAO balances for this hotkey across all subnets. - Stake: The stake balance of this hotkey on root (measured in TAO). - Emission: The emission accrued to this hotkey across all subnets every block measured in TAO. - Hotkey: The hotkey ss58 address. @@ -1374,7 +1374,7 @@ async def show_subnet(netuid_: int): # The table displays the subnet participants and their metrics. # The columns are as follows: # - UID: The hotkey index in the subnet. - # - TAO: The sum of all TAO balances for this hotkey accross all subnets. + # - TAO: The sum of all TAO balances for this hotkey across all subnets. # - Stake: The stake balance of this hotkey on this subnet. # - Weight: The stake-weight of this hotkey on this subnet. Computed as an average of the normalized TAO and Stake columns of this subnet. # - Dividends: Validating dividends earned by the hotkey. From 91601f792e9b49a0b7c9eb593088f3414158633a Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Thu, 29 May 2025 16:02:46 +0200 Subject: [PATCH 5/6] Suppress warning from new async-substrate-interface about instantiating the object outside an event loop. --- bittensor_cli/cli.py | 51 +++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/bittensor_cli/cli.py b/bittensor_cli/cli.py index ce64f1950..62f0fb1d9 100755 --- a/bittensor_cli/cli.py +++ b/bittensor_cli/cli.py @@ -8,6 +8,7 @@ import ssl import sys import traceback +import warnings from pathlib import Path from typing import Coroutine, Optional from dataclasses import fields @@ -1000,31 +1001,37 @@ def initialize_chain( :param network: Network name (e.g. finney, test, etc.) or chain endpoint (e.g. ws://127.0.0.1:9945, wss://entrypoint-finney.opentensor.ai:443) """ - if not self.subtensor: - if network: - network_ = None - for item in network: - if item.startswith("ws"): - network_ = item - break - else: - network_ = item + with warnings.catch_warnings(): + warnings.filterwarnings( + "ignore", + "You are instantiating the AsyncSubstrateInterface Websocket outside of an event loop. " + "Verify this is intended.", + ) + if not self.subtensor: + if network: + network_ = None + for item in network: + if item.startswith("ws"): + network_ = item + break + else: + network_ = item + + not_selected_networks = [net for net in network if net != network_] + if not_selected_networks: + console.print( + f"Networks not selected: [dark_orange]{', '.join(not_selected_networks)}[/dark_orange]" + ) - not_selected_networks = [net for net in network if net != network_] - if not_selected_networks: + self.subtensor = SubtensorInterface(network_) + elif self.config["network"]: + self.subtensor = SubtensorInterface(self.config["network"]) console.print( - f"Networks not selected: [dark_orange]{', '.join(not_selected_networks)}[/dark_orange]" + f"Using the specified network [{COLORS.G.LINKS}]{self.config['network']}" + f"[/{COLORS.G.LINKS}] from config" ) - - self.subtensor = SubtensorInterface(network_) - elif self.config["network"]: - self.subtensor = SubtensorInterface(self.config["network"]) - console.print( - f"Using the specified network [{COLORS.G.LINKS}]{self.config['network']}" - f"[/{COLORS.G.LINKS}] from config" - ) - else: - self.subtensor = SubtensorInterface(defaults.subtensor.network) + else: + self.subtensor = SubtensorInterface(defaults.subtensor.network) return self.subtensor def _run_command(self, cmd: Coroutine, exit_early: bool = True): From f3351fc08554552b38e7d3a3ae04766c01cce1b2 Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Thu, 29 May 2025 11:22:29 -0700 Subject: [PATCH 6/6] Bumps version and changelog --- CHANGELOG.md | 14 ++++++++++++++ pyproject.toml | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18bfb4041..91aaf6ecd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 9.4.3 /2025-04-29 + +## What's Changed +* Avoid scientific notation output by @thewhaleking in https://github.com/opentensor/btcli/pull/459 +* Use generic types by @thewhaleking in https://github.com/opentensor/btcli/pull/458 +* Suppress async substrate warning by @thewhaleking in https://github.com/opentensor/btcli/pull/463 +* Remove unused dependency by @thewhaleking in https://github.com/opentensor/btcli/pull/460 +* fix: fix typo "accross" by @gap-editor in https://github.com/opentensor/btcli/pull/461 + +## New Contributors +* @gap-editor made their first contribution in https://github.com/opentensor/btcli/pull/461 + +**Full Changelog**: https://github.com/opentensor/btcli/compare/v9.4.2...v9.4.3 + ## 9.4.2 /2025-04-22 ## What's Changed diff --git a/pyproject.toml b/pyproject.toml index d709502c8..c1b96f0e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "bittensor-cli" -version = "9.4.2" +version = "9.4.3" description = "Bittensor CLI" readme = "README.md" authors = [