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

Replace pydantic with mashumaro #740

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

bvanelli
Copy link

Proposed Changes

This PR exchanges the pydantic dependency with mashumaro. This is due to the fact that the version of pydantic used is not anymore supported, and a migration was not accepted (see #531)

I've taken into account the following PRs from the author as references on how to do the migration:

Changelog

I had to to some unrelated changes to get the pipeline to run through, due to some library upgrades that now fail on CI. Since the content is not crazy big, I decided to add them to the same PR, but let me know if I should make a separate PR instead. Here is the list of changes:

  • Exchanged pydantic to mashumaro, like it was done on the other repositories
  • async_timeout.timeout has been replaced by asyncio.timeouts.timeout. See that the original library is not deprecated, and they recommend you to use asyncio instead. Since this library only supports Python 3.11 and above, the dependency is completely dropped (wasn't on the pyproject.toml either way).
  • File had to be reformatted with latest ruff for the CI workflow to succeed, so some styling changed here and there, like spacings between and within comments.
  • On the file .github/CODE_OF_CONDUCT.md, the codespell pre-commit was failing for the word socio-economic, so I changed it to socioeconomic. Seems like the word is not hyphenated
  • On CI linting workflow, the command poetry run ruff . was changed to poetry run ruff check .
  • I had to adapt the upload of artifacts because of Upcoming breaking change: Hidden Files will be excluded by default actions/upload-artifact#602, since the .coverage file would not be uploaded anymore without the include-hidden-files option.
  • Removed the dev dependency safety, as it was not being used and was causing pydantic to be installed either way (meaning it would appear on the lock file). Let me know if it should be kept (meaning pydantic will be still in the dev requirements).

Discussion

As far as tests are concerned, the changes should work out of the box, but I do not have one of those devices to test it. If there is a way to have simulated APIs or there are test cases that should be covered, let me know.

Related Issues

For the pydantic upgrade in HA, this change is necessary:

@bvanelli bvanelli changed the title Remove pydantic dependency Replace pydantic with mashumaro Nov 24, 2024
@allenporter
Copy link

Changelog

I had to to some unrelated changes to get the pipeline to run through, due to some library upgrades that now fail on CI.
Since the content is not crazy big, I decided to add them to the same PR, but let me know if I should make a separate PR instead.

I'd definitely say make each of these changes into separate PRs for each change mentioned (CI fixes, async timeout, grammar/spelling fixes, linting fixes, etc)

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.

2 participants