Skip to content

Update pyproject.toml to use Python >= 3.12 #87

@prasannals

Description

@prasannals

When I use Python 3.11 and run the pytest, I get the error pydantic.errors.PydanticUserError: Please use typing_extensions.TypedDictinstead oftyping.TypedDict on Python < 3.12. The issue is resolved if I use Python 3.12.0.

Full stack trace:

../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/pydantic/type_adapter.py:270: in _init_core_attrs
    self.core_schema = _getattr_no_parents(self._type, '__pydantic_core_schema__')
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/pydantic/type_adapter.py:55: in _getattr_no_parents
    raise AttributeError(attribute)
E   AttributeError: __pydantic_core_schema__

During handling of the above exception, another exception occurred:
src/text-summary/tests/test_main_text_summary.py:2: in <module>
    from rb.lib.common_tests import RBAppTest
src/rb-lib/rb/lib/common_tests.py:8: in <module>
    from rb.api.main import app as api_app
src/rb-api/rb/api/main.py:7: in <module>
    from rb.api import routes
src/rb-api/rb/api/routes/__init__.py:1: in <module>
    from .cli import cli_to_api_router
src/rb-api/rb/api/routes/cli.py:207: in <module>
    router.add_api_route(command.name, **params)
../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/fastapi/routing.py:933: in add_api_route
    route = route_class(
../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/fastapi/routing.py:554: in __init__
    self.dependant = get_dependant(path=self.path_format, call=self.endpoint)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/fastapi/dependencies/utils.py:285: in get_dependant
    param_details = analyze_param(
../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/fastapi/dependencies/utils.py:488: in analyze_param
    field = create_model_field(
../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/fastapi/utils.py:96: in create_model_field
    return ModelField(**kwargs)  # type: ignore[arg-type]
           ^^^^^^^^^^^^^^^^^^^^
<string>:6: in __init__
    ???
../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/fastapi/_compat.py:112: in __post_init__
    self._type_adapter: TypeAdapter[Any] = TypeAdapter(
../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/pydantic/type_adapter.py:227: in __init__
    self._init_core_attrs(
../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/pydantic/type_adapter.py:289: in _init_core_attrs
    core_schema = schema_generator.generate_schema(self._type)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:711: in generate_schema
    schema = self._generate_schema_inner(obj)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:988: in _generate_schema_inner
    return self._annotated_schema(obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:2251: in _annotated_schema
    schema = self._apply_annotations(source_type, annotations)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:2297: in _apply_annotations
    schema = get_inner_schema(source_type)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/pydantic/_internal/_schema_generation_shared.py:83: in __call__
    schema = self._handler(source_type)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:2373: in new_handler
    schema = get_inner_schema(source)
             ^^^^^^^^^^^^^^^^^^^^^^^^
../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/pydantic/_internal/_schema_generation_shared.py:83: in __call__
    schema = self._handler(source_type)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:2373: in new_handler
    schema = get_inner_schema(source)
             ^^^^^^^^^^^^^^^^^^^^^^^^
../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/pydantic/_internal/_schema_generation_shared.py:83: in __call__
    schema = self._handler(source_type)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:2279: in inner_handler
    schema = self._generate_schema_inner(obj)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:1009: in _generate_schema_inner
    return self.match_type(obj)
           ^^^^^^^^^^^^^^^^^^^^
../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:1091: in match_type
    return self._typed_dict_schema(obj, None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../.cache/pypoetry/virtualenvs/rescuebox-mZWJMwyh-py3.11/lib/python3.11/site-packages/pydantic/_internal/_generate_schema.py:1511: in _typed_dict_schema
    raise PydanticUserError(
E   pydantic.errors.PydanticUserError: Please use `typing_extensions.TypedDict` instead of `typing.TypedDict` on Python < 3.12.
E   
E   For further information visit https://errors.pydantic.dev/2.11/u/typed-dict-version

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions