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

[Feature Request]: Support Type Inference on Python 3.12 #31047

Closed
1 of 16 tasks
tvalentyn opened this issue Apr 18, 2024 · 2 comments · Fixed by #31170 or #31246
Closed
1 of 16 tasks

[Feature Request]: Support Type Inference on Python 3.12 #31047

tvalentyn opened this issue Apr 18, 2024 · 2 comments · Fixed by #31170 or #31246

Comments

@tvalentyn
Copy link
Contributor

tvalentyn commented Apr 18, 2024

What would you like to happen?

Part of #29149

Beam type inference tests currently fail under Python 3.12:

Repro:

  1. Clone: Add Python 3.12 support #30828
  2. Install Beam + test dependencies
  3. Run: pytest apache_beam/typehints/

Several tests fail:

FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testAlwaysReturnsEarly - AssertionError: <class 'int'> != Any
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testBuildTupleUnpack - AssertionError: Tuple[Union[<class 'int'>, <class 'str'>], ...] != Any
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testBuildTupleUnpackWithCall - AssertionError: Tuple[Union[<class 'float'>, <class 'int'[67 chars]r'>]] != Any
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testCallFunctionOnAny - IndexError: tuple index out of range
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testCallNestedLambda - AssertionError: Tuple[63 chars]ferenceTest.testCallNestedLambda.<locals>.Foo'>, <class 'int'>] != Tuple[63 chars]ferenceTest.testCallNe...
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testCallNullaryMethod - IndexError: tuple index out of range
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testDepthMethod - IndexError: tuple index out of range
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testDictComprehension - AssertionError: Dict[Any, Any] != Any
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testDictComprehensionSimple - AssertionError: Dict[<class 'str'>, <class 'int'>] != Any
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testGenerator - AssertionError: Iterable[<class 'int'>] != Any
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testGeneratorComprehension - AssertionError
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testGetAttr - IndexError: tuple index out of range
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testGetItemSlice - AssertionError: List[<class 'str'>] != Any
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testJumpOffsets - AssertionError: List[<class 'int'>] != Any
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testListComprehension - AssertionError: List[<class 'int'>] != Any
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testMethod - IndexError: tuple index out of range
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testNoneReturn - IndexError: tuple index out of range
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testRow - IndexError: tuple index out of range
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testSet - AssertionError: Set[Union[]] != Any
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testSetAttr - IndexError: tuple index out of range
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testSetDeleteGlobal - IndexError: tuple index out of range
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testTupleListComprehension - AssertionError: List[<class 'int'>] != Any

Issue Priority

Priority: 2 (default / most feature requests should be filed as P2)

Issue Components

  • Component: Python SDK
  • Component: Java SDK
  • Component: Go SDK
  • Component: Typescript SDK
  • Component: IO connector
  • Component: Beam YAML
  • Component: Beam examples
  • Component: Beam playground
  • Component: Beam katas
  • Component: Website
  • Component: Spark Runner
  • Component: Flink Runner
  • Component: Samza Runner
  • Component: Twister2 Runner
  • Component: Hazelcast Jet Runner
  • Component: Google Cloud Dataflow Runner
@tvalentyn
Copy link
Contributor Author

cc: @jrmccluskey

@tvalentyn
Copy link
Contributor Author

A few tests are still failing: https://github.com/apache/beam/actions/runs/9010406521/job/24756550768?pr=31223

FAILED apache_beam/typehints/intrinsic_one_ops_test.py::IntrinsicOneOpsTest::test_unary_intrinsic_ops_are_in_the_same_order_as_in_cpython
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testDictComprehension
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testDictComprehensionSimple
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testListComprehension
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testSet
FAILED apache_beam/typehints/trivial_inference_test.py::TrivialInferenceTest::testTupleListComprehension
FAILED apache_beam/transforms/batch_dofn_test.py::BatchDoFnParameterizedTest_NoReturnAnnotation::test_get_output_batch_type
=== 33 failed, 5776 passed, 1563 skipped, 2896 warnings in 719.14s (0:11:59) ===

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant