-
Notifications
You must be signed in to change notification settings - Fork 9
feat(prepro): use pydantic to validate and parse the prepro config #5769
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
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
I fixes the issued raised by claude - were very good comments! |
PR Review: feat(prepro): use pydantic to validate and parse the prepro configThis is a solid refactoring that improves type safety and validation. The migration from dataclasses to Pydantic models is well-executed overall. Here are my detailed findings: ✅ Strengths
🔴 Critical Issues1. Environment variable type conversion missing (config.py:181-188)env_overrides = {}
for key in Config.model_fields:
env_var = f"PREPROCESSING_{key.upper()}"
if env_var in os.environ:
env_overrides[key] = os.environ[env_var] # ⚠️ Always a string!Problem: Environment variables are always strings, but Pydantic expects typed values. For example:
Impact: This will likely cause Pydantic validation errors when env vars are used. Fix: Either:
2. Pydantic version is quite old- pydantic=2.12.3Current latest: Pydantic 2.10.x is latest stable (as of Jan 2025). Version 2.12.3 seems like a typo or version pinning issue. Action needed: Verify the intended version. If 2.12.3 doesn't exist, this will fail during conda env creation.
|
|
I tested the issue claude raised and can confirm this is not an issue: |
partially resolves #5770
This does not yet use pydantic-settings, in a later step we should also refactor to use it for creating the cli args and reading in the env variables.
Screenshot
PR Checklist
All necessary documentation has been adapted.🚀 Preview: https://prepro-pydantic.loculus.org