ontocast.config.env_audit¶
Classify environment assignments against the declared settings.
Pydantic-settings ignores an environment variable that no field reads, so a renamed or removed setting in a configuration file silently does nothing, and a value copied from an earlier default keeps overriding the current one. This module tells the cases apart. Findings name variables, never their values.
Classes¶
AuditReport
¶
Bases: BaseModel
Per-variable findings plus errors only the full configuration raises.
Source code in ontocast/config/env_audit.py
Finding
¶
Bases: BaseModel
The verdict on one assignment.
Source code in ontocast/config/env_audit.py
Verdict
¶
Bases: StrEnum
What one assignment does relative to the current defaults.
Source code in ontocast/config/env_audit.py
Attributes¶
INVALID = 'invalid'
class-attribute
instance-attribute
¶
The setting rejects the value, alone or combined with the file's others.
PINNED = 'pinned'
class-attribute
instance-attribute
¶
The value differs from the current default, which it overrides.
REDUNDANT = 'redundant'
class-attribute
instance-attribute
¶
The value equals the current default; deleting the line changes nothing.
UNKNOWN = 'unknown'
class-attribute
instance-attribute
¶
No setting reads the variable: it is renamed, removed, or not OntoCast's.
Functions:¶
audit_assignments(assignments)
¶
Classify each assignment as unknown, invalid, redundant or pinned.
Each settings group is built from the file's assignments to it, so values are judged as the running program would parse them. A group that rejects the combination is retried one variable at a time to say which value is at fault; values that are each valid but jointly rejected are all reported invalid. The ambient environment never takes part.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
assignments
|
Mapping[str, str | None]
|
Variable name to value, as read from one file. |
required |
Returns:
| Type | Description |
|---|---|
AuditReport
|
Findings in input order, and any error raised only when the complete |
AuditReport
|
configuration is built from the valid assignments. |
Source code in ontocast/config/env_audit.py
112 113 114 115 116 117 118 119 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 | |
declared_env_names()
¶
Map every environment name a setting reads to the field reading it.