From 79e4b34a66c8384b92f962b40d8fb58e783e0a52 Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Wed, 2 Jul 2025 20:18:22 +0200 Subject: [PATCH 1/3] Adds snake_case aliases for all commands and options. --- bittensor_cli/cli.py | 45 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/bittensor_cli/cli.py b/bittensor_cli/cli.py index c92ae2a18..35352f222 100755 --- a/bittensor_cli/cli.py +++ b/bittensor_cli/cli.py @@ -11,7 +11,7 @@ import traceback import warnings from pathlib import Path -from typing import Coroutine, Optional, Union +from typing import Coroutine, Optional from dataclasses import fields import rich @@ -169,15 +169,29 @@ def edit_help(cls, option_name: str, help_text: str): help="Path to a JSON file containing the encrypted key backup. For example, a JSON file from PolkadotJS.", ) json_password = typer.Option( - None, "--json-password", help="Password to decrypt the JSON file." + None, + "--json-password", + "--json_password", + help="Password to decrypt the JSON file.", ) use_password = typer.Option( True, + "--use-password", + "--use_password", help="Set this to `True` to protect the generated Bittensor key with a password.", ) - public_hex_key = typer.Option(None, help="The public key in hex format.") + public_hex_key = typer.Option( + None, + "--public-hex-key", + "--public_hex_key", + help="The public key in hex format.", + ) ss58_address = typer.Option( - None, "--ss58", "--ss58-address", help="The SS58 address of the coldkey." + None, + "--ss58", + "--ss58-address", + "--ss58_address", + help="The SS58 address of the coldkey.", ) overwrite = typer.Option( False, @@ -208,11 +222,14 @@ def edit_help(cls, option_name: str, help_text: str): ) netuid_not_req = typer.Option( None, + "--netuid", help="The netuid of the subnet in the network, (e.g. 1).", prompt=False, ) all_netuids = typer.Option( False, + "--all-netuids/--not-all-netuids", + "--all_netuids/--not_all_netuids", help="Use all netuids", prompt=False, ) @@ -225,6 +242,7 @@ def edit_help(cls, option_name: str, help_text: str): reuse_last = typer.Option( False, "--reuse-last", + "--reuse_last", help="Reuse the metagraph data you last retrieved." "Use this option only if you have already retrieved the metagraph." "data", @@ -235,10 +253,15 @@ def edit_help(cls, option_name: str, help_text: str): help="Display the table as HTML in the browser.", ) wait_for_inclusion = typer.Option( - True, help="If `True`, waits until the transaction is included in a block." + True, + "--wait-for-inclusion", + "--wait_for_inclusion", + help="If `True`, waits until the transaction is included in a block.", ) wait_for_finalization = typer.Option( True, + "--wait-for-finalization", + "--wait_for_finalization", help="If `True`, waits until the transaction is finalized on the blockchain.", ) prompt = typer.Option( @@ -276,6 +299,7 @@ def edit_help(cls, option_name: str, help_text: str): "--slippage-tolerance", "--tolerance", "--rate-tolerance", + "--rate_tolerance", help="Set the rate tolerance percentage for transactions (default: 0.05 for 5%).", callback=validate_rate_tolerance, ) @@ -283,6 +307,7 @@ def edit_help(cls, option_name: str, help_text: str): None, "--safe-staking/--no-safe-staking", "--safe/--unsafe", + "--safe_staking/--no_safe_staking", show_default=False, help="Enable or disable safe staking mode [dim](default: enabled)[/dim].", ) @@ -292,6 +317,7 @@ def edit_help(cls, option_name: str, help_text: str): "--partial/--no-partial", "--allow/--not-allow", "--allow-partial/--not-partial", + "--allow_partial_stake/--no_allow_partial_stake", show_default=False, help="Enable or disable partial stake mode [dim](default: disabled)[/dim].", ) @@ -308,6 +334,7 @@ def edit_help(cls, option_name: str, help_text: str): False, "--json-output", "--json-out", + "--json_output", help="Outputs the result of the command as JSON.", ) period: int = typer.Option( @@ -929,11 +956,13 @@ def __init__(self): )(self.view_dashboard) # Sub command aliases - # Weights + # Wallet self.wallet_app.command( "swap_hotkey", hidden=True, )(self.wallet_swap_hotkey) + self.wallet_app.command("swap_coldkey", hidden=True)(self.wallet_swap_coldkey) + self.wallet_app.command("swap_check", hidden=True)(self.wallet_check_ck_swap) self.wallet_app.command( "regen_coldkey", hidden=True, @@ -962,10 +991,14 @@ def __init__(self): "get_identity", hidden=True, )(self.wallet_get_id) + self.wallet_app.command("associate_hotkey")(self.wallet_associate_hotkey) # Subnets self.subnets_app.command("burn_cost", hidden=True)(self.subnets_burn_cost) self.subnets_app.command("pow_register", hidden=True)(self.subnets_pow_register) + self.subnets_app.command("set_identity", hidden=True)(self.subnets_set_identity) + self.subnets_app.command("get_identity", hidden=True)(self.subnets_get_identity) + self.subnets_app.command("check_start", hidden=True)(self.subnets_check_start) # Sudo self.sudo_app.command("senate_vote", hidden=True)(self.sudo_senate_vote) From 302a331023cb9ba8678dba9b4f621e4e80fca1e9 Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Wed, 2 Jul 2025 20:19:57 +0200 Subject: [PATCH 2/3] Updates help --- bittensor_cli/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bittensor_cli/cli.py b/bittensor_cli/cli.py index 35352f222..9e994691c 100755 --- a/bittensor_cli/cli.py +++ b/bittensor_cli/cli.py @@ -5123,7 +5123,7 @@ def subnets_check_start( This command verifies if a subnet's emission schedule can be started based on the subnet's registration block. Example: - [green]$[/green] btcli subnets check_start --netuid 1 + [green]$[/green] btcli subnets check-start --netuid 1 """ self.verbosity_handler(quiet, verbose) return self._run_command( From 82748489091be365561ad2745de24ee23a60a44a Mon Sep 17 00:00:00 2001 From: Benjamin Himes Date: Wed, 2 Jul 2025 20:25:51 +0200 Subject: [PATCH 3/3] Revert aliases in Options. --- bittensor_cli/cli.py | 35 ++++------------------------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/bittensor_cli/cli.py b/bittensor_cli/cli.py index 9e994691c..08201fa47 100755 --- a/bittensor_cli/cli.py +++ b/bittensor_cli/cli.py @@ -169,29 +169,15 @@ def edit_help(cls, option_name: str, help_text: str): help="Path to a JSON file containing the encrypted key backup. For example, a JSON file from PolkadotJS.", ) json_password = typer.Option( - None, - "--json-password", - "--json_password", - help="Password to decrypt the JSON file.", + None, "--json-password", help="Password to decrypt the JSON file." ) use_password = typer.Option( True, - "--use-password", - "--use_password", help="Set this to `True` to protect the generated Bittensor key with a password.", ) - public_hex_key = typer.Option( - None, - "--public-hex-key", - "--public_hex_key", - help="The public key in hex format.", - ) + public_hex_key = typer.Option(None, help="The public key in hex format.") ss58_address = typer.Option( - None, - "--ss58", - "--ss58-address", - "--ss58_address", - help="The SS58 address of the coldkey.", + None, "--ss58", "--ss58-address", help="The SS58 address of the coldkey." ) overwrite = typer.Option( False, @@ -222,14 +208,11 @@ def edit_help(cls, option_name: str, help_text: str): ) netuid_not_req = typer.Option( None, - "--netuid", help="The netuid of the subnet in the network, (e.g. 1).", prompt=False, ) all_netuids = typer.Option( False, - "--all-netuids/--not-all-netuids", - "--all_netuids/--not_all_netuids", help="Use all netuids", prompt=False, ) @@ -242,7 +225,6 @@ def edit_help(cls, option_name: str, help_text: str): reuse_last = typer.Option( False, "--reuse-last", - "--reuse_last", help="Reuse the metagraph data you last retrieved." "Use this option only if you have already retrieved the metagraph." "data", @@ -253,15 +235,10 @@ def edit_help(cls, option_name: str, help_text: str): help="Display the table as HTML in the browser.", ) wait_for_inclusion = typer.Option( - True, - "--wait-for-inclusion", - "--wait_for_inclusion", - help="If `True`, waits until the transaction is included in a block.", + True, help="If `True`, waits until the transaction is included in a block." ) wait_for_finalization = typer.Option( True, - "--wait-for-finalization", - "--wait_for_finalization", help="If `True`, waits until the transaction is finalized on the blockchain.", ) prompt = typer.Option( @@ -299,7 +276,6 @@ def edit_help(cls, option_name: str, help_text: str): "--slippage-tolerance", "--tolerance", "--rate-tolerance", - "--rate_tolerance", help="Set the rate tolerance percentage for transactions (default: 0.05 for 5%).", callback=validate_rate_tolerance, ) @@ -307,7 +283,6 @@ def edit_help(cls, option_name: str, help_text: str): None, "--safe-staking/--no-safe-staking", "--safe/--unsafe", - "--safe_staking/--no_safe_staking", show_default=False, help="Enable or disable safe staking mode [dim](default: enabled)[/dim].", ) @@ -317,7 +292,6 @@ def edit_help(cls, option_name: str, help_text: str): "--partial/--no-partial", "--allow/--not-allow", "--allow-partial/--not-partial", - "--allow_partial_stake/--no_allow_partial_stake", show_default=False, help="Enable or disable partial stake mode [dim](default: disabled)[/dim].", ) @@ -334,7 +308,6 @@ def edit_help(cls, option_name: str, help_text: str): False, "--json-output", "--json-out", - "--json_output", help="Outputs the result of the command as JSON.", ) period: int = typer.Option(