Coverage for src/iptvtools/settings.py: 100%
12 statements
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-31 13:48 +0000
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-31 13:48 +0000
1"""Settings Module."""
3import logging
4from logging import getLevelName
6from pydantic_settings import BaseSettings, SettingsConfigDict
9class GlobalSettings(BaseSettings):
10 """System level settings."""
12 ci: bool = False
13 """Indicator for whether or not in CI/CD environment."""
16class Settings(BaseSettings):
17 """Project specific settings."""
19 logging_level: str | None = getLevelName(logging.INFO)
20 """Default logging level for the project."""
22 model_config = SettingsConfigDict(
23 env_prefix="IPTVTOOLS_",
24 )
27# NOTE(huxuan): `#:` style docstring is required for module attributes to satisfy both
28# autodoc [1] and `check-docstring-first` in `pre-commit` [2].
29# [1] https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#directive-autoattribute
30# [2] https://github.com/pre-commit/pre-commit-hooks/issues/159#issuecomment-559886109
32#: Instance for system level settings.
33global_settings = GlobalSettings()
35#: Instance for project specific settings.
36settings = Settings()