Refactor settings #10
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Settingsclass usingpydantic-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
Settingsclass usingpydantic.BaseSettingswith environment variable validation.auth,client, andttsmodules to useSettingsinstead of global constants.Auth.base_urlan optional parameter with fallback to settings.setup.pyto ensure compatibility withpydantic-settings.Testing
python -m cookbook.main— ✅ No runtime errors.Checklist
ruff,isort, and optionallyblack).cookbookmodule.README.mdordocs/).python -m cookbook.main).ruff check .andisort . --check-only).Additional Notes
This refactor unifies configuration logic and simplifies dependency injection, especially useful for testing and production overrides.
Tag
@sudoping01for review. Thanks for contributing to Djelia Python SDK! ❤️🇲🇱