RuntimeConfig#
- pydantic model tollan.config.RuntimeConfig[source]#
Base configuration model with runtime info.
This is the base model for runtime configurations.
Type Parameters#
RuntimeInfoT: Runtime info model class (subclass of RuntimeInfo)
Examples
>>> # Use default RuntimeConfig >>> config = RuntimeConfig.model_validate({ ... "database": {"host": "localhost"}, ... "runtime_info": {"env": "dev"} ... })
>>> # Subclass for domain-specific config >>> class AppConfig(RuntimeConfig[RuntimeInfo]): ... database_url: str ... debug: bool = False
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.Show JSON schema
{ "title": "RuntimeConfig", "description": "Base configuration model with runtime info.\n\nThis is the base model for runtime configurations.\n\nType Parameters\n---------------\n RuntimeInfoT: Runtime info model class (subclass of RuntimeInfo)\n\nExamples\n--------\n >>> # Use default RuntimeConfig\n >>> config = RuntimeConfig.model_validate({\n ... \"database\": {\"host\": \"localhost\"},\n ... \"runtime_info\": {\"env\": \"dev\"}\n ... })\n\n >>> # Subclass for domain-specific config\n >>> class AppConfig(RuntimeConfig[RuntimeInfo]):\n ... database_url: str\n ... debug: bool = False", "type": "object", "properties": { "runtime_info": { "$ref": "#/$defs/RuntimeInfo", "description": "Runtime information" } }, "$defs": { "RuntimeInfo": { "description": "Runtime environment information.\n\nCaptures system information (user, host, platform, Python environment)\nand command-line invocation details.", "properties": { "username": { "description": "Current username", "title": "Username", "type": "string" }, "hostname": { "description": "System hostname", "title": "Hostname", "type": "string" }, "platform": { "description": "Platform identifier (e.g., 'linux', 'darwin', 'win32')", "title": "Platform", "type": "string" }, "python_prefix": { "description": "Path to Python installation", "format": "path", "title": "Python Prefix", "type": "string" }, "exec_path": { "description": "Path to command-line executable", "format": "path", "title": "Exec Path", "type": "string" }, "cmd": { "description": "Invoking command line", "title": "Cmd", "type": "string" }, "config_sources": { "default": null, "description": "Config source list for debugging and introspection", "title": "Config Sources" }, "validation_context": { "additionalProperties": true, "description": "Context passed to conditional config validation (enable_if)", "title": "Validation Context", "type": "object" } }, "title": "RuntimeInfo", "type": "object" } }, "additionalProperties": true }
- Config:
frozen: bool = True
validate_default: bool = True
ignored_types: tuple = (<class ‘functools.cached_property’>,)
strict: bool = True
extra: str = allow
- Fields:
- field runtime_info: RuntimeInfoT [Optional]#
Runtime information