config¶
- pydantic model Config[source]¶
- Config:
extra: str = ignore
env_prefix: str = noob_
nested_model_default_partial_update: bool = True
env_file: str = .env
env_file_encoding: str = utf-8
env_nested_delimiter: str = __
yaml_file: str = noob_config.yaml
pyproject_toml_table_header: tuple = (‘tool’, ‘noob’, ‘config’)
- Fields:
- Validators:
- field config_dirs: list[Path] [Optional]¶
Directory where config yaml files are stored
- Validated by:
- field logs: LogConfig = LogConfig(level='INFO', level_file=None, level_stdout=None, dir=False, file_n=5, file_size=4194304, width=None)¶
- validator create_dir » config_dirs, user_dir, tmp_dir[source]¶
- classmethod settings_customise_sources(settings_cls: type[BaseSettings], init_settings: PydanticBaseSettingsSource, env_settings: PydanticBaseSettingsSource, dotenv_settings: PydanticBaseSettingsSource, file_secret_settings: PydanticBaseSettingsSource) tuple[PydanticBaseSettingsSource, ...][source]¶
Read config settings from, in order of priority from high to low, where high priorities override lower priorities:
in the arguments passed to the class constructor (not user configurable)
in environment variables like
export NOOB_LOGS__DIR=~/in a
.envfile in the working directoryin a
noob_config.yamlfile in the working directoryin the
tool.noob.configtable in apyproject.tomlfile in the working directorythe default values in the
Configmodel
- pydantic model LogConfig[source]¶
Configuration for logging
- Config:
validate_default: bool = True
- Fields:
- Validators:
- field dir: Path | Literal[False] = PosixPath('/home/docs/.local/state/noob/log')¶
Directory where logs are stored.
- Validated by:
- field level: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR'] = 'INFO'¶
Severity of log messages to process.
- Validated by:
- field level_file: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR'] | None = None¶
Severity for file-based logging. If unset, use
level- Validated by:
- field level_stdout: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR'] | None = None¶
Severity for stream-based logging. If unset, use
level- Validated by:
- field width: int | None = None¶
Explicitly set width of rich stdout logs, leave as None for auto detection.
- validator uppercase_levels » level_file, level_stdout, level[source]¶
Ensure log level strings are uppercased
- add_config_source(path: Path) None[source]¶
Add a directory as a source of tube configs when searching by tube id
- get_extra_sources() list[Path][source]¶
Get the extra sources added by
add_config_source()(avoid importing the private module-level collection anywhere else, as it makes mutation weird and unpredictable)
- get_entrypoint_sources() list[Path][source]¶
Get additional config sources added by entrypoint functions.
Packages that ship noob tubes can make those tubes available by adding an entrypoint function with a signature
() -> list[Path]to their pyproject.toml like:[project.entry-points.”noob.add_sources”] tubes = “my_package.something:add_sources”
References
https://setuptools.pypa.io/en/latest/userguide/entry_point.html