Upgrade pydantic v2#100
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request migrates JADE’s Pydantic usage from the pydantic.v1 compatibility layer to native Pydantic v2 APIs, updating model configuration, validators, and serialization across the CLI, jobs, and extensions codepaths.
Changes:
- Replaced v1 imports/usages (
pydantic.v1.*,.dict(),.json(),__fields__,root_validator/validator) with v2 equivalents (model_dump*,model_fields,field_validator,model_validator,ConfigDict). - Adjusted model field defaults and types for Pydantic v2 semantics (notably
Optional[...]fields now explicitly default toNone). - Updated GitHub workflow Python versions to 3.13.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_hpc.py | Updates validation error import and model serialization for Pydantic v2. |
| jade/utils/utils.py | Updates BaseModel import and JSON encoding of Pydantic models via model_dump(). |
| jade/models/submitter_params.py | Migrates Field import; updates poll_interval type; replaces custom dict() with model_dump(). |
| jade/models/submission_group.py | Migrates Field import to Pydantic v2. |
| jade/models/spark.py | Migrates validators from root_validator to model_validator; updates optional typing. |
| jade/models/singularity.py | Migrates validators to field_validator; adds explicit None default for optional container path. |
| jade/models/pipeline.py | Migrates Field import; adds explicit None defaults for Optional fields. |
| jade/models/jobs.py | Migrates Field import; adds v2 field validator for job id coercion. |
| jade/models/hpc.py | Migrates validators to v2 APIs; adds explicit defaults for Optional fields; refactors model validators. |
| jade/models/cluster_config.py | Migrates Field import; adds explicit None default for Optional field. |
| jade/models/base.py | Migrates base model configuration from v1 Config to v2 ConfigDict. |
| jade/models/init.py | Updates schema/default extraction to v2 model_json_schema(). |
| jade/jobs/pipeline_manager.py | Migrates pipeline config serialization to model_dump_json(). |
| jade/jobs/job_configuration.py | Migrates field introspection from __fields__ to model_fields; updates serialization calls. |
| jade/jobs/cluster.py | Migrates cluster/job status serialization and hashing to model_dump*. |
| jade/extensions/generic_command/generic_command_parameters.py | Migrates validators/introspection/serialization to v2 APIs; adds explicit defaults for Optional fields. |
| jade/cli/spark.py | Migrates spark config serialization to model_dump*. |
| jade/cli/config.py | Migrates JSON generation to model_dump_json() for enum/value conversion. |
| jade/cli/common.py | Migrates model field enumeration to model_fields for click options. |
| .github/workflows/publish_to_pypi.yml | Updates workflow Python version to 3.13. |
| .github/workflows/gh-pages.yml | Updates workflow Python version to 3.13. |
| .github/workflows/conda_build.yml | Updates workflow Python version to 3.13. |
| .github/workflows/codecov.yml | Updates workflow Python version to 3.13. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Use @model_serializer instead of overriding model_dump() so obsolete/
default fields are dropped across model_dump_json() and nested
serialization (SubmitterParams, GenericCommandParametersModel)
- Guard before-validators so a plain string is rejected rather than split
into characters (blocked_by, hpc_job_ids)
- assign_hpc: use info.data.get("hpc_type") for a structured ValidationError
instead of a raw KeyError
- Fix misleading gres validation message ('gpu:N', not 'gres=gpu:N')
- Bump actions/setup-python@v2 -> @v5 for reliable Python 3.13 provisioning
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| from pathlib import Path | ||
|
|
||
| from pydantic.v1 import BaseModel | ||
| from pydantic import BaseModel, ConfigDict |
github-actions Bot
pushed a commit
that referenced
this pull request
Jun 16, 2026
* Use Python 3.13 in actions * Upgrade to pydantic v2 models
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.