ReadAlongs / Studio

Audiobook alignment for Indigenous languages
https://readalongs.github.io/Studio/
Other
38 stars 20 forks source link

web_api.py uses Pydantic but we don't declare the version we need, and we get deprecated warnings with Pydantic 2 #215

Closed joanise closed 6 months ago

joanise commented 6 months ago

We clearly rely on g2p requiring pydantic for us, but since Pydantic v1 and v2 are quite different, we should declare the version we expect in requirements.txt, and fix this deprecation warning I got from web_api.py with Pydantic 2.4.0 installed:

C:\Users\joanise\Miniconda3\envs\ras-py38\lib\site-packages\pydantic\fields.py:798: PydanticDeprecatedSince20: Using extra keyword arguments on Field is deprecated and will be removed. Use json_schema_extra instead. (Extra keys: 'example'). Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.4/migration/

joanise commented 6 months ago

For the deprecation warning, it appears to be as simple as having to always use examples=[ ... ] instead of using example=... when there is only one example.