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

Enhancement: Validate config with pydantic #80

Open
benatouba opened this issue Nov 26, 2024 · 2 comments
Open

Enhancement: Validate config with pydantic #80

benatouba opened this issue Nov 26, 2024 · 2 comments

Comments

@benatouba
Copy link
Contributor

Would you be interested in implementing Pydantic classes for config model validation? This would yield type safety and greatly help with testing/lower the need for tests of config?

Pydantic GitHub is well-established, widely used and very perfomant (maybe not the most important point here). But I don't think it will go away anytime soon and greatly helps with further code development.

@gampnico
Copy link
Collaborator

Type validation with pydantic-settings would be great, as tomllib is quite brittle and users might get caught out on "true" and "True". I don't think there would be a compatibility issue with numba as njitted functions reference the Config class' attributes directly.

Performance is actually quite important here, as the majority of the performance increase with the latest release comes from the configuration system.

@benatouba
Copy link
Contributor Author

Ah okay. I agree. The first draft I created only uses pydantic base, not pydantic-settings. I was under the impression that the main advantage of pydantic-settings is the management of environment variables and secrets.

I think we can go from my implementation to adding support for pydantic-settings quite easily though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants