UMass-Rescue / UMass-Rescue/RescueBox

Update pyproject.toml to use Python >= 3.12

Open Beginner friendly
#87 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
6
Forks
15
Avg merge
14h 42m
Merged PRs (30d)
7

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pyproject.toml and inspect the declared Python version requirement. Reproduce the failure by running pytest with Python 3.11, then update the requirement to Python >= 3.12 and confirm the tests run successfully under Python 3.12.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
85/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.