Closed afaerber closed 1 month ago
Updating the various occurrences of __fields__
to model_fields
did not help. According to StackOverflow the required
field was indeed dropped from FieldInfo
and annotations should be used instead.
The bump-pydantic
tool 0.8.0 only suggested one change in tt-tools-common
and nothing here for tt-smi
:
[ 16s] + bump-pydantic --diff tt_tools_common
[ 17s] [16:05:32] Start bump-pydantic. main.py:61
[ 17s] Found 21 files to process. main.py:78
[ 20s]
[ 26s]
[ 26s] --- tt_tools_common/reset_common/host_reset_log.py
[ 26s] +++ tt_tools_common/reset_common/host_reset_log.py
[ 26s] @@ -153,7 +153,7 @@
[ 26s] """Model for storing information about a mobo reset"""
[ 26s]
[ 26s] # allow for either an int or None
[ 26s] - nb_host_pci_idx: Union[List, None]
[ 26s] + nb_host_pci_idx: Union[List, None] = None
[ 26s] mobo: str
[ 26s] credo: List
[ 26s] disabled_ports: List
[ 26s] [16:05:41] Run successfully! main.py:154
[ 14s] + bump-pydantic tt_smi
[ 15s] [15:11:24] Start bump-pydantic. main.py:61
[ 15s] Found 6 files to process. main.py:78
[ 17s]
[ 23s]
[ 23s] [15:11:32] No files were modified. main.py:146
[ 23s] Run successfully! main.py:154
What distro is this?
openSUSE Tumbleweed, a rolling release.
Ok let me get my test box upgraded from F39 to F40, which should put me in roughly the same version range as Tumbleweed and see what's going on there.
Ok confirmed, and I've got a patch I'll push for testing by @sbansalTT in a minute. Don't think we are quite prepared to move to pydantic 2+ exclusively mostly because the base expected OS is Ubuntu 20.04, which has a MUCH older pydantic in it, and I'm hoping to get the rpm/deb packaging sorted (already have some RPMs, fighting with the debs right now) and leaving things on distro level packages where we can.
This should be sorted with the two commits @afaerber can you give it a go, we aren't seeing any issues on our test setups but would be good to have confirmation it's working on yours. Going to close this in the meantime, if it breaks re-open and we'll get it sorted.
Confirming both patches apply cleanly on top of the tags and work. Thanks!
pyproject.toml has
'pydantic==1.*'
. (tt-tools-common's pyproject.toml does not list it as dependency, despite using it - separate issue.)However, with distro-provided pydantic 2.7.3 package I am seeing errors like the following from both tt-tools-common and tt-smi code:
A workaround is to patch the following files to import
pydantic.v1[.fields]
rather thanpydantic[.fields]
: /usr/lib/python3.11/site-packages/tt_tools_common/reset_common/host_reset_log.py /usr/lib/python3.11/site-packages/tt_smi/log.py Cf. https://docs.pydantic.dev/latest/migration/#continue-using-pydantic-v1-featuresA better solution would probably be to update the code to use pydantic >= 2.0. Cf. https://docs.pydantic.dev/latest/migration/#migration-guide