Skip to content

switch settings to use pydantic-settings#1281

Merged
dimitri-yatsenko merged 2 commits intodatajoint:pre/v2.0from
d-v-b:chore/use-pydantic-settings
Dec 19, 2025
Merged

switch settings to use pydantic-settings#1281
dimitri-yatsenko merged 2 commits intodatajoint:pre/v2.0from
d-v-b:chore/use-pydantic-settings

Conversation

@d-v-b
Copy link
Copy Markdown
Contributor

@d-v-b d-v-b commented Dec 17, 2025

This replaces the settings management with a pydantic-settings-based approach. For backwards compatibility, old APIs are added on top of the new pydantic-based foundation. Opening as a draft while I iterate on the implementation.

@github-actions github-actions Bot added the enhancement Indicates new improvements label Dec 17, 2025
@d-v-b d-v-b marked this pull request as ready for review December 17, 2025 19:54
@d-v-b
Copy link
Copy Markdown
Contributor Author

d-v-b commented Dec 17, 2025

this is ready for review. I did not change how the config is used in the codebase. I recommend deprecating the mutable-mapping approach (config["database.password"] = new_password) because this is harder to make type-safe and also doesn't support autocomplete. A simpler API is probably something like config.database.password = new_password or config.database.set_password(new_password).

Comment thread src/datajoint/settings.py
self[key] = value


# Default configuration dictionary for backward compatibility
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am okay with the settings not being backward compatible. This is a major release where we can break settings compatibility. The data will be backward compatible.

@dimitri-yatsenko dimitri-yatsenko merged commit defebec into datajoint:pre/v2.0 Dec 19, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Indicates new improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants