Refactor models#9
Merged
Merged
Conversation
Owner
jotonedev
commented
Sep 13, 2025
- Removed pydantic
- Reduced the number and sizes of the dependencies
☂️ Python Coverage
Overall Coverage
New Files
Modified Files
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the models by replacing Pydantic with dataclasses and dataclasses-json, removing several dependencies to reduce package size and complexity.
- Migrated all model classes from Pydantic BaseModel to frozen dataclasses with dataclasses-json
- Replaced pydantic-extra-types CountryAlpha2 with a custom CountryCode enum
- Updated all model instantiation calls from model_validate() to from_dict()
Reviewed Changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Updated dependencies to remove pydantic and add dataclasses-json, bumped version to 0.2.0 |
| tests/test_client.py | Updated test assertions to use new field names (team_id, team_name) instead of aliased names |
| ctftime_api/models/*.py | Converted all models from Pydantic to dataclasses with dataclasses-json mixins |
| ctftime_api/models/country.py | Added custom CountryCode enum to replace pydantic-extra-types dependency |
| ctftime_api/client.py | Updated model instantiation calls and import statements for the new model structure |
Comments suppressed due to low confidence (1)
pyproject.toml:17
- The classifier 'Framework :: Pydantic' should be removed since Pydantic is no longer used in this project.
"Framework :: Pydantic",
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
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.