Models¶
Note
End users typically do not need to interact with these models directly.
They are internal building blocks used by GPPConfig
to validate, load, and serialize the configuration file.
You will rarely (if ever) instantiate these models manually.
The GPP Client uses Pydantic models to validate and serialize the contents of the configuration file. These models ensure:
Consistent schema validation
Automatic empty-string cleanup
Correct serialization back to TOML or JSON
Tokens Model¶
Tokens stores API tokens for each defined environment.
Empty strings in the TOML file are automatically converted to None during
validation.
from gpp_client.config.models import Tokens
tokens = Tokens(DEVELOPMENT="abc", STAGING="")
print(tokens.STAGING) # → None
When serializing back to TOML or JSON, None becomes an empty string.
ConfigFile Model¶
ConfigFile represents the full configuration file.
Fields include:
env— active environmentdisable_env_vars— whether environment vars are usedtokens— the environment token container
Example file:
env = "PRODUCTION"
disable_env_vars = false
[tokens]
DEVELOPMENT = ""
STAGING = "staging-token"
PRODUCTION = "prod-token"
Interaction With GPPConfig¶
The GPPConfig class wraps this model and provides:
File I/O
Token/Env mutation helpers
Runtime convenience methods
See Config for the operational interface.
API Reference¶
- class gpp_client.config.models.Tokens(*, DEVELOPMENT: str | None = None, STAGING: str | None = None, PRODUCTION: str | None = None)[source]¶
Bases:
BaseModelTokens for different GPP environments.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class gpp_client.config.models.ConfigFile(*, env: GPPEnvironment = GPPEnvironment.PRODUCTION, disable_env_vars: bool = False, tokens: Tokens = Tokens(DEVELOPMENT=None, STAGING=None, PRODUCTION=None))[source]¶
Bases:
BaseModelGPP client configuration file model.
- env: GPPEnvironment¶
- classmethod get_enum_value(value: GPPEnvironment) str[source]¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].