models: create grammar-aware pydantic models (CRAFT-856)
Metadata
Current evaluation
Merged. Introduces grammar-aware Pydantic models (GrammarStr, GrammarStrList, GrammarSingleEntryDictList) for lifecycle part build-environment attributes. Approved by one reviewer, passed CI, and modified 10 files.
Suggested action: —
No scores available.
Issue body
Define types GrammarStr (for grammar-aware strings), GrammarStrList
(for grammar-aware string lists) and GrammarSingleEntryDictList (for
grammar-aware lists of single-entry dictionaries). The latter is used
used in the `build-environment` attribute of lifecycle parts.
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged. Introduces grammar-aware Pydantic models (GrammarStr, GrammarStrList, GrammarSingleEntryDictList) for lifecycle part build-environment attributes. Approved by one reviewer, passed CI, and modified 10 files. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Introduces GrammarStr, GrammarStrList, and GrammarSingleEntryDictList Pydantic models to handle grammar-aware data structures, primarily for the build-environment attribute. Resolves CRAFT-856. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #21 feat: add create_grammar_model() | craft-grammar | merged | Merged create_grammar_model(), generating grammar-aware classes from Pydantic models by converting standard types. Approved by two reviewers, passes CI, and adds 245 lines across four files. | |
| #3654 projects: add grammar validation | snapcraft | merged | Merged after review and CI approval. Adds pydantic validation for snapcraft.yaml grammar using craft-grammar models. A follow-up update was noted to align with a craft-grammar version change that switched grammar entries to lists. | |
| #401 build!: update to pydantic 2 | craft-application | merged | Merged to update the codebase to Pydantic 2. Approved by two reviewers and passed CI. The change modified 23 files (+531/-342). Initial test failures were resolved after the craft-grammar dependency received a corresponding update. | |
| #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. | |
| #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. | |
| #34 fix(models): make grammar models work with Annotated | craft-grammar | merged | Merged a fix enabling grammar models to support Python's Annotated type hints. Approved by two reviewers, passed CI, and updated two files (+66/-14). | |
| #32 Make a pydantic 2 release of craft-grammar | craft-grammar | closed | Fixed by merging PR #33 into the feature/pydantic-2 branch, delivering the requested pydantic 2 release for craft-grammar. |