ushka.core.settings
Every setting Ushka reads, in one place: its default and what it does.
SCHEMA is the single source of truth. From it come the defaults
(DEFAULTS), the annotated ushka.toml that ushka new writes, the
settings table in the docs, ushka config and the warnings about unknown or
wrongly typed keys. Nothing Ushka reads from the configuration is missing here,
so nothing is hidden: if a setting is not in this file, Ushka does not use it.
This module imports nothing from Ushka.
In this module
class Setting | |
def env_name() | |
def reject_options() | Raises TypeError for the first key of options not in allowed, suggesting the closest one. |
def problems_in() | What is wrong with the settings found in ushka.toml. |
def toml_value() | value as TOML. |
def render_toml() | A complete, annotated ushka.toml: every setting, with its default and its meaning. |
def render_markdown() | The settings reference for the docs: one table per section. Generated, never hand-edited. |
class Setting
def env_name
def env_name(section: str, key: str) -> strdef reject_options
def reject_options(owner: str, options: dict, allowed) -> NoneRaises TypeError for the first key of options not in allowed, suggesting the closest one.
def problems_in
def problems_in(file_data: dict[str, Any]) -> list[str]What is wrong with the settings found in ushka.toml.
Unknown keys inside a built-in section (almost always a typo) and values of
the wrong type (csrf = "false" is a non-empty string, so it would read as
on). Your own sections are fine and are not checked.
def toml_value
def toml_value(value: Any) -> strvalue as TOML.
def render_toml
def render_toml(
overrides: dict[str, dict[str, Any]] | None = None,
header: str = '',
) -> strA complete, annotated ushka.toml: every setting, with its default and its meaning.
overrides replaces defaults, {section: {key: value}} (ushka new uses
it for the project name). Secrets are written commented out.
def render_markdown
def render_markdown() -> strThe settings reference for the docs: one table per section. Generated, never hand-edited.