-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Bump pydantic version to ^2.0.0 #191
Conversation
I used the bump-pydantic initially but had to make some additional changes afterwards. Passes all tests locally so far. I also inlcuded the requirements.txt in the .gitignore file since it is only created for the purpose of `make requirements.txt`. Signed-off-by: Max Mäusezahl <maxmaeusezahl@googlemail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for testing this. I broke my ankle last October and between physical therapy and various work-related chaos I haven't had time to test the pydantic update.
Signed-off-by: Joe Block <jpb@unixorn.net>
just want to point out that versions of Pydantic > 2.0.0 have added a lot of really wild system level requirements and has made doing things on 32 bit ARM platforms like the RPI zero really difficult- I am having to manually downgrade to a version of ha-mqtt-discoverable to avoid moving to pydantic 2. I know type safety is cool and all, but them moving to a pure C implementation has made relying on it unnecessarily burdensome and adds a ton of bloat to libraries using it. |
to clarify things that I had to do:
I use ha-mqtt-discoverable on edge devices that don't need to be powerful or running the latest OS - pydantic core has taken a strange approach in v2 and not added numerous benefits. Understanding your use case here @unixorn - dealing with a conflict - but I'm going to have to pin to ha-mqtt-discoverable to 0.13.1 |
Hi, sorry to hear that my PR lead to such digressions (I got a notification as the author). Usually I'm all in favor of updating to the most recent dependencies, but for this particular package I understand why broad support across weak/old hardware is useful. I myself might want to target ARM 32bit architectures. Yet I don't really understand why this issue even appears. Shouldn't pip automatically dismiss ha-mqtt-discoverable 0.13.1 if it can't fulfill the requirements and choose an older version? Like: What specific package did you try to install? I think that pinning a specific version in a downstream package is the wrong step as it just relocates the problem. In this case, there might be an ad-hoc, "easy to maintain" solution to support both pydantic v1 and v2 by using the
I did purposely not choose this path (using the new API instead of the the pydantic.v1 compatibility layer) in my PR since I wanted to prevent accumulation of technical debt. But I guess under these specific circumstance I might be a temporary fix for ha-mqtt-discoverable to allow both pydantic v1 and pydantic v2. Imo, in the long run this should be treated differently. I imagine:
Yet both will probably require major work. |
I like the idea of using the same validator as HASS. I don't really have time rn to work on this, but I'm happy to accept more PRs. I'll add the 0.13.1 pin to the readme. |
The issue #175 also bit me. Luckily bumping the version did not seem too hard.
This PR would solve dependabots #188.
bump-pydantic
tool did half of the work (it modified the import statements)root_validator
tomodel_validator
change correctdict
tomodel_dump
. This seems work even with the old version, which is however deprecated and generates warning.requirements.txt
to the.gitignore
file since it seemed to have only been created for the purpose ofmake requirements.txt
.Type of changes
Checklist
#!/usr/bin/env interpreter
instead of potentially platform-specific direct paths (#!/bin/sh
is an allowed exception)