Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: pydantic 2 related cleanup #778

Merged
merged 26 commits into from
Jul 15, 2024
Merged

Conversation

lengau
Copy link
Contributor

@lengau lengau commented Jul 12, 2024

  • Have you signed the CLA?

Requires #775

lengau added 25 commits July 10, 2024 14:45
This class was vestigial, being a child of PluginPropertiesModel, while
all plugins' properties classes are children of PluginProperties,
which is itself a child of PluginPropertiesModel.

This is a breaking change because external plugins for applications
(e.g. snapcraft) inherit from both PluginProperties and PluginModel.
This does several things:

- Merges PluginProperties and PluginPropertiesModel
- Makes PluginProperties.unmarshal() work for most plugins be default
- Makes PluginProperties.marshal() fully dump json-able objects
- Adds a `plugin` field to all plugins, providing their names.
I missed some changes when I was playing with PluginProperties.
The plugin name will always be a string.
Moves the logic from extract_plugin_properties directly into
PluginProperties.unmarshal()
This allows sourcess to be validated using pydantic validation as well
as the auto-generation of json schemas for sources.
We don't have control here - either mypy is going to complain or pyright
is, and in this case pyright is more correct.
It is intentional that we change this to an incompatible type.
While we're at it, make it generic :-)
@lengau lengau marked this pull request as ready for review July 12, 2024 21:58
@lengau lengau requested a review from a team July 12, 2024 21:58
craft_parts/constraints.py Outdated Show resolved Hide resolved
craft_parts/constraints.py Show resolved Hide resolved
@lengau lengau requested a review from a team July 15, 2024 17:27
Co-authored-by: Dariusz Duda <[email protected]>
@lengau lengau merged commit 68d61fa into feature/2.0 Jul 15, 2024
8 checks passed
@lengau lengau deleted the work/CRAFT-2913/4-cleanup branch July 15, 2024 17:45
@lengau lengau linked an issue Jul 23, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate to Pydantic 2.x
3 participants