Skip to main content

pyfia.core.settings

Settings management for pyFIA using Pydantic Settings. This module provides centralized configuration with environment variable support. It is the canonical source for all pyFIA configuration.

Functions

get_default_db_path

get_default_db_path() -> Path
Get the default database path. Checks environment variables and settings for database path. Returns:
  • Path to the default database

get_default_engine

get_default_engine() -> str
Get the default database engine. Returns:
  • Default engine type (“sqlite” or “duckdb”)

Classes

PyFIASettings

Central settings for pyFIA with environment variable support. Environment variables are prefixed with PYFIA_. For example: PYFIA_DATABASE_PATH, PYFIA_LOG_LEVEL Also supports legacy environment variables FIA_DB_PATH and FIA_DB_ENGINE for backwards compatibility. Methods:

validate_engine

validate_engine(cls, v: str) -> str
Validate database engine choice. Args:
  • v: Database engine to validate
Returns:
  • Validated and lowercased engine name

validate_log_level

validate_log_level(cls, v: str) -> str
Validate log level. Args:
  • v: Log level to validate
Returns:
  • Validated and uppercased log level

validate_database_path

validate_database_path(cls, v: Path) -> Path
Validate database path exists. Args:
  • v: Database path to validate
Returns:
  • Validated database path

create_directories

create_directories(self) -> None
Create necessary directories if they don’t exist.

Returns:

get_connection_string

get_connection_string(self) -> str
Get database connection string. Returns:
  • Database connection string for the configured engine