new·Earn with mozg — 20% of every monthSend somebody here and take a fifth of every plan payment they make, for as long as they keep paying — not a bounty on the first invoice. Your handle is the link, the window is thirty days, and the commission lands on your balance the second they pay. Free to join: if you have signed in, you already have the link. mozg.sh/earnall news →
mozg.beta
Sign in

Pydantic · all subjects

settings management

6 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Pydantic Settings module for environment configuration

Pydantic Settings is an optional module that provides features for loading a settings or config class from environment variables or secrets files.

Settings validation errors from environment sources

Settings are validated from environment variables and secrets files. A ValidationError from Pydantic when loading settings points at an environment value that did not match its field type or validation rules.

Using Logfire to debug failed settings validation

Logfire can record failed validations and their structured errors when loading settings, so you can see which setting failed and why.

Use pydantic-settings for file-based configuration

For parsing configuration or settings from files, consider using the pydantic-settings library which offers built-in support for parsing various file formats.

BaseSettings moved to pydantic-settings package

In Pydantic V2, BaseSettings has been moved to a separate package, pydantic-settings. It is no longer part of the core Pydantic package.

parse_env_var classmethod removed from settings

In Pydantic V2, the `parse_env_var` classmethod has been removed from BaseSettings. Customize settings sources instead to have your own parsing function.

Give your agent this brain