bittensor.core.config#

Implementation of the config class, which manages the configuration of different Bittensor modules.

Example

import argparse import bittensor as bt

parser = argparse.ArgumentParser(‘Miner’) bt.Axon.add_args(parser) bt.Subtensor.add_args(parser) bt.Async_subtensor.add_args(parser) bt.Wallet.add_args(parser) bt.logging.add_args(parser) bt.PriorityThreadPoolExecutor.add_args(parser) config = bt.config(parser)

print(config)

Exceptions#

InvalidConfigFile

Raised when there's an error loading the config file.

Classes#

Config

Manages configuration for Bittensor modules with nested namespace support.

DefaultMunch

Dict with attribute-style access and a configurable default value.

Module Contents#

class bittensor.core.config.Config(parser=None, args=None, strict=False, default=DEFAULTS)#

Bases: DefaultMunch

Manages configuration for Bittensor modules with nested namespace support.

Initialize self. See help(type(self)) for accurate signature.

Parameters:
is_set(param_name)#

Checks if a parameter was explicitly set.

Parameters:

param_name (str)

Return type:

bool

merge(other)#

Merges another Config into this one.

Parameters:

other (Config)

Return type:

None

to_dict()#

Returns the configuration as a dictionary.

Return type:

dict

class bittensor.core.config.DefaultMunch(default=None, *args, **kwargs)#

Bases: dict

Dict with attribute-style access and a configurable default value.

Drop-in replacement for munch.DefaultMunch using only the stdlib. The default value (returned for missing keys) is stored on the instance via object.__setattr__ so it never collides with dict entries.

Initialize self. See help(type(self)) for accurate signature.

classmethod fromDict(d, _default=None)#

Recursively creates a DefaultMunch from a plain dict.

toDict()#

Recursively converts this object to a plain dict.

exception bittensor.core.config.InvalidConfigFile#

Bases: Exception

Raised when there’s an error loading the config file.

Initialize self. See help(type(self)) for accurate signature.