aeat.core.config module¶
Central settings facade for AEAT automation.
The Settings model is the environment authority for AEAT-prefixed
configuration: operators and tests override fields here, and downstream code
obtains the effective model through load_settings() or
override_settings(). Runtime-tunable settings stay in this schema, while
AEAT/Sede route and selector defaults come from
core.external_constants through the default factories below.
The storage boundary exposed here is also deliberate. Database URL derivation,
active-profile bucket routing, and route classification are surfaced through
StorageRouteClassification, classify_storage_route(), and
settings_for_active_profile_bucket() so write guards do not re-parse SQL
URLs or active-profile pointers independently.
- DEV_TEST_DATABASE_PASSWORD¶
Shared development/test password for database-backed secure-storage tests.
- DEV_TEST_DATABASE_PASSWORD_ENV_VAR¶
Environment variable backing
Settings.aeat_dev_test_database_password.
- class Settings(_case_sensitive=None, _nested_model_default_partial_update=None, _env_prefix=None, _env_prefix_target=None, _env_file=WindowsPath('.'), _env_file_encoding=None, _env_ignore_empty=None, _env_nested_delimiter=None, _env_nested_max_split=None, _env_parse_none_str=None, _env_parse_enums=None, _cli_prog_name=None, _cli_parse_args=None, _cli_settings_source=None, _cli_parse_none_str=None, _cli_hide_none_type=None, _cli_avoid_json=None, _cli_enforce_required=None, _cli_use_class_docs_for_groups=None, _cli_exit_on_error=None, _cli_prefix=None, _cli_flag_prefix_char=None, _cli_implicit_flags=None, _cli_ignore_unknown_args=None, _cli_kebab_case=None, _cli_shortcuts=None, _secrets_dir=None, _build_sources=None, **values)[source]¶
Bases:
AeatIntegrationSettingsApplication settings populated from environment variables and
.env.Field names map directly to env var names (uppercased). For example,
aeat_base_urlreadsAEAT_BASE_URL. The model is declarative: it carries operator choices, timeouts, storage roots, live-read opt-ins, and provider selectors, but does not open secret stores, build outbound providers, or execute AEAT browser flows.Validators keep derived paths coherent with
aeat_local_storage_rootand deriveaeat_database_urlfrom either an explicit field, the active profile, or the cold root fallback. Tests and CLI scopes should preferoverride_settings()over process-wide environment mutation whenever they are not explicitly testing environment parsing.- Parameters:
_case_sensitive (bool | None)
_nested_model_default_partial_update (bool | None)
_env_prefix (str | None)
_env_prefix_target (EnvPrefixTarget | None)
_env_file (DotenvType | None)
_env_file_encoding (str | None)
_env_ignore_empty (bool | None)
_env_nested_delimiter (str | None)
_env_nested_max_split (int | None)
_env_parse_none_str (str | None)
_env_parse_enums (bool | None)
_cli_prog_name (str | None)
_cli_settings_source (CliSettingsSource[Any] | None)
_cli_parse_none_str (str | None)
_cli_hide_none_type (bool | None)
_cli_avoid_json (bool | None)
_cli_enforce_required (bool | None)
_cli_use_class_docs_for_groups (bool | None)
_cli_exit_on_error (bool | None)
_cli_prefix (str | None)
_cli_flag_prefix_char (str | None)
_cli_implicit_flags (bool | Literal['dual', 'toggle'] | None)
_cli_ignore_unknown_args (bool | None)
_cli_kebab_case (bool | Literal['all', 'no_enums'] | None)
_secrets_dir (PathType | None)
_build_sources (tuple[tuple[PydanticBaseSettingsSource, ...], dict[str, Any]] | None)
aeat_browser_navigation_timeout_ms (Annotated[int, Gt(gt=0)])
aeat_browser_form_interaction_timeout_ms (Annotated[int, Gt(gt=0)])
aeat_browser_ver_click_timeout_ms (Annotated[int, Gt(gt=0)])
aeat_browser_selector_probe_timeout_ms (Annotated[int, Gt(gt=0)])
aeat_live_iva_declaration_capture_timeout_ms (Annotated[int, Gt(gt=0)])
aeat_live_filed_register_walk_timeout_ms (Annotated[int, Gt(gt=0)])
aeat_live_iva_cancellation_drain_ms (Annotated[int, Ge(ge=0)])
aeat_live_iva_cli_watchdog_timeout_ms (Annotated[int, Gt(gt=0)])
aeat_llm_openai_chat_completions_url (str)
aeat_llm_gemini_generate_content_template (str)
aeat_llm_ollama_chat_url (str)
aeat_llm_ollama_vision_model (str)
aeat_llm_default_temperature (Annotated[float, Ge(ge=0.0), Le(le=2.0)])
aeat_browser_timezone (Annotated[str, MinLen(min_length=1)])
aeat_bucket_lock_poll_interval_s (Annotated[float, Gt(gt=0)])
aeat_bucket_default_idle_lock_minutes (Annotated[int, Gt(gt=0)])
aeat_auth_clave_movil_lock_buffer_s (Annotated[int, Gt(gt=0)])
aeat_log_stderr_level (str)
aeat_log_file_level (str)
aeat_log_root_level (str)
aeat_google_drive_vault_folder_name (Annotated[str, MinLen(min_length=1)])
aeat_google_oauth_access_refresh_buffer_s (Annotated[int, Gt(gt=0)])
aeat_workbook_parity_per_file_timeout_s (Annotated[float, Gt(gt=0)])
aeat_workbook_parity_recalc_timeout_s (Annotated[int, Gt(gt=0)])
aeat_workbook_parity_libreoffice_timeout_s (Annotated[int, Gt(gt=0)])
aeat_registry_parity_store_dir (Path)
aeat_registry_disk_cache_dir (Path | None)
aeat_calc_sheets_recalc_delay_s (Annotated[float, Gt(gt=0)])
financial_base_currency (str)
financial_default_csv_encoding (str)
aeat_financial_txs_dir (Path)
aeat_invoices_dir (Path)
aeat_attachments_dir (Path)
aeat_purchase_invoice_evidence_dir (Path)
aeat_usage_ratios_path (Path)
aeat_ledgers_dir (Path)
aeat_token_dir (Path)
aeat_base_url (str)
aeat_log_level (str)
aeat_output_language (Annotated[OutputLanguage | None, BeforeValidator(func=~aeat.core._config_support.coerce_output_language_setting, json_schema_input_type=PydanticUndefined)])
aeat_authoritative_language_aeat_terms (str)
aeat_authoritative_language_project_docs (str)
aeat_fallback_languages (str)
aeat_database_url (str)
aeat_storage_backup_dir (Path)
aeat_secret_store_backend (SecretStoreBackend)
aeat_allow_unencrypted (str)
aeat_secret_store_dir (Path)
aeat_dev_test_database_password (SecretStr)
aeat_blob_store_dir (Path)
aeat_audit_dir (Path)
aeat_storage_provider_kind (str)
aeat_local_storage_root (Path)
aeat_google_drive_root_folder_id (str | None)
aeat_live_tests_enabled (str)
aeat_live_tests_google (str)
aeat_replay_active (str)
aeat_force_color (bool)
no_color (bool)
aeat_cli_reveal_identifiers (bool)
aeat_log_dir (Path | None)
aeat_libreoffice_executable (Path | None)
aeat_secret_passphrase (SecretStr | None)
aeat_manuals_root (Path)
aeat_manuals_review_required (bool)
aeat_normatives_root (Path)
aeat_iva_catalogue_root (Path)
aeat_browser_channel (str)
aeat_browser_headless (bool)
aeat_wallet_diagnostic_dump_dir (Path | None)
aeat_active_profile (str | None)
aeat_proxy_url (str)
aeat_proxy_username (str)
aeat_proxy_password_secret (SecretStr | None)
aeat_proxy_bypass (str)
aeat_rate_limit_delay_seconds (float)
site_health_probe_url (str)
site_health_rate_limit_retry_after_default (Annotated[int, Ge(ge=1)])
aeat_certificate_path (Path | None)
aeat_certificate_password_secret (SecretStr | None)
aeat_certificate_friendly_name (str | None)
aeat_certificate_backend (CertificateBackend)
aeat_certificate_verify_url (str)
aeat_strict_security (bool)
aeat_auth_provider (AuthProviderKindSetting | None)
aeat_clave_movil_dni_nie (SecretStr | None)
aeat_clave_movil_dni_fecha (str | None)
aeat_clave_movil_nie_soporte (SecretStr | None)
aeat_clave_prefer_non_qr (bool)
aeat_clave_movil_timeout_ms (Annotated[int, Ge(ge=30000), Le(le=120000)])
aeat_clave_sede_access_url_template (str)
aeat_sede_expedientes_path (str)
aeat_clave_permanente_dni_nie (SecretStr | None)
aeat_clave_permanente_password (SecretStr | None)
aeat_clave_permanente_timeout_ms (Annotated[int, Ge(ge=15000), Le(le=120000)])
aeat_clave_permanente_sede_access_url_template (str)
aeat_llm_provider (LLMProviderSetting)
aeat_llm_model (str)
aeat_llm_anthropic_api_key (SecretStr | None)
aeat_llm_openai_api_key (SecretStr | None)
aeat_llm_gemini_api_key (SecretStr | None)
aeat_llm_cache_dir (Path)
aeat_llm_usage_dir (Path)
aeat_llm_run_telemetry_dir (Path)
aeat_llm_run_telemetry_retention_days (Annotated[int, Ge(ge=1)])
aeat_llm_run_telemetry_max_records (Annotated[int, Ge(ge=1)])
aeat_llm_default_timeout_s (int)
aeat_llm_max_retries (int)
aeat_evidence_cloud_upload_permitted (bool)
aeat_evidence_gestor_mode (bool)
aeat_telemetry_opt_in (bool)
aeat_telemetry_tier (TelemetryTier)
aeat_telemetry_gestor_mode (bool)
aeat_telemetry_endpoint (str | None)
aeat_deadline_due_soon_days (int)
aeat_submissions_dir (Path)
aeat_submission_browser_trace_dir (Path)
aeat_inbox_dir (Path)
aeat_inbox_pdf_dir (Path)
aeat_inbox_alert_lead_days (int)
aeat_workflow_runs_dir (Path)
aeat_drafts_dir (Path)
aeat_draft_fail_on_warning (bool)
aeat_m210_engine_live (bool)
aeat_status_cache_dir (Path)
aeat_status_cache_ttl_s (int)
aeat_status_browser_trace_dir (Path)
aeat_status_detail_url_template (str)
aeat_status_notificaciones_path (str)
aeat_runs_dir (Path)
aeat_justificantes_dir (Path)
aeat_justificante_parser_backend (JustificanteParserBackendSetting)
aeat_filing_history_dir (Path)
aeat_filing_history_cache_ttl_s (int)
aeat_filing_history_archive_html (bool)
- aeat_token_dir: Path¶
- aeat_base_url: str¶
- aeat_log_level: str¶
- aeat_output_language: Annotated[OutputLanguage | None, BeforeValidator(_coerce_output_language_setting)]¶
- aeat_authoritative_language_aeat_terms: str¶
- aeat_authoritative_language_project_docs: str¶
- aeat_fallback_languages: str¶
- aeat_database_url: str¶
- aeat_storage_backup_dir: Path¶
- aeat_secret_store_backend: SecretStoreBackend¶
- aeat_allow_unencrypted: str¶
- aeat_secret_store_dir: Path¶
- aeat_dev_test_database_password: SecretStr¶
- aeat_blob_store_dir: Path¶
- aeat_audit_dir: Path¶
- aeat_storage_provider_kind: str¶
- aeat_local_storage_root: Path¶
- aeat_google_drive_root_folder_id: str | None¶
- aeat_live_tests_enabled: str¶
- aeat_live_tests_google: str¶
- property live_tests_enabled: bool¶
Whether the pytest live-read opt-in is enabled.
This is a strict
"1"predicate for test selection only; production live-read access gates consume their own policy and capability checks.
- property live_tests_google_enabled: bool¶
Whether the Google live-test opt-in is enabled.
Google OAuth / Drive tests use the same strict
"1"predicate as the general live-read opt-in and remain separate from production provider construction.
- aeat_replay_active: str¶
- aeat_force_color: bool¶
- no_color: bool¶
- aeat_cli_reveal_identifiers: bool¶
- aeat_log_dir: Path | None¶
- aeat_libreoffice_executable: Path | None¶
- aeat_secret_passphrase: SecretStr | None¶
- aeat_manuals_root: Path¶
- aeat_manuals_review_required: bool¶
- aeat_normatives_root: Path¶
- aeat_iva_catalogue_root: Path¶
- aeat_browser_channel: str¶
- aeat_browser_headless: bool¶
- aeat_wallet_diagnostic_dump_dir: Path | None¶
- aeat_active_profile: str | None¶
- aeat_proxy_url: str¶
- aeat_proxy_username: str¶
- aeat_proxy_password_secret: SecretStr | None¶
- aeat_proxy_bypass: str¶
- aeat_rate_limit_delay_seconds: float¶
- site_health_probe_url: str¶
- site_health_rate_limit_retry_after_default: int¶
- aeat_certificate_path: Path | None¶
- aeat_certificate_password_secret: SecretStr | None¶
- aeat_certificate_friendly_name: str | None¶
- aeat_certificate_backend: CertificateBackend¶
- aeat_certificate_verify_url: str¶
- aeat_auth_timeout_ms: int¶
- aeat_strict_security: bool¶
- aeat_cert_warn_days: int¶
- aeat_cert_critical_days: int¶
- aeat_auth_provider: AuthProviderKindSetting | None¶
- aeat_clave_movil_dni_nie: SecretStr | None¶
- aeat_clave_movil_dni_fecha: str | None¶
- aeat_clave_movil_nie_soporte: SecretStr | None¶
- aeat_clave_prefer_non_qr: bool¶
- aeat_clave_movil_timeout_ms: int¶
- aeat_clave_sede_access_url_template: str¶
- aeat_sede_expedientes_path: str¶
- aeat_clave_permanente_dni_nie: SecretStr | None¶
- aeat_clave_permanente_password: SecretStr | None¶
- aeat_clave_permanente_timeout_ms: int¶
- aeat_clave_permanente_sede_access_url_template: str¶
- aeat_llm_provider: LLMProviderSetting¶
- aeat_llm_model: str¶
- aeat_llm_anthropic_api_key: SecretStr | None¶
- aeat_llm_openai_api_key: SecretStr | None¶
- aeat_llm_gemini_api_key: SecretStr | None¶
- aeat_llm_cache_dir: Path¶
- aeat_llm_usage_dir: Path¶
- aeat_llm_run_telemetry_dir: Path¶
- aeat_llm_run_telemetry_retention_days: int¶
- aeat_llm_run_telemetry_max_records: int¶
- aeat_llm_default_timeout_s: int¶
- aeat_llm_max_retries: int¶
- aeat_evidence_cloud_upload_permitted: bool¶
- aeat_evidence_gestor_mode: bool¶
- aeat_telemetry_opt_in: bool¶
- aeat_telemetry_tier: TelemetryTier¶
- aeat_telemetry_gestor_mode: bool¶
- aeat_telemetry_endpoint: str | None¶
- aeat_deadline_due_soon_days: int¶
- aeat_submissions_dir: Path¶
- aeat_submission_browser_trace_dir: Path¶
- aeat_inbox_dir: Path¶
- aeat_inbox_pdf_dir: Path¶
- aeat_inbox_alert_lead_days: int¶
- aeat_workflow_runs_dir: Path¶
- aeat_drafts_dir: Path¶
- aeat_draft_fail_on_warning: bool¶
- aeat_m210_engine_live: bool¶
- aeat_status_cache_dir: Path¶
- aeat_status_cache_ttl_s: int¶
- aeat_status_browser_trace_dir: Path¶
- aeat_status_detail_url_template: str¶
- aeat_status_notificaciones_path: str¶
- aeat_runs_dir: Path¶
- aeat_justificantes_dir: Path¶
- aeat_justificante_parser_backend: JustificanteParserBackendSetting¶
- aeat_filing_history_dir: Path¶
- aeat_filing_history_cache_ttl_s: int¶
- aeat_filing_history_archive_html: bool¶
- static external_constants()[source]¶
Return the parsed external-constants registry.
Bridges
core.external_constantsto the settings facade so callers reach third-party hostnames, AEAT service paths, OAuth scopes, and LLM endpoints through a single accessor.- Return type:
- Returns:
The process-wide cached
ExternalConstantsinstance.
- classify_storage_route(settings=None)[source]¶
Classify the effective primary SQL route.
The returned
StorageRouteClassificationdistinguishes explicit database URLs, active-profile bucket databases, and cold root-fallback SQLite routes. Application write guards consume this facade instead of re-parsingaeat_database_urlor duplicating active-profile pointer rules.- Return type:
- Parameters:
settings (Settings | None)
- settings_for_active_profile_bucket(bucket_id, source=None)[source]¶
Return settings routed to
bucket_id’s active-profile database.Non-route fields are preserved from
source(orload_settings()), whileaeat_database_urlis re-derived through the same validators used by normal settings construction. Explicit database URLs are refused by the lower-level route helper because they already define the storage authority.
- load_settings()[source]¶
Return the effective
Settingsinstance.Context-local overrides installed by
override_settings()win inside their block; otherwise this constructs a fresh model from the configured environment sources.- Return type:
- override_settings(**overrides)[source]¶
Override one or more
Settingsfields for the with-block.Overrides are validated through normal model construction so derived route, token, log, and storage-substrate paths stay coherent. The helper preserves
model_fields_setto keep the distinction between explicit operator settings and computed defaults visible to route classification.