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

union operand not supported by python 3.9 #33

Open
eevmanu opened this issue Jan 19, 2024 · 0 comments
Open

union operand not supported by python 3.9 #33

eevmanu opened this issue Jan 19, 2024 · 0 comments

Comments

@eevmanu
Copy link

eevmanu commented Jan 19, 2024

Describe the bug
The python version used in pyproject.toml

doesn't support union type expression with | operand like here

since this is supported since python 3.10

To Reproduce
Steps to reproduce the behavior:

  1. create a new venv
  2. install convoviz
  3. run convoviz
  4. see error
Traceback (most recent call last):
  File "$HOME/.pyenv/versions/3.9.18/lib/python3.9/runpy.py", line 188, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "$HOME/.pyenv/versions/3.9.18/lib/python3.9/runpy.py", line 147, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "$HOME/.pyenv/versions/3.9.18/lib/python3.9/runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "$VENV/lib/python3.9/site-packages/convoviz/__init__.py", line 3, in <module>
    from . import configuration, data_analysis, long_runs, models, utils
  File "$VENV/lib/python3.9/site-packages/convoviz/configuration.py", line 18, in <module>
    from .models import Conversation, Message
  File "$VENV/lib/python3.9/site-packages/convoviz/models/__init__.py", line 3, in <module>
    from ._conversation import Conversation
  File "$VENV/lib/python3.9/site-packages/convoviz/models/_conversation.py", line 26, in <module>
    from ._node import Node
  File "$VENV/lib/python3.9/site-packages/convoviz/models/_node.py", line 15, in <module>
    from ._message import Message  # noqa: TCH001
  File "$VENV/lib/python3.9/site-packages/convoviz/models/_message.py", line 20, in <module>
    class MessageAuthor(BaseModel):
  File "$VENV/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py", line 181, in __new__
    set_model_fields(cls, bases, config_wrapper, types_namespace)
  File "$VENV/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py", line 426, in set_model_fields
    fields, class_vars = collect_model_fields(cls, bases, config_wrapper, types_namespace, typevars_map=typevars_map)
  File "$VENV/lib/python3.9/site-packages/pydantic/_internal/_fields.py", line 120, in collect_model_fields
    type_hints = get_cls_type_hints_lenient(cls, types_namespace)
  File "$VENV/lib/python3.9/site-packages/pydantic/_internal/_typing_extra.py", line 212, in get_cls_type_hints_lenient
    hints[name] = eval_type_lenient(value, globalns, localns)
  File "$VENV/lib/python3.9/site-packages/pydantic/_internal/_typing_extra.py", line 224, in eval_type_lenient
    return typing._eval_type(value, globalns, localns)  # type: ignore
  File "$HOME/.pyenv/versions/3.9.18/lib/python3.9/typing.py", line 292, in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
  File "$HOME/.pyenv/versions/3.9.18/lib/python3.9/typing.py", line 554, in _evaluate
    eval(self.__forward_code__, globalns, localns),
  File "<string>", line 1, in <module>
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

Expected behavior
upgrade python version on pyproject.toml or change code to be flexible with 3.9

OS

  • OS: Linux, debian-based, popOS
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

No branches or pull requests

1 participant