redis-om-python icon indicating copy to clipboard operation
redis-om-python copied to clipboard

Pydantic 2.1.1

Open anton-petrov opened this issue 2 years ago • 5 comments

Need support for newest pydantic 2.1.1, just released 2023-07-25

redis-om (0.2.1) depends on pydantic (>=1.10.2,<2.1.0)

anton-petrov avatar Jul 27 '23 17:07 anton-petrov

+1 Likewise, support for pydantic 2.1.x or higher is required but is blocked by redis-om (0.2.1).

hudrazine avatar Jul 30 '23 12:07 hudrazine

Everyone who doesn't want to wait can use my repository https://github.com/anton-petrov/redis-om-python and install package directly from github. I have already tested redis-om with pydantic 2.1.1 on a production project.

For example, for poetry project, add this line to pyproject.toml:

redis-om = {git = "https://github.com/anton-petrov/redis-om-python.git"}

anton-petrov avatar Jul 30 '23 13:07 anton-petrov

Hii Guys can u help me My code https://github.com/PARKER-X/Microservices-Fastapi @app.get('/products') def all(): return Product.all_pks() my code is not working give fastapi response model error!

PARKER-X avatar Aug 13 '23 05:08 PARKER-X

Error:===

raise fastapi.exceptions.FastAPIError(

fastapi.exceptions.FastAPIError: Invalid args for response field! Hint: check that <class 'inventory.schema.Product'> is a valid Pydantic field type. If you are using a return type annotation that is not a valid Pydantic field (e.g. Union[Response, dict, None]) you can disable generating the response model from the type annotation with the path operation decorator parameter response_model=None. Read more: https://fastapi.tiangolo.com/tutorial/response-model/

PARKER-X avatar Aug 13 '23 05:08 PARKER-X

Overriding the dependency check worked for me:

pip install pydantic==2.5 --force-reinstall

The command triggered a dependency error, yet it successfully installed pydantic 2.5 alongside redis-om 0.2.1.

I use Conda/Mamba as my virtual environment manager. I believe it's worth trying this approach even if you don't use Conda/Mamba.

Note that it's not possible to force a version via Conda's environment.yml. However, if you're using Docker (e.g., in devcontainers), you can include the pip install ... command in the Dockerfile file after creating the Conda environment. That will install the latest versions of pydantic and redis-om.

loureirorg avatar Dec 23 '23 03:12 loureirorg