← Back to issue list

Make Pydantic models more idiomatic

View original Github issue

Metadata

Project
craft-archives
Number
#118
Type
issue
State
open
Author
lengau
Labels
Created
Updated
Closed

Current evaluation

Task to modernize pydantic models for idiomatic pydantic 2 usage and better JSON schema generation. Filed by maintainer 817 days ago; pydantic 2 upgrade (#103) and follow-up commits have largely addressed the core concerns. No labels or maintainer response beyond Jira bot sync.

Suggested action: close stale

Reason: The pydantic 2 upgrade (PR #103) was completed and subsequent commits (#122 eliminate pydantic warnings, #162 add fields/docstrings) have continued modernizing the models. The current code in package_repository.py uses idiomatic pydantic 2 patterns (ConfigDict, field_validator, model_validator, Annotated types, Field with description/examples), indicating the core work items from the referenced PR #103 review comments have been addressed. The issue is 817 days old with no labels or maintainer engagement beyond the Jira bot.

Impact: 25 Quick Win: 15.0 Staleness: 70 Complexity: 40 Confidence: 65 Support Request: 5

Issue body

### What needs to get done The current pydantic models have run through several pydantic updates and could use some updates to make them more idiomatic and work more nicely with generating JSON schemas. Relevant updates include: - https://github.com/canonical/craft-archives/pull/103/files#r1626427344 - https://github.com/canonical/craft-archives/pull/103/files#r1610575091 - https://github.com/canonical/craft-archives/pull/103/files#r1610576846 ### Why it needs to get done Automatic generation of JSON schemas and efficiency with pydantic 2

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 25
Quick Win: 15.0
Staleness: 70
Complexity: 40
Confidence: 65
Support Request: 5
close stale Task to modernize pydantic models for idiomatic pydantic 2 usage and better JSON schema generation. Filed by maintainer 817 days ago; pydantic 2 upgrade (#103) and follow-up commits have largely addressed the core concerns. No labels or maintainer response beyond Jira bot sync.
qwen/qwen3.6-35b-a3b
Staleness: 85
Complexity: 20
Confidence: 75
Support Request: 10
needs triage Request to update Pydantic models for idiomatic Pydantic 2 usage and improved JSON schema generation. Currently unlabelled, inactive for over a year, with only a Jira sync bot comment.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 40
Confidence: 75
Support Request: 10
needs triage Request to update Pydantic models for Pydantic 2 compatibility and idiomatic usage. Currently unlabelled, inactive for over a year, with only a Jira sync bot comment.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 20
Confidence: 80
Support Request: 5
needs triage Refactor Pydantic models to align with Pydantic 2 standards and improve JSON schema generation. Open and inactive for over a year, awaiting triage and assignment. Synced to Jira as CRAFT-2998.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: craft-archives#103 (confidence 75%)

    Pydantic 2.x upgrade PR that the issue explicitly references; subsequent commits (#122, #162) further modernized the models to use ConfigDict, field_validator, Annotated types, and Field metadata for JSON schema generation.

  • Related To: craft-archives#122 (confidence 60%)

    Eliminated pydantic warnings, part of the ongoing effort to make models more idiomatic with pydantic 2.

  • Related To: craft-archives#162 (confidence 55%)

    Added fields and docstrings to package repository models, improving JSON schema generation quality.

Related issues

Issue Project State Summary Similarity
#254 refactor: make pydantic models more idiomatic craft-archives open Refactors pydantic models to be more idiomatic. All CI checks passing. No reviewers assigned or comments yet.
72%
#5655 Use pydantic instead of jsonschema for legacy store snapcraft open Enhancement to migrate legacy store response parsing (channel_map.py) from pinned jsonschema 2.6.0 to Pydantic models. Triaged by a maintainer with Jira ticket SNAPCRAFT-1203, but no activity for over a year; code at HEAD still uses jsonschema, so the work remains.
72%
#657 Migrate to Pydantic 2 rockcraft closed Migrated models and schema to Pydantic 2 ahead of Pydantic 1 EOL. Resolved and merged via pull request #663.
71%
#776 feat: add pydantic models for all sources craft-parts merged Merged to add Pydantic models for all sources, enabling JSON schema generation for parts. Approved by two reviewers, depends on #775, and updates 16 files with a net reduction of 103 lines.
71%
#41 Models should be upgraded to pydantic craft-archives closed Upgraded models to pydantic. Resolved via merged pull request #57.
70%