← 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

Pydantic 2 modernization and schema-enabling model metadata now appear implemented through later cleanup and model-documentation changes, despite the issue remaining open.

Suggested action: close resolved

Reason: Current models use Pydantic 2 APIs including ConfigDict, model_validate/model_dump, field validators, and Annotated/Field metadata; commit 00b9b3b (PR #122) removed Pydantic warnings. Commit 4c16960 (PR #162) subsequently added field descriptions and docstrings to the repository models, addressing the automatic JSON-schema goal.

Evaluated by: mr-cal-bot

Impact: 48 Quick Win: 23 Complexity: 42 Confidence: 90 Actionability: 82

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
stealth/space-bunny-alpha
Impact: 48
Quick Win: 23
Complexity: 42
Confidence: 90
Actionability: 82
close resolved Pydantic 2 modernization and schema-enabling model metadata now appear implemented through later cleanup and model-documentation changes, despite the issue remaining open.
qwen/qwen3.6-35b-a3b
Impact: 30
Quick Win: 14
Complexity: 25
Confidence: 50
Actionability: 60
needs triage Follow-up to make Pydantic models more idiomatic after pydantic 2.x upgrade, referencing unresolved review comments from PR #103
qwen/qwen3.8-27b
Impact: 25
Quick Win: 15
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.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/craft-archives#103 (confidence 100%)

    This was the Pydantic 2 upgrade PR whose review comments originated the follow-up.

  • Likely Fixed By: canonical/craft-archives#162 (confidence 97%)

    Commit 4c16960 added fields and documentation to package repository models, directly improving generated JSON schemas.

  • Likely Fixed By: canonical/craft-archives#122 (confidence 94%)

    Commit 00b9b3b eliminated Pydantic warnings after the Pydantic 2 migration.

Related issues

Issue Project State Summary Similarity
#1713 Autodocs: Updates for pydantic models charmcraft open Documentation task has two concrete goals: one charmcraft.yaml schema and alphabetised schema entries. Schema generation now exists, but ordering and autodoc integration remain unverified.
72%
#1330 Improve Pydantic schema for parts craft-parts open Triaged enhancement to model source, override, build/stage package, and snap properties directly in the Pydantic part schema; the raw-dictionary workaround remains in the codebase.
71%