Module-Level Configuration
Defined at the top-level of a Python module (file), typically as global variables or constants. For example:
1 | # settings.py |
Usage:
1 | from settings import API_KEY, DEBUG, TIMEOUT |
Pydantic-Based Configuration
Pydantic is a data validation and parsing library.
define config (or any data model) as a class with type annotations, validation, and parsing built-in.
1 | from pydantic import BaseSettings |