Skip to content

Error with new Pydantic #12

@joshting

Description

@joshting

Hi, I am getting the following error which seems to be related to new version of Pydantic that is used in new version of spaCy. Please update.

224 warn( 225 'Pydantic V1 style @root_validatorvalidators are deprecated.' 226 ' You should migrate to Pydantic V2 style@model_validator` validators,'
(...) 229 stacklevel=2,
230 )
232 if __args:
233 # Ensure a nice error is raised if someone attempts to use the bare decorator
--> 234 return root_validator()(*__args) # type: ignore
236 if allow_reuse is True: # pragma: no cover
237 warn(_ALLOW_REUSE_WARNING_MESSAGE, DeprecationWarning, stacklevel=2)

root_validator(pre, skip_on_failure, allow_reuse, *__args)
238 mode: Literal['before', 'after'] = 'before' if pre is True else 'after'
239 if pre is False and skip_on_failure is not True:
--> 240 raise PydanticUserError(
241 'If you use @root_validator with pre=False (the default) you MUST specify skip_on_failure=True.'
242 ' Note that @root_validator is deprecated and should be replaced with @model_validator.',
243 code='root-validator-pre-skip',
244 )
246 wrap = partial(_decorators_v1.make_v1_generic_root_validator, pre=pre)
248 def dec(f: Callable[..., Any] | classmethod[Any, Any, Any] | staticmethod[Any, Any]) -> Any:

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.`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions