Skip to content
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
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
51 changes: 29 additions & 22 deletions bittensor_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions bittensor_cli/src/commands/subnets/subnets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
14 changes: 7 additions & 7 deletions bittensor_cli/src/commands/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
"""
Expand Down Expand Up @@ -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.
"""
Expand All @@ -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[
Expand Down Expand Up @@ -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.
"""
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"])
Expand Down
4 changes: 2 additions & 2 deletions bittensor_cli/src/commands/wallets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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",
Expand Down
Loading