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