Skip to content

Python: Keep runtime typing#4966

Closed
Fokko wants to merge 1 commit intoapache:masterfrom
Fokko:fd-keep-runtime-typing
Closed

Python: Keep runtime typing#4966
Fokko wants to merge 1 commit intoapache:masterfrom
Fokko:fd-keep-runtime-typing

Conversation

@Fokko
Copy link
Contributor

@Fokko Fokko commented Jun 6, 2022

Pyupgrade would update Dict[str, Any] to dict[str, Any] which
isn't allowed in Python 3.8, breaking the tests with an obscure error:

ImportError while loading conftest '/Users/fokkodriesprong/Desktop/iceberg/python/tests/conftest.py'.
../conftest.py:34: in <module>
    from iceberg import schema
../../src/iceberg/schema.py:47: in <module>
    class Schema(IcebergBaseModel):
pydantic/main.py:188: in pydantic.main.ModelMetaclass.__new__
    ???
pydantic/typing.py:419: in pydantic.typing.resolve_annotations
    ???
/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/typing.py:270: in _eval_type
    return t._evaluate(globalns, localns)
/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/typing.py:518: in _evaluate
    eval(self.__forward_code__, globalns, localns),
E   TypeError: 'type' object is not subscriptable

Therefore we should disable them (until we go to Python 3.9 :)

Pyupgrade would update `Dict[str, Any]` to `dict[str, Any]` which
isn't allowed in Python 3.8, breaking the tests with an obscure error:

```
ImportError while loading conftest '/Users/fokkodriesprong/Desktop/iceberg/python/tests/conftest.py'.
../conftest.py:34: in <module>
    from iceberg import schema
../../src/iceberg/schema.py:47: in <module>
    class Schema(IcebergBaseModel):
pydantic/main.py:188: in pydantic.main.ModelMetaclass.__new__
    ???
pydantic/typing.py:419: in pydantic.typing.resolve_annotations
    ???
/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/typing.py:270: in _eval_type
    return t._evaluate(globalns, localns)
/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/typing.py:518: in _evaluate
    eval(self.__forward_code__, globalns, localns),
E   TypeError: 'type' object is not subscriptable
```

Therefore we should disable them (until we go to Python 3.9 :)
@Fokko Fokko closed this Jun 6, 2022
@Fokko
Copy link
Contributor Author

Fokko commented Jun 6, 2022

It seems to be something specific to my branch

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 this pull request may close these issues.

1 participant

Comments