Skip to content

Conversation

@chideraao
Copy link

updated docstrings for the Bittensor Wallet SDK to enable docs generation.

Copy link
Contributor

@basfroman basfroman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you've already started correcting your docstrings, let's make it perfect.

  1. Use the same name for arguments (Args or Arguments - presumably the latter).
  2. If a function has an parameter, add its description in the variable docstring as well.
  3. Use consistent indentation throughout the all updated docstring description.

@chideraao chideraao changed the base branch from main to staging December 3, 2025 18:53
Comment on lines 897 to 910
/// Checks for existing coldkeypub and hotkeys, and creates them if non-existent.
/// Arguments:
/// coldkey_use_password (bool): Whether to use a password for coldkey. Defaults to ``True``.
/// hotkey_use_password (bool): Whether to use a password for hotkey. Defaults to ``False``.
/// save_coldkey_to_env (bool): Whether to save a coldkey password to local env. Defaults to ``False``.
/// save_hotkey_to_env (bool): Whether to save a hotkey password to local env. Defaults to ``False``.
/// coldkey_password (Optional[str]): Coldkey password for encryption. Defaults to ``None``. If `coldkey_password` is passed, then `coldkey_use_password` is automatically ``True``.
/// hotkey_password (Optional[str]): Hotkey password for encryption. Defaults to ``None``. If `hotkey_password` is passed, then `hotkey_use_password` is automatically ``True``.
/// overwrite (bool): Whether to overwrite an existing keys. Defaults to ``False``.
/// suppress (bool): If ``True``, suppresses the display of the keys mnemonic message. Defaults to ``False``.
///
/// Returns:
/// Wallet instance with created keys.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the reason to remove it?

Copy link
Author

@chideraao chideraao Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it kept overwriting the docstrings for create on the wallet.rs file and was kept rendering weirdly for some reason in the docs. For context:
Screenshot 2025-12-03 at 20 05 39
Screenshot 2025-12-03 at 20 06 24

i replicated it in the wallet.rs btw. hopefully it doesnt break anything?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind to add additional docstrings, but I don't want to remove existing ones.
Actually, I care about the code quality first then about the documentation.
We need to find the way, when both goals achieved, but without code|docstrings editing|removing bc some doc generator doesn't work properly.
Does this make sense?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You know what? let me try putting that bit of docstrings back in the python_bindings.rs file but with the updated formatting i adopted for the docstrings in the create function in the wallet.rs file.

i'll let you know how that turns out.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works fine with the new format. i've made pushed the latest changes

Comment on lines +634 to +639
/// Checks if the given public_key is a valid ed25519 key.
///
/// Arguments:
/// public_key (bytes): The public_key to check as bytes.
/// Returns:
/// valid (bool): ``True`` if the public_key is a valid ed25519 key, ``False`` otherwise.
Copy link
Author

@chideraao chideraao Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was added here cause the docs generator tool wasnt seeing the is_valid_ed25519_pubkey function (didnt exist on utils.rs).

took a look and noticed that it was because it was kind of binded (idk what the word is) with the are_bytes_valid_ed25519_pubkey function in the wallet.rs.

@basfroman basfroman merged commit 5da4b51 into opentensor:staging Dec 4, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants