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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pydantic 2.4.2 dependencies throw deprecation warnings #99

Closed
1 task done
AlexanderPodorov opened this issue Oct 4, 2023 · 11 comments
Closed
1 task done

Pydantic 2.4.2 dependencies throw deprecation warnings #99

AlexanderPodorov opened this issue Oct 4, 2023 · 11 comments
Assignees

Comments

@AlexanderPodorov
Copy link

Initial Checks

  • I confirm that I'm using Pydantic V2

Description

The list may not be complete, but I have found following warnings within pydantic_extra_types and pydantic_core:

.venv/lib/python3.11/site-packages/pydantic_extra_types/color.py:240: 11 warnings
  /.venv/lib/python3.11/site-packages/pydantic_extra_types/color.py:240: DeprecationWarning: `general_plain_validator_function` is deprecated, use `with_info_plain_validator_function` instead.
    return core_schema.general_plain_validator_function(

.venv/lib/python3.11/site-packages/pydantic_core/core_schema.py:3898: 11 warnings
  /.venv/lib/python3.11/site-packages/pydantic_core/core_schema.py:3898: DeprecationWarning: `general_plain_validator_function` is deprecated, use `with_info_plain_validator_function` instead.
    warnings.warn(

.venv/lib/python3.11/site-packages/pydantic_extra_types/payment.py:66
  /.venv/lib/python3.11/site-packages/pydantic_extra_types/payment.py:66: DeprecationWarning: `general_after_validator_function` is deprecated, use `with_info_after_validator_function` instead.
    return core_schema.general_after_validator_function(

.venv/lib/python3.11/site-packages/pydantic_core/core_schema.py:3860
  /.venv/lib/python3.11/site-packages/pydantic_core/core_schema.py:3860: DeprecationWarning: `with_info_after_validator_function` is deprecated, use `with_info_after_validator_function` instead.
    warnings.warn(

Example Code

No response

Python, Pydantic & OS Version

pydantic version: 2.4.2
        pydantic-core version: 2.10.1
          pydantic-core build: profile=release pgo=false
                 install path: /.venv/lib/python3.11/site-packages/pydantic
               python version: 3.11.5 (v3.11.5:cce6ba91b3, Aug 24 2023, 10:50:31) [Clang 13.0.0 (clang-1300.0.29.30)]
                     platform: macOS-13.0.1-arm64-arm-64bit
             related packages: email-validator-2.0.0.post2 pydantic-extra-types-2.1.0 typing_extensions-4.8.0 pydantic-settings-2.0.3 fastapi-0.103.2
@Kludex Kludex transferred this issue from pydantic/pydantic Oct 4, 2023
@Kludex
Copy link
Member

Kludex commented Oct 4, 2023

We need to fix them here.

@AlexanderPodorov
Copy link
Author

Makes sense, thank you! Should I close this issue and create issues for pydantic_core and pydantic_extra_types?

@Kludex
Copy link
Member

Kludex commented Oct 4, 2023

I've already transferred to pydantic-extra-types (we are on this repository now :)).

No need to create an issue on pydantic-core.

@kloczek
Copy link

kloczek commented Oct 17, 2023

I see those deprecation warnings as errors

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-pydantic-extra-types-2.1.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pydantic-extra-types-2.1.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
============================= test session starts ==============================
platform linux -- Python 3.8.18, pytest-7.4.2, pluggy-1.3.0
rootdir: /home/tkloczko/rpmbuild/BUILD/pydantic-extra-types-2.1.0
configfile: pyproject.toml
collected 799 items / 3 errors

==================================== ERRORS ====================================
__________________ ERROR collecting tests/test_mac_address.py __________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/python.py:536: in collect
    self._inject_setup_module_fixture()
/usr/lib/python3.8/site-packages/_pytest/python.py:550: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/lib/python3.8/site-packages/_pytest/python.py:315: in obj
    self._obj = obj = self._getobj()
/usr/lib/python3.8/site-packages/_pytest/python.py:533: in _getobj
    return self._importtestmodule()
/usr/lib/python3.8/site-packages/_pytest/python.py:622: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:567: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
/usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_mac_address.py:9: in <module>
    class Network(BaseModel):
/usr/lib/python3.8/site-packages/pydantic/_internal/_model_construction.py:184: in __new__
    complete_model_class(
/usr/lib/python3.8/site-packages/pydantic/_internal/_model_construction.py:481: in complete_model_class
    schema = cls.__get_pydantic_core_schema__(cls, handler)
/usr/lib/python3.8/site-packages/pydantic/main.py:576: in __get_pydantic_core_schema__
    return __handler(__source)
/usr/lib/python3.8/site-packages/pydantic/_internal/_schema_generation_shared.py:82: in __call__
    schema = self._handler(__source_type)
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:452: in generate_schema
    schema = self._generate_schema(obj)
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:684: in _generate_schema
    schema = self._post_process_generated_schema(self._generate_schema_inner(obj))
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:706: in _generate_schema_inner
    return self._model_schema(obj)
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:525: in _model_schema
    {k: self._generate_md_field_schema(k, v, decorators) for k, v in fields.items()},
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:525: in <dictcomp>
    {k: self._generate_md_field_schema(k, v, decorators) for k, v in fields.items()},
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:870: in _generate_md_field_schema
    common_field = self._common_field_schema(name, field_info, decorators)
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:923: in _common_field_schema
    schema = self._apply_annotations(
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:1592: in _apply_annotations
    schema = get_inner_schema(source_type)
/usr/lib/python3.8/site-packages/pydantic/_internal/_schema_generation_shared.py:82: in __call__
    schema = self._handler(__source_type)
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:1571: in inner_handler
    from_property = self._generate_schema_from_property(obj, obj)
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:600: in _generate_schema_from_property
    schema = get_schema(
pydantic_extra_types/mac_address.py:27: in __get_pydantic_core_schema__
    return core_schema.general_before_validator_function(
/usr/lib/python3.8/site-packages/typing_extensions.py:2359: in wrapper
    warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
E   DeprecationWarning: `general_before_validator_function` is deprecated, use `with_info_before_validator_function` instead.
_________________ ERROR collecting tests/test_phone_numbers.py _________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/python.py:536: in collect
    self._inject_setup_module_fixture()
/usr/lib/python3.8/site-packages/_pytest/python.py:550: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/lib/python3.8/site-packages/_pytest/python.py:315: in obj
    self._obj = obj = self._getobj()
/usr/lib/python3.8/site-packages/_pytest/python.py:533: in _getobj
    return self._importtestmodule()
/usr/lib/python3.8/site-packages/_pytest/python.py:622: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:567: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
/usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_phone_numbers.py:9: in <module>
    class Something(BaseModel):
/usr/lib/python3.8/site-packages/pydantic/_internal/_model_construction.py:184: in __new__
    complete_model_class(
/usr/lib/python3.8/site-packages/pydantic/_internal/_model_construction.py:481: in complete_model_class
    schema = cls.__get_pydantic_core_schema__(cls, handler)
/usr/lib/python3.8/site-packages/pydantic/main.py:576: in __get_pydantic_core_schema__
    return __handler(__source)
/usr/lib/python3.8/site-packages/pydantic/_internal/_schema_generation_shared.py:82: in __call__
    schema = self._handler(__source_type)
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:452: in generate_schema
    schema = self._generate_schema(obj)
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:684: in _generate_schema
    schema = self._post_process_generated_schema(self._generate_schema_inner(obj))
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:706: in _generate_schema_inner
    return self._model_schema(obj)
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:525: in _model_schema
    {k: self._generate_md_field_schema(k, v, decorators) for k, v in fields.items()},
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:525: in <dictcomp>
    {k: self._generate_md_field_schema(k, v, decorators) for k, v in fields.items()},
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:870: in _generate_md_field_schema
    common_field = self._common_field_schema(name, field_info, decorators)
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:923: in _common_field_schema
    schema = self._apply_annotations(
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:1592: in _apply_annotations
    schema = get_inner_schema(source_type)
/usr/lib/python3.8/site-packages/pydantic/_internal/_schema_generation_shared.py:82: in __call__
    schema = self._handler(__source_type)
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:1571: in inner_handler
    from_property = self._generate_schema_from_property(obj, obj)
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:600: in _generate_schema_from_property
    schema = get_schema(
pydantic_extra_types/phone_numbers.py:33: in __get_pydantic_core_schema__
    return core_schema.general_after_validator_function(
/usr/lib/python3.8/site-packages/typing_extensions.py:2359: in wrapper
    warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
E   DeprecationWarning: `general_after_validator_function` is deprecated, use `with_info_after_validator_function` instead.
________________ ERROR collecting tests/test_routing_number.py _________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/python.py:536: in collect
    self._inject_setup_module_fixture()
/usr/lib/python3.8/site-packages/_pytest/python.py:550: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/lib/python3.8/site-packages/_pytest/python.py:315: in obj
    self._obj = obj = self._getobj()
/usr/lib/python3.8/site-packages/_pytest/python.py:533: in _getobj
    return self._importtestmodule()
/usr/lib/python3.8/site-packages/_pytest/python.py:622: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:567: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
/usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_routing_number.py:9: in <module>
    class Model(BaseModel):
/usr/lib/python3.8/site-packages/pydantic/_internal/_model_construction.py:184: in __new__
    complete_model_class(
/usr/lib/python3.8/site-packages/pydantic/_internal/_model_construction.py:481: in complete_model_class
    schema = cls.__get_pydantic_core_schema__(cls, handler)
/usr/lib/python3.8/site-packages/pydantic/main.py:576: in __get_pydantic_core_schema__
    return __handler(__source)
/usr/lib/python3.8/site-packages/pydantic/_internal/_schema_generation_shared.py:82: in __call__
    schema = self._handler(__source_type)
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:452: in generate_schema
    schema = self._generate_schema(obj)
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:684: in _generate_schema
    schema = self._post_process_generated_schema(self._generate_schema_inner(obj))
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:706: in _generate_schema_inner
    return self._model_schema(obj)
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:525: in _model_schema
    {k: self._generate_md_field_schema(k, v, decorators) for k, v in fields.items()},
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:525: in <dictcomp>
    {k: self._generate_md_field_schema(k, v, decorators) for k, v in fields.items()},
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:870: in _generate_md_field_schema
    common_field = self._common_field_schema(name, field_info, decorators)
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:923: in _common_field_schema
    schema = self._apply_annotations(
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:1592: in _apply_annotations
    schema = get_inner_schema(source_type)
/usr/lib/python3.8/site-packages/pydantic/_internal/_schema_generation_shared.py:82: in __call__
    schema = self._handler(__source_type)
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:1571: in inner_handler
    from_property = self._generate_schema_from_property(obj, obj)
/usr/lib/python3.8/site-packages/pydantic/_internal/_generate_schema.py:600: in _generate_schema_from_property
    schema = get_schema(
pydantic_extra_types/routing_number.py:20: in __get_pydantic_core_schema__
    return core_schema.general_after_validator_function(
/usr/lib/python3.8/site-packages/typing_extensions.py:2359: in wrapper
    warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
E   DeprecationWarning: `general_after_validator_function` is deprecated, use `with_info_after_validator_function` instead.
=========================== short test summary info ============================
ERROR tests/test_mac_address.py - DeprecationWarning: `general_before_validat...
ERROR tests/test_phone_numbers.py - DeprecationWarning: `general_after_valida...
ERROR tests/test_routing_number.py - DeprecationWarning: `general_after_valid...
!!!!!!!!!!!!!!!!!!! Interrupted: 3 errors during collection !!!!!!!!!!!!!!!!!!!!
============================== 3 errors in 1.67s ===============================

@yezz123 yezz123 self-assigned this Oct 22, 2023
@yezz123 yezz123 linked a pull request Oct 22, 2023 that will close this issue
@AlexanderPodorov
Copy link
Author

When #101 is going to be merged? Can we expect this by the next release? Thank you!

@AlexanderPodorov
Copy link
Author

Hello @Kludex , @yezz123 , sorry for the reminder!!!
It's been a few pydantic releases and this library is still using outdated pydantic version. This prevents certain people from upgrading to the newer pydantic versions. Any chance to get #101 merged? Sorry again, thank you!

@AlexanderPodorov
Copy link
Author

Hello everybody,
Is there any chance to get #101 merged? Thanks!

@yezz123
Copy link
Collaborator

yezz123 commented Dec 14, 2023

Fixed 0ce9f20

@yezz123 yezz123 closed this as completed Dec 14, 2023
@mgineer85
Copy link

It's fixed but not released.
Would be great if there is another release containing the fix: #113

Thx!

@mgineer85
Copy link

@Kludex Thx a lot for the new release!

@Kludex
Copy link
Member

Kludex commented Dec 30, 2023

You are welcome. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants