<#3181 [Core] Python 3.11 and nested `@dataclass` ...
# flyte-github
a
#3181 [Core] Python 3.11 and nested `@dataclass` in configuration Issue created by hawkaa Hi, I'm trying out Flyte for the first time, and I am doing so with Python 3.11. I think something has to change in the
@dataclass
definitions in order to work with the new mutability check. I'm getting the following error:
Copy code
Traceback (most recent call last):
  File "/Users/hakon/Library/Caches/pypoetry/virtualenvs/015-flyte-python-prototype-EMcIQ-cS-py3.11/bin/pyflyte", line 5, in <module>
    from flytekit.clis.sdk_in_container.pyflyte import main
  File "/Users/hakon/Library/Caches/pypoetry/virtualenvs/015-flyte-python-prototype-EMcIQ-cS-py3.11/lib/python3.11/site-packages/flytekit/__init__.py", line 166, in <module>
    from flytekit.core.base_sql_task import SQLTask
  File "/Users/hakon/Library/Caches/pypoetry/virtualenvs/015-flyte-python-prototype-EMcIQ-cS-py3.11/lib/python3.11/site-packages/flytekit/core/base_sql_task.py", line 4, in <module>
    from flytekit.core.base_task import PythonTask, TaskMetadata
  File "/Users/hakon/Library/Caches/pypoetry/virtualenvs/015-flyte-python-prototype-EMcIQ-cS-py3.11/lib/python3.11/site-packages/flytekit/core/base_task.py", line 26, in <module>
    from flytekit.configuration import SerializationSettings
  File "/Users/hakon/Library/Caches/pypoetry/virtualenvs/015-flyte-python-prototype-EMcIQ-cS-py3.11/lib/python3.11/site-packages/flytekit/configuration/__init__.py", line 472, in <module>
    @dataclass(init=True, repr=True, eq=True, frozen=True)
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 1210, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 958, in _process_class
    cls_fields.append(_get_field(cls, name, type, kw_only))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/dataclasses.py", line 815, in _get_field
    raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'flytekit.configuration.S3Config'> for field s3 is not allowed: use default_factory
Should be fairly straight forward to use
default_factory
for these cases. Downgrading to 3.10 works. flyteorg/flyte