Settings management using Pydantic. Provides BaseSettings for loading config from environment variables, .env files, and secrets files with full type validation. Extracted from pydantic core into a separate package in V2. Current version is 2.13.1 (Feb 2026).
Install & Compatibility
Where this runs
tested against v2.14.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.975 runs
installs and imports cleanly · install 0.0s · import 0.611s · 30.6MB
glibcpy 3.10–3.975 runs
installs and imports cleanly · install 3.4s · import 0.546s · 31MB
29MB installed
● package 29MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
from pydantic_settings import BaseSettings
from pydantic_settings import SettingsConfigDict
Minimal BaseSettings loading from .env file with pydantic-settings 2.x.
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(
env_file='.env',
env_file_encoding='utf-8',
extra='ignore' # ignore unknown env vars
)
api_key: str
debug: bool = False
port: int = 8000
# reads from env vars and .env file
settings = Settings()
print(settings.api_key)
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.