Classes
ExcludeExtrasMixin
Mixin that excludes model_extra keys from serialization by default.
Models using extra="allow" silently collect unrecognised fields in
model_extra. This mixin overrides model_dump and
model_dump_json so those extra keys are excluded unless the caller
explicitly passes include. This prevents accidental exposure of
sensitive values (e.g. tokens, secrets) during serialization.
Source code in src/hassette/config/classes.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
merge_exclude(exclude: Any | None, extra_keys: set[str]) -> Any
staticmethod
Merge extra keys into an existing exclude value.
Handles the three shapes Pydantic accepts for exclude:
- None → return a new set of extra keys
- dict → copy and mark each extra key as True (fully excluded)
- set (or other iterable) → union with extra keys
Source code in src/hassette/config/classes.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
model_dump(*, exclude: Any | None = None, **kwargs: Any) -> dict[str, Any]
Serialize declared fields only; extra fields are excluded for privacy.
Source code in src/hassette/config/classes.py
104 105 106 107 108 109 110 | |
model_dump_json(*, exclude: Any | None = None, **kwargs: Any) -> str
Serialize declared fields only; extra fields are excluded for privacy.
Source code in src/hassette/config/classes.py
112 113 114 115 116 117 | |
AppManifest
Bases: ExcludeExtrasMixin, BaseModel
Manifest for a Hassette app.
Source code in src/hassette/config/classes.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | |
app_key: str = Field(default=...)
class-attribute
instance-attribute
Reflects the key for this app in hassette.toml
enabled: bool = Field(default=True)
class-attribute
instance-attribute
Whether the app is enabled or not, will default to True if not set. Does not consider @only_app decorator.
filename: str = Field(default=..., examples=['my_app.py'], validation_alias=(AliasChoices('filename', 'file_name')))
class-attribute
instance-attribute
Filename of the app, will be looked for in app_path
class_name: str = Field(default=..., examples=['MyApp'], validation_alias=(AliasChoices('class_name', 'class', 'module', 'module_name')))
class-attribute
instance-attribute
Class name of the app
display_name: str = Field(default=..., examples=['My App'])
class-attribute
instance-attribute
Display name of the app, will use class_name if not set
app_dir: Path = Field(..., examples=['./apps'])
class-attribute
instance-attribute
Path to the app directory, relative to current working directory or absolute
app_config: dict[str, Any] | list[dict[str, Any]] = Field(default_factory=dict, validation_alias=(AliasChoices('config', 'app_config')), validate_default=True)
class-attribute
instance-attribute
Instance configuration for the app
auto_loaded: bool = Field(default=False)
class-attribute
instance-attribute
Whether the app was auto-detected or manually configured
full_path: Path
instance-attribute
Fully resolved path to the app file
validate_app_manifest(values: dict[str, Any]) -> dict[str, Any]
classmethod
Validate the app configuration.
Source code in src/hassette/config/classes.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
validate_app_config(v: Any, validation_info: ValidationInfo) -> Any
classmethod
Set instance name if not set in config.
Source code in src/hassette/config/classes.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |