Skip to content

Conversation

@sudoping01
Copy link
Collaborator

Here's a complete and clear Pull Request template filled out based on your recent commits:


Pull Request

Description

This PR centralizes configuration management across the SDK by introducing a Settings class using pydantic-settings. It replaces global constant imports with a single, validated source of truth for environment-based configuration (e.g., API key, base URL, speaker IDs). This refactor improves code clarity, safety, and maintainability.

Related Issue(s)

Closes #9 (Refactor settings management)

Changes Made

  • Added Settings class using pydantic.BaseSettings with environment variable validation.
  • Updated auth, client, and tts modules to use Settings instead of global constants.
  • Removed redundant environment variable loading and global imports.
  • Added UUID-based validation for the API key in Auth.
  • Made base_url an optional parameter with fallback to settings.
  • Updated setup.py to ensure compatibility with pydantic-settings.

Testing

  • Ran the CLI entry point: python -m cookbook.main — ✅ No runtime errors.
  • Verified that API key fallback and validation logic work correctly.
  • Confirmed proper loading of environment variables for all components.

Checklist

  • Code follows style guidelines (ruff, isort, and optionally black).
  • Tests added or updated in the cookbook module.
  • Documentation updated (e.g., README.md or docs/).
  • All tests pass (python -m cookbook.main).
  • No linting errors (ruff check . and isort . --check-only).

Additional Notes

This refactor unifies configuration logic and simplifies dependency injection, especially useful for testing and production overrides.

Tag @sudoping01 for review. Thanks for contributing to Djelia Python SDK! ❤️🇲🇱

@sudoping01 sudoping01 merged commit 3e4439f into main Jun 27, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cannot import name 'API_KEY_HEADER' from 'djelia.models.models'

2 participants