Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Improve Pydantic configuration discrimination #366

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

jdeschamps
Copy link
Member

Description

Did I mention I love Pydantic?

The discrimination between algorithm-specific configurations by Pydantic generates a lot of errors when failing (#356). This can be avoided using a Discriminator in the Union.

Changes Made

  • Modified: Configuration factory module.

Related Issues

Breaking changes

No change.


Please ensure your PR meets the following requirements:

  • Code builds and passes tests locally, including doctests
  • New tests have been added (for bug fixes/features)
  • Pre-commit passes
  • PR to the documentation exists (for bug fixes / features)

Copy link
Member

@melisande-c melisande-c left a comment

Choose a reason for hiding this comment

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

Looks good, however if N2VDataConfig is removed in #365, then it will no longer be necessary to split at the configuration level?

@jdeschamps
Copy link
Member Author

jdeschamps commented Jan 22, 2025

Looks good, however if N2VDataConfig is removed in #365, then it will no longer be necessary to split at the configuration level?

Let's keep the discussion in a single place, I will create an issue. I will merge this for now. Easy enough to fall back to a single configuration.

@jdeschamps jdeschamps merged commit 9a027a5 into main Jan 22, 2025
18 checks passed
@jdeschamps jdeschamps deleted the jd/feat/improve_config_factory branch January 22, 2025 13:20
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.

Pydantic errors are overwhelming in convenience functions
3 participants