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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

PydanticUserError when using pyodide build with pydantic>=2 #3978

Closed
lesteve opened this issue Jul 5, 2023 · 4 comments
Closed

PydanticUserError when using pyodide build with pydantic>=2 #3978

lesteve opened this issue Jul 5, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@lesteve
Copy link
Contributor

lesteve commented Jul 5, 2023

馃悰 Bug

Pydantic 2 release (2.0 release is quite recent: June 30 2023) seems to break pyodide build. Maybe something to consider for 0.23.4 if it's an easy fix?

To Reproduce

pip install pyodide-build
pyodide build

You get this error:

pydantic.errors.PydanticUserError: If you use `@root_validator` with pre=False (the default) you MUST specify `skip_on_failure=True`. Note that `@root_validator` is deprecated and should be replaced with `@model_validator`.
Full-traceback
Traceback (most recent call last):
  File "/home/lesteve/micromamba/envs/pyodide/bin/pyodide", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/lesteve/micromamba/envs/pyodide/lib/python3.11/site-packages/pyodide_cli/app.py", line 84, in main
    register_plugins()
  File "/home/lesteve/micromamba/envs/pyodide/lib/python3.11/site-packages/pyodide_cli/app.py", line 54, in register_plugins
    plugins = {ep.name: (ep.load(), ep) for ep in eps}
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lesteve/micromamba/envs/pyodide/lib/python3.11/site-packages/pyodide_cli/app.py", line 54, in <dictcomp>
    plugins = {ep.name: (ep.load(), ep) for ep in eps}
                         ^^^^^^^^^
  File "/home/lesteve/micromamba/envs/pyodide/lib/python3.11/importlib/metadata/__init__.py", line 202, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lesteve/micromamba/envs/pyodide/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/lesteve/micromamba/envs/pyodide/lib/python3.11/site-packages/pyodide_build/cli/build.py", line 12, in <module>
    from .. import common
  File "/home/lesteve/micromamba/envs/pyodide/lib/python3.11/site-packages/pyodide_build/common.py", line 27, in <module>
    from .recipe import load_all_recipes
  File "/home/lesteve/micromamba/envs/pyodide/lib/python3.11/site-packages/pyodide_build/recipe.py", line 5, in <module>
    from .io import MetaConfig
  File "/home/lesteve/micromamba/envs/pyodide/lib/python3.11/site-packages/pyodide_build/io.py", line 19, in <module>
    class _SourceSpec(BaseModel):
  File "/home/lesteve/micromamba/envs/pyodide/lib/python3.11/site-packages/pyodide_build/io.py", line 30, in _SourceSpec
    @pydantic.root_validator
     ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/lesteve/micromamba/envs/pyodide/lib/python3.11/site-packages/pydantic/deprecated/class_validators.py", line 222, in root_validator
    return root_validator()(*__args)  # type: ignore
           ^^^^^^^^^^^^^^^^
  File "/home/lesteve/micromamba/envs/pyodide/lib/python3.11/site-packages/pydantic/deprecated/class_validators.py", line 228, in root_validator
    raise PydanticUserError(
pydantic.errors.PydanticUserError: If you use `@root_validator` with pre=False (the default) you MUST specify `skip_on_failure=True`. Note that `@root_validator` is deprecated and should be replaced with `@model_validator`.

For further information visit https://errors.pydantic.dev/2.0.1/u/root-validator-pre-skip

Expected behavior

No error

@lesteve lesteve added the bug Something isn't working label Jul 5, 2023
@rth
Copy link
Member

rth commented Jul 5, 2023

Thanks I think this was fixed and scheduled for backporting in #3971

@rth rth closed this as completed Jul 5, 2023
@lesteve
Copy link
Contributor Author

lesteve commented Jul 5, 2023

Yeah I saw that just after opening this issue ... I swear I searched in the github issues before 馃槄

@rth
Copy link
Member

rth commented Jul 5, 2023

Looks like there were no issues, just a PR..

@hoodmane
Copy link
Member

hoodmane commented Jul 5, 2023

Thanks @lesteve!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants