pytconf package¶
Submodules¶
pytconf.color_utils module¶
pytconf.config module¶
- class pytconf.config.ConfigFormat(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum
- JSON = 1¶
- YAML = 2¶
- class pytconf.config.ConfigType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum
- SYSTEM = 2¶
- USER = 1¶
- class pytconf.config.FunctionData(name: str, description: str, function: Callable, configs: List[pytconf.config.Config] = <factory>, suggest_configs: List[pytconf.config.Config] = <factory>, allow_free_args: bool = False, min_free_args: Optional[int] = None, max_free_args: Optional[int] = None, group: str = 'default')[source]¶
Bases:
object
- allow_free_args: bool = False¶
- description: str¶
- function: Callable¶
- group: str = 'default'¶
- max_free_args: int | None = None¶
- min_free_args: int | None = None¶
- name: str¶
- class pytconf.config.FunctionGroupData(name: str, description: str, show_meta: bool = False, show: bool = False, names: Set[str] = <factory>, list_names: List[str] = <factory>)[source]¶
Bases:
object
- description: str¶
- list_names: List[str]¶
- name: str¶
- names: Set[str]¶
- show: bool = False¶
- show_meta: bool = False¶
- class pytconf.config.PytconfConf[source]¶
Bases:
object
- config_arg_parse_and_launch(args: List[str] | None = None, launch=True, do_exit=True) None [source]¶
- static get_config(app_name: str, config_type: ConfigType, config_format: ConfigFormat)[source]¶
- get_function_selected(args: List[str], errors) FunctionData | None [source]¶
- launch(launch: bool, select: FunctionData | None, errors)[source]¶
- classmethod print_errors(errors: ErrorsCollector) None [source]¶
- process_flags(select: FunctionData, flags: Dict[str, str], errors: ErrorsCollector) None [source]¶
- static read_flags_from_config(app_name: str, config_type: ConfigType, config_format: ConfigFormat, flags: Dict[str, str]) None [source]¶
- register_function(data: FunctionData)[source]¶
- register_function_group(data: FunctionGroupData)[source]¶
- classmethod rm_config_file(app_name: str, config_type: ConfigType, config_format: ConfigFormat) None [source]¶
- show_help_for_function(name: str, show_help_full: bool = False, show_help_suggest: bool = False) None [source]¶
- write_config(config_type: ConfigType, config_format: ConfigFormat) None [source]¶
- classmethod write_config_file(filename: str, config_format: ConfigFormat) None [source]¶
- pytconf.config.register_endpoint(description: str, name: str | None = None, configs: List[Config] | None = None, suggest_configs: List[Config] | None = None, group: str = 'default', allow_free_args: bool = False, min_free_args: int | None = None, max_free_args: int | None = None) Callable[[Any], Any] [source]¶
- pytconf.config.register_function(name: str, description: str, function: Callable, configs: List[Config] | None = None, suggest_configs: List[Config] | None = None, allow_free_args: bool = False, min_free_args: int | None = None, max_free_args: int | None = None, group: str = 'default')[source]¶
- pytconf.config.register_function_group(name: str, description: str, show_meta: bool, show: bool) None [source]¶
- pytconf.config.register_main(main_description: str, app_name: str, version: str) Callable[[Any], Any] [source]¶
- pytconf.config.rm_config_file(app_name: str, config_type: ConfigType, config_format: ConfigFormat) None [source]¶
- pytconf.config.write_config(config_type: ConfigType, config_format: ConfigFormat) None [source]¶
- pytconf.config.write_config_file(filename: str, config_format: ConfigFormat) None [source]¶
pytconf.convert module¶
pytconf.data module¶
pytconf.enum_subset module¶
- class pytconf.enum_subset.EnumSubset(enum_type: Enum, list_of_values: List[Enum])[source]¶
Bases:
object
- pytconf.enum_subset.enum_subset_to_str(e: EnumSubset) str [source]¶
- pytconf.enum_subset.g_from_enum_all(e: ExtendedEnum) EnumSubset [source]¶
- pytconf.enum_subset.g_from_string(e: Enum, s: str) EnumSubset [source]¶
pytconf.errors_collector module¶
pytconf.extended_enum module¶
pytconf.param module¶
- class pytconf.param.Param(help_string='No help for this configuration option', default: ~typing.Any = <pytconf.param.Unique object>, type_name: str | None = None)[source]¶
Bases:
ABC
Parent class of all parameters of configuration
- class pytconf.param.ParamChoice(help_string='No help for this configuration option', default: str | ~pytconf.param.Unique = <pytconf.param.Unique object>, choice_list: ~typing.List[str] | None = None)[source]¶
Bases:
Param
- class pytconf.param.ParamCreator[source]¶
Bases:
object
Static namespace with all the param creation functions.
- static create_bool(help_string: str = 'No help for this configuration option', default: bool | ~pytconf.param.Unique = <pytconf.param.Unique object>) bool [source]¶
Create a bool parameter :param help_string: :param default: :return:
- static create_choice(choice_list: ~typing.List[str], help_string: str = 'No help for this configuration option', default: str | ~pytconf.param.Unique = <pytconf.param.Unique object>) str [source]¶
Create a choice config :param choice_list: :param help_string: :param default: :return:
- static create_enum(enum_type: ~enum.Enum, help_string: str = 'No help for this configuration option', default: ~enum.Enum | ~pytconf.param.Unique = <pytconf.param.Unique object>) Enum [source]¶
Create an enum config :param enum_type: :param help_string: :param default: :return:
- static create_enum_subset(enum_type: ~enum.Enum, help_string: str = 'No help for this configuration option', default: ~pytconf.enum_subset.EnumSubset | ~pytconf.param.Unique = <pytconf.param.Unique object>) EnumSubset [source]¶
Create an enum config :param enum_type: :param help_string: :param default: :return:
- static create_existing_bucket(help_string: str = 'No help for this configuration option', default: str | ~pytconf.param.Unique = <pytconf.param.Unique object>) str [source]¶
Create a bucket name on gcp :param help_string: :param default: :return:
- static create_existing_file(help_string: str = 'No help for this configuration option', default: str | ~pytconf.param.Unique = <pytconf.param.Unique object>, suffixes: ~typing.List[str] | None = None) str [source]¶
Create a new file parameter :param help_string: :param default: :param suffixes: :return:
- static create_existing_folder(help_string: str = 'No help for this configuration option', default: str | ~pytconf.param.Unique = <pytconf.param.Unique object>, suffixes: ~typing.List[str] | None = None) str [source]¶
Create a new folder parameter :param help_string: :param default: :param suffixes: :return:
- static create_int(help_string: str = 'No help for this configuration option', default: int | ~pytconf.param.Unique = <pytconf.param.Unique object>) int [source]¶
Create an int parameter :param help_string: :param default: :return:
- static create_int_or_none(help_string: str = 'No help for this configuration option', default: int | None | ~pytconf.param.Unique = <pytconf.param.Unique object>) int | None [source]¶
Create an int parameter :param help_string: :param default: :return:
- static create_list_int(help_string: str = 'No help for this configuration option', default: List[int] = []) List[int] [source]¶
Create a List[int] parameter :param help_string: :param default: :return:
- static create_list_str(help_string: str = 'No help for this configuration option', default: List[str] = []) List[str] [source]¶
Create a List[str] parameter :param help_string: :param default: :return:
- static create_new_file(help_string: str = 'No help for this configuration option', default: str | ~pytconf.param.Unique = <pytconf.param.Unique object>, suffixes: ~typing.List[str] | None = None) str [source]¶
Create a new file parameter :param help_string: :param default: :param suffixes: :return:
- class pytconf.param.ParamEnum(enum_type: ~enum.Enum, help_string='No help for this configuration option', default: ~typing.Any = <pytconf.param.Unique object>)[source]¶
Bases:
Param
- class pytconf.param.ParamEnumSubset(help_string='No help for this configuration option', default: ~typing.Any = <pytconf.param.Unique object>, enum_type: ~enum.Enum | None = None)[source]¶
Bases:
Param
- s2t(s: str) EnumSubset [source]¶
- s2t_generate_from_default(s: str) EnumSubset | None [source]¶
- class pytconf.param.ParamFilename(help_string: str = 'No help for this configuration option', default: ~pytconf.param.Unique | str = <pytconf.param.Unique object>, type_name=None, suffixes: ~typing.List[str] | None = None)[source]¶
Bases:
Param
pytconf.param_collector module¶
pytconf.pydoc module¶
pytconf.registry module¶
pytconf.static module¶
version which can be consumed from within the module