[jira] [Work logged] (BEAM-8487) Python typehints: support forward references
[ https://issues.apache.org/jira/browse/BEAM-8487?focusedWorklogId=395321=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-395321 ] ASF GitHub Bot logged work on BEAM-8487: Author: ASF GitHub Bot Created on: 28/Feb/20 22:46 Start Date: 28/Feb/20 22:46 Worklog Time Spent: 10m Work Description: udim commented on pull request #10932: [BEAM-8487] Handle nested forward references URL: https://github.com/apache/beam/pull/10932 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 395321) Time Spent: 2h 10m (was: 2h) > Python typehints: support forward references > > > Key: BEAM-8487 > URL: https://issues.apache.org/jira/browse/BEAM-8487 > Project: Beam > Issue Type: Bug > Components: sdk-py-core >Reporter: Udi Meiri >Assignee: Udi Meiri >Priority: Major > Time Spent: 2h 10m > Remaining Estimate: 0h > > Typehints may be given as string literals: > https://www.python.org/dev/peps/pep-0484/#forward-references > These are currently not evaluated and result in errors. > Example 1: > {code} > def test_typed_callable_string_hints(self): > def do_fn(element: 'int') -> 'typehints.List[str]': > return [[str(element)] * 2] > result = [1, 2] | beam.ParDo(do_fn) > self.assertEqual([['1', '1'], ['2', '2']], sorted(result)) > {code} > This results in: > {code} > > return issubclass(sub, base) > E TypeError: issubclass() arg 2 must be a class or tuple of classes > typehints.py:1168: TypeError > {code} > Example 2: > {code} > def test_typed_dofn_string_hints(self): > class MyDoFn(beam.DoFn): > def process(self, element: 'int') -> 'typehints.List[str]': > return [[str(element)] * 2] > result = [1, 2] | beam.ParDo(MyDoFn()) > self.assertEqual([['1', '1'], ['2', '2']], sorted(result)) > {code} > This results in: > {code} > > raise ValueError('%s is not iterable' % type_hint) > E ValueError: typehints.List[str] is not iterable > typehints.py:1194: ValueError > {code} > where the non-iterable entity the error refers to is a string literal > ("typehints.List[str]"). -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (BEAM-8487) Python typehints: support forward references
[ https://issues.apache.org/jira/browse/BEAM-8487?focusedWorklogId=395225=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-395225 ] ASF GitHub Bot logged work on BEAM-8487: Author: ASF GitHub Bot Created on: 28/Feb/20 19:37 Start Date: 28/Feb/20 19:37 Worklog Time Spent: 10m Work Description: udim commented on issue #10932: [BEAM-8487] Handle nested forward references URL: https://github.com/apache/beam/pull/10932#issuecomment-592692169 Run Python PreCommit This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 395225) Time Spent: 2h (was: 1h 50m) > Python typehints: support forward references > > > Key: BEAM-8487 > URL: https://issues.apache.org/jira/browse/BEAM-8487 > Project: Beam > Issue Type: Bug > Components: sdk-py-core >Reporter: Udi Meiri >Assignee: Udi Meiri >Priority: Major > Time Spent: 2h > Remaining Estimate: 0h > > Typehints may be given as string literals: > https://www.python.org/dev/peps/pep-0484/#forward-references > These are currently not evaluated and result in errors. > Example 1: > {code} > def test_typed_callable_string_hints(self): > def do_fn(element: 'int') -> 'typehints.List[str]': > return [[str(element)] * 2] > result = [1, 2] | beam.ParDo(do_fn) > self.assertEqual([['1', '1'], ['2', '2']], sorted(result)) > {code} > This results in: > {code} > > return issubclass(sub, base) > E TypeError: issubclass() arg 2 must be a class or tuple of classes > typehints.py:1168: TypeError > {code} > Example 2: > {code} > def test_typed_dofn_string_hints(self): > class MyDoFn(beam.DoFn): > def process(self, element: 'int') -> 'typehints.List[str]': > return [[str(element)] * 2] > result = [1, 2] | beam.ParDo(MyDoFn()) > self.assertEqual([['1', '1'], ['2', '2']], sorted(result)) > {code} > This results in: > {code} > > raise ValueError('%s is not iterable' % type_hint) > E ValueError: typehints.List[str] is not iterable > typehints.py:1194: ValueError > {code} > where the non-iterable entity the error refers to is a string literal > ("typehints.List[str]"). -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (BEAM-8487) Python typehints: support forward references
[ https://issues.apache.org/jira/browse/BEAM-8487?focusedWorklogId=393907=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-393907 ] ASF GitHub Bot logged work on BEAM-8487: Author: ASF GitHub Bot Created on: 27/Feb/20 02:04 Start Date: 27/Feb/20 02:04 Worklog Time Spent: 10m Work Description: tvalentyn commented on issue #10932: [BEAM-8487] Handle nested forward references URL: https://github.com/apache/beam/pull/10932#issuecomment-591739717 LGTM, thank you. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 393907) Time Spent: 1h 50m (was: 1h 40m) > Python typehints: support forward references > > > Key: BEAM-8487 > URL: https://issues.apache.org/jira/browse/BEAM-8487 > Project: Beam > Issue Type: Bug > Components: sdk-py-core >Reporter: Udi Meiri >Assignee: Udi Meiri >Priority: Major > Time Spent: 1h 50m > Remaining Estimate: 0h > > Typehints may be given as string literals: > https://www.python.org/dev/peps/pep-0484/#forward-references > These are currently not evaluated and result in errors. > Example 1: > {code} > def test_typed_callable_string_hints(self): > def do_fn(element: 'int') -> 'typehints.List[str]': > return [[str(element)] * 2] > result = [1, 2] | beam.ParDo(do_fn) > self.assertEqual([['1', '1'], ['2', '2']], sorted(result)) > {code} > This results in: > {code} > > return issubclass(sub, base) > E TypeError: issubclass() arg 2 must be a class or tuple of classes > typehints.py:1168: TypeError > {code} > Example 2: > {code} > def test_typed_dofn_string_hints(self): > class MyDoFn(beam.DoFn): > def process(self, element: 'int') -> 'typehints.List[str]': > return [[str(element)] * 2] > result = [1, 2] | beam.ParDo(MyDoFn()) > self.assertEqual([['1', '1'], ['2', '2']], sorted(result)) > {code} > This results in: > {code} > > raise ValueError('%s is not iterable' % type_hint) > E ValueError: typehints.List[str] is not iterable > typehints.py:1194: ValueError > {code} > where the non-iterable entity the error refers to is a string literal > ("typehints.List[str]"). -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (BEAM-8487) Python typehints: support forward references
[ https://issues.apache.org/jira/browse/BEAM-8487?focusedWorklogId=393905=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-393905 ] ASF GitHub Bot logged work on BEAM-8487: Author: ASF GitHub Bot Created on: 27/Feb/20 01:59 Start Date: 27/Feb/20 01:59 Worklog Time Spent: 10m Work Description: udim commented on pull request #10932: [BEAM-8487] Handle nested forward references URL: https://github.com/apache/beam/pull/10932#discussion_r384873795 ## File path: sdks/python/apache_beam/typehints/native_type_compatibility.py ## @@ -163,8 +163,14 @@ def is_any(typ): return typ is typing.Any +try: + _ForwardRef = typing.ForwardRef +except AttributeError: Review comment: done, also rebased This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 393905) Time Spent: 1h 40m (was: 1.5h) > Python typehints: support forward references > > > Key: BEAM-8487 > URL: https://issues.apache.org/jira/browse/BEAM-8487 > Project: Beam > Issue Type: Bug > Components: sdk-py-core >Reporter: Udi Meiri >Assignee: Udi Meiri >Priority: Major > Time Spent: 1h 40m > Remaining Estimate: 0h > > Typehints may be given as string literals: > https://www.python.org/dev/peps/pep-0484/#forward-references > These are currently not evaluated and result in errors. > Example 1: > {code} > def test_typed_callable_string_hints(self): > def do_fn(element: 'int') -> 'typehints.List[str]': > return [[str(element)] * 2] > result = [1, 2] | beam.ParDo(do_fn) > self.assertEqual([['1', '1'], ['2', '2']], sorted(result)) > {code} > This results in: > {code} > > return issubclass(sub, base) > E TypeError: issubclass() arg 2 must be a class or tuple of classes > typehints.py:1168: TypeError > {code} > Example 2: > {code} > def test_typed_dofn_string_hints(self): > class MyDoFn(beam.DoFn): > def process(self, element: 'int') -> 'typehints.List[str]': > return [[str(element)] * 2] > result = [1, 2] | beam.ParDo(MyDoFn()) > self.assertEqual([['1', '1'], ['2', '2']], sorted(result)) > {code} > This results in: > {code} > > raise ValueError('%s is not iterable' % type_hint) > E ValueError: typehints.List[str] is not iterable > typehints.py:1194: ValueError > {code} > where the non-iterable entity the error refers to is a string literal > ("typehints.List[str]"). -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (BEAM-8487) Python typehints: support forward references
[ https://issues.apache.org/jira/browse/BEAM-8487?focusedWorklogId=390977=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-390977 ] ASF GitHub Bot logged work on BEAM-8487: Author: ASF GitHub Bot Created on: 21/Feb/20 23:50 Start Date: 21/Feb/20 23:50 Worklog Time Spent: 10m Work Description: tvalentyn commented on pull request #10932: [BEAM-8487] Handle nested forward references URL: https://github.com/apache/beam/pull/10932#discussion_r382857475 ## File path: sdks/python/apache_beam/typehints/native_type_compatibility.py ## @@ -163,8 +163,14 @@ def is_any(typ): return typ is typing.Any +try: + _ForwardRef = typing.ForwardRef +except AttributeError: Review comment: Could you please add a comment which Python version requires the branching? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 390977) Time Spent: 1.5h (was: 1h 20m) > Python typehints: support forward references > > > Key: BEAM-8487 > URL: https://issues.apache.org/jira/browse/BEAM-8487 > Project: Beam > Issue Type: Bug > Components: sdk-py-core >Reporter: Udi Meiri >Assignee: Udi Meiri >Priority: Major > Time Spent: 1.5h > Remaining Estimate: 0h > > Typehints may be given as string literals: > https://www.python.org/dev/peps/pep-0484/#forward-references > These are currently not evaluated and result in errors. > Example 1: > {code} > def test_typed_callable_string_hints(self): > def do_fn(element: 'int') -> 'typehints.List[str]': > return [[str(element)] * 2] > result = [1, 2] | beam.ParDo(do_fn) > self.assertEqual([['1', '1'], ['2', '2']], sorted(result)) > {code} > This results in: > {code} > > return issubclass(sub, base) > E TypeError: issubclass() arg 2 must be a class or tuple of classes > typehints.py:1168: TypeError > {code} > Example 2: > {code} > def test_typed_dofn_string_hints(self): > class MyDoFn(beam.DoFn): > def process(self, element: 'int') -> 'typehints.List[str]': > return [[str(element)] * 2] > result = [1, 2] | beam.ParDo(MyDoFn()) > self.assertEqual([['1', '1'], ['2', '2']], sorted(result)) > {code} > This results in: > {code} > > raise ValueError('%s is not iterable' % type_hint) > E ValueError: typehints.List[str] is not iterable > typehints.py:1194: ValueError > {code} > where the non-iterable entity the error refers to is a string literal > ("typehints.List[str]"). -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (BEAM-8487) Python typehints: support forward references
[ https://issues.apache.org/jira/browse/BEAM-8487?focusedWorklogId=390943=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-390943 ] ASF GitHub Bot logged work on BEAM-8487: Author: ASF GitHub Bot Created on: 21/Feb/20 22:13 Start Date: 21/Feb/20 22:13 Worklog Time Spent: 10m Work Description: udim commented on issue #10932: [BEAM-8487] Handle nested forward references URL: https://github.com/apache/beam/pull/10932#issuecomment-589859233 R: @tvalentyn CC: @robertwb This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 390943) Time Spent: 1h 20m (was: 1h 10m) > Python typehints: support forward references > > > Key: BEAM-8487 > URL: https://issues.apache.org/jira/browse/BEAM-8487 > Project: Beam > Issue Type: Bug > Components: sdk-py-core >Reporter: Udi Meiri >Assignee: Udi Meiri >Priority: Major > Time Spent: 1h 20m > Remaining Estimate: 0h > > Typehints may be given as string literals: > https://www.python.org/dev/peps/pep-0484/#forward-references > These are currently not evaluated and result in errors. > Example 1: > {code} > def test_typed_callable_string_hints(self): > def do_fn(element: 'int') -> 'typehints.List[str]': > return [[str(element)] * 2] > result = [1, 2] | beam.ParDo(do_fn) > self.assertEqual([['1', '1'], ['2', '2']], sorted(result)) > {code} > This results in: > {code} > > return issubclass(sub, base) > E TypeError: issubclass() arg 2 must be a class or tuple of classes > typehints.py:1168: TypeError > {code} > Example 2: > {code} > def test_typed_dofn_string_hints(self): > class MyDoFn(beam.DoFn): > def process(self, element: 'int') -> 'typehints.List[str]': > return [[str(element)] * 2] > result = [1, 2] | beam.ParDo(MyDoFn()) > self.assertEqual([['1', '1'], ['2', '2']], sorted(result)) > {code} > This results in: > {code} > > raise ValueError('%s is not iterable' % type_hint) > E ValueError: typehints.List[str] is not iterable > typehints.py:1194: ValueError > {code} > where the non-iterable entity the error refers to is a string literal > ("typehints.List[str]"). -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (BEAM-8487) Python typehints: support forward references
[ https://issues.apache.org/jira/browse/BEAM-8487?focusedWorklogId=390942=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-390942 ] ASF GitHub Bot logged work on BEAM-8487: Author: ASF GitHub Bot Created on: 21/Feb/20 22:12 Start Date: 21/Feb/20 22:12 Worklog Time Spent: 10m Work Description: udim commented on pull request #10932: [BEAM-8487] Handle nested forward references URL: https://github.com/apache/beam/pull/10932 Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily: - [ ] [**Choose reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and mention them in a comment (`R: @username`). - [ ] Format the pull request title like `[BEAM-XXX] Fixes bug in ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue. - [ ] Update `CHANGES.md` with noteworthy changes. - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://beam.apache.org/contribute/#make-reviewers-job-easier). Post-Commit Tests Status (on master branch) Lang | SDK | Apex | Dataflow | Flink | Gearpump | Samza | Spark --- | --- | --- | --- | --- | --- | --- | --- Go | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/) | --- | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Go_VR_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go_VR_Flink/lastCompletedBuild/) | --- | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Go_VR_Spark/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go_VR_Spark/lastCompletedBuild/) Java | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/)[![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/)[![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark/lastCompletedBuild/)[![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Spark_Batch/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Spark_Batch/lastCompletedBuild/)[![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_SparkStructuredStreaming/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_SparkStructuredStreaming/lastCompletedBuild/) Python | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Python2/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python2/lastCompletedBuild/)[![Build
[jira] [Work logged] (BEAM-8487) Python typehints: support forward references
[ https://issues.apache.org/jira/browse/BEAM-8487?focusedWorklogId=364803=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-364803 ] ASF GitHub Bot logged work on BEAM-8487: Author: ASF GitHub Bot Created on: 30/Dec/19 23:53 Start Date: 30/Dec/19 23:53 Worklog Time Spent: 10m Work Description: udim commented on pull request #9888: [BEAM-8487] Convert forward references to Any URL: https://github.com/apache/beam/pull/9888 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 364803) Time Spent: 1h (was: 50m) > Python typehints: support forward references > > > Key: BEAM-8487 > URL: https://issues.apache.org/jira/browse/BEAM-8487 > Project: Beam > Issue Type: Bug > Components: sdk-py-core >Reporter: Udi Meiri >Assignee: Udi Meiri >Priority: Major > Time Spent: 1h > Remaining Estimate: 0h > > Typehints may be given as string literals: > https://www.python.org/dev/peps/pep-0484/#forward-references > These are currently not evaluated and result in errors. > Example 1: > {code} > def test_typed_callable_string_hints(self): > def do_fn(element: 'int') -> 'typehints.List[str]': > return [[str(element)] * 2] > result = [1, 2] | beam.ParDo(do_fn) > self.assertEqual([['1', '1'], ['2', '2']], sorted(result)) > {code} > This results in: > {code} > > return issubclass(sub, base) > E TypeError: issubclass() arg 2 must be a class or tuple of classes > typehints.py:1168: TypeError > {code} > Example 2: > {code} > def test_typed_dofn_string_hints(self): > class MyDoFn(beam.DoFn): > def process(self, element: 'int') -> 'typehints.List[str]': > return [[str(element)] * 2] > result = [1, 2] | beam.ParDo(MyDoFn()) > self.assertEqual([['1', '1'], ['2', '2']], sorted(result)) > {code} > This results in: > {code} > > raise ValueError('%s is not iterable' % type_hint) > E ValueError: typehints.List[str] is not iterable > typehints.py:1194: ValueError > {code} > where the non-iterable entity the error refers to is a string literal > ("typehints.List[str]"). -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (BEAM-8487) Python typehints: support forward references
[ https://issues.apache.org/jira/browse/BEAM-8487?focusedWorklogId=364048=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-364048 ] ASF GitHub Bot logged work on BEAM-8487: Author: ASF GitHub Bot Created on: 27/Dec/19 21:51 Start Date: 27/Dec/19 21:51 Worklog Time Spent: 10m Work Description: udim commented on issue #9888: [BEAM-8487] Convert forward references to Any URL: https://github.com/apache/beam/pull/9888#issuecomment-569352012 1st commit: Rebased without any conflicts 2nd commit: docs fixup This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 364048) Time Spent: 50m (was: 40m) > Python typehints: support forward references > > > Key: BEAM-8487 > URL: https://issues.apache.org/jira/browse/BEAM-8487 > Project: Beam > Issue Type: Bug > Components: sdk-py-core >Reporter: Udi Meiri >Assignee: Udi Meiri >Priority: Major > Time Spent: 50m > Remaining Estimate: 0h > > Typehints may be given as string literals: > https://www.python.org/dev/peps/pep-0484/#forward-references > These are currently not evaluated and result in errors. > Example 1: > {code} > def test_typed_callable_string_hints(self): > def do_fn(element: 'int') -> 'typehints.List[str]': > return [[str(element)] * 2] > result = [1, 2] | beam.ParDo(do_fn) > self.assertEqual([['1', '1'], ['2', '2']], sorted(result)) > {code} > This results in: > {code} > > return issubclass(sub, base) > E TypeError: issubclass() arg 2 must be a class or tuple of classes > typehints.py:1168: TypeError > {code} > Example 2: > {code} > def test_typed_dofn_string_hints(self): > class MyDoFn(beam.DoFn): > def process(self, element: 'int') -> 'typehints.List[str]': > return [[str(element)] * 2] > result = [1, 2] | beam.ParDo(MyDoFn()) > self.assertEqual([['1', '1'], ['2', '2']], sorted(result)) > {code} > This results in: > {code} > > raise ValueError('%s is not iterable' % type_hint) > E ValueError: typehints.List[str] is not iterable > typehints.py:1194: ValueError > {code} > where the non-iterable entity the error refers to is a string literal > ("typehints.List[str]"). -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (BEAM-8487) Python typehints: support forward references
[ https://issues.apache.org/jira/browse/BEAM-8487?focusedWorklogId=362795=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-362795 ] ASF GitHub Bot logged work on BEAM-8487: Author: ASF GitHub Bot Created on: 23/Dec/19 23:59 Start Date: 23/Dec/19 23:59 Worklog Time Spent: 10m Work Description: chamikaramj commented on issue #9888: [BEAM-8487] Convert forward references to Any URL: https://github.com/apache/beam/pull/9888#issuecomment-568609324 LGTM. Thanks. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 362795) Time Spent: 0.5h (was: 20m) > Python typehints: support forward references > > > Key: BEAM-8487 > URL: https://issues.apache.org/jira/browse/BEAM-8487 > Project: Beam > Issue Type: Bug > Components: sdk-py-core >Reporter: Udi Meiri >Assignee: Udi Meiri >Priority: Major > Time Spent: 0.5h > Remaining Estimate: 0h > > Typehints may be given as string literals: > https://www.python.org/dev/peps/pep-0484/#forward-references > These are currently not evaluated and result in errors. > Example 1: > {code} > def test_typed_callable_string_hints(self): > def do_fn(element: 'int') -> 'typehints.List[str]': > return [[str(element)] * 2] > result = [1, 2] | beam.ParDo(do_fn) > self.assertEqual([['1', '1'], ['2', '2']], sorted(result)) > {code} > This results in: > {code} > > return issubclass(sub, base) > E TypeError: issubclass() arg 2 must be a class or tuple of classes > typehints.py:1168: TypeError > {code} > Example 2: > {code} > def test_typed_dofn_string_hints(self): > class MyDoFn(beam.DoFn): > def process(self, element: 'int') -> 'typehints.List[str]': > return [[str(element)] * 2] > result = [1, 2] | beam.ParDo(MyDoFn()) > self.assertEqual([['1', '1'], ['2', '2']], sorted(result)) > {code} > This results in: > {code} > > raise ValueError('%s is not iterable' % type_hint) > E ValueError: typehints.List[str] is not iterable > typehints.py:1194: ValueError > {code} > where the non-iterable entity the error refers to is a string literal > ("typehints.List[str]"). -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (BEAM-8487) Python typehints: support forward references
[ https://issues.apache.org/jira/browse/BEAM-8487?focusedWorklogId=362796=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-362796 ] ASF GitHub Bot logged work on BEAM-8487: Author: ASF GitHub Bot Created on: 23/Dec/19 23:59 Start Date: 23/Dec/19 23:59 Worklog Time Spent: 10m Work Description: chamikaramj commented on issue #9888: [BEAM-8487] Convert forward references to Any URL: https://github.com/apache/beam/pull/9888#issuecomment-568609336 Run Python PreCommit This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 362796) Time Spent: 40m (was: 0.5h) > Python typehints: support forward references > > > Key: BEAM-8487 > URL: https://issues.apache.org/jira/browse/BEAM-8487 > Project: Beam > Issue Type: Bug > Components: sdk-py-core >Reporter: Udi Meiri >Assignee: Udi Meiri >Priority: Major > Time Spent: 40m > Remaining Estimate: 0h > > Typehints may be given as string literals: > https://www.python.org/dev/peps/pep-0484/#forward-references > These are currently not evaluated and result in errors. > Example 1: > {code} > def test_typed_callable_string_hints(self): > def do_fn(element: 'int') -> 'typehints.List[str]': > return [[str(element)] * 2] > result = [1, 2] | beam.ParDo(do_fn) > self.assertEqual([['1', '1'], ['2', '2']], sorted(result)) > {code} > This results in: > {code} > > return issubclass(sub, base) > E TypeError: issubclass() arg 2 must be a class or tuple of classes > typehints.py:1168: TypeError > {code} > Example 2: > {code} > def test_typed_dofn_string_hints(self): > class MyDoFn(beam.DoFn): > def process(self, element: 'int') -> 'typehints.List[str]': > return [[str(element)] * 2] > result = [1, 2] | beam.ParDo(MyDoFn()) > self.assertEqual([['1', '1'], ['2', '2']], sorted(result)) > {code} > This results in: > {code} > > raise ValueError('%s is not iterable' % type_hint) > E ValueError: typehints.List[str] is not iterable > typehints.py:1194: ValueError > {code} > where the non-iterable entity the error refers to is a string literal > ("typehints.List[str]"). -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (BEAM-8487) Python typehints: support forward references
[ https://issues.apache.org/jira/browse/BEAM-8487?focusedWorklogId=361774=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-361774 ] ASF GitHub Bot logged work on BEAM-8487: Author: ASF GitHub Bot Created on: 20/Dec/19 18:10 Start Date: 20/Dec/19 18:10 Worklog Time Spent: 10m Work Description: udim commented on issue #9888: [BEAM-8487] Convert forward references to Any URL: https://github.com/apache/beam/pull/9888#issuecomment-568024434 R: @chamikaramj Python precommit failure is known flake: BEAM-8974 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 361774) Time Spent: 20m (was: 10m) > Python typehints: support forward references > > > Key: BEAM-8487 > URL: https://issues.apache.org/jira/browse/BEAM-8487 > Project: Beam > Issue Type: Bug > Components: sdk-py-core >Reporter: Udi Meiri >Assignee: Udi Meiri >Priority: Major > Time Spent: 20m > Remaining Estimate: 0h > > Typehints may be given as string literals: > https://www.python.org/dev/peps/pep-0484/#forward-references > These are currently not evaluated and result in errors. > Example 1: > {code} > def test_typed_callable_string_hints(self): > def do_fn(element: 'int') -> 'typehints.List[str]': > return [[str(element)] * 2] > result = [1, 2] | beam.ParDo(do_fn) > self.assertEqual([['1', '1'], ['2', '2']], sorted(result)) > {code} > This results in: > {code} > > return issubclass(sub, base) > E TypeError: issubclass() arg 2 must be a class or tuple of classes > typehints.py:1168: TypeError > {code} > Example 2: > {code} > def test_typed_dofn_string_hints(self): > class MyDoFn(beam.DoFn): > def process(self, element: 'int') -> 'typehints.List[str]': > return [[str(element)] * 2] > result = [1, 2] | beam.ParDo(MyDoFn()) > self.assertEqual([['1', '1'], ['2', '2']], sorted(result)) > {code} > This results in: > {code} > > raise ValueError('%s is not iterable' % type_hint) > E ValueError: typehints.List[str] is not iterable > typehints.py:1194: ValueError > {code} > where the non-iterable entity the error refers to is a string literal > ("typehints.List[str]"). -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (BEAM-8487) Python typehints: support forward references
[ https://issues.apache.org/jira/browse/BEAM-8487?focusedWorklogId=334345=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-334345 ] ASF GitHub Bot logged work on BEAM-8487: Author: ASF GitHub Bot Created on: 25/Oct/19 20:03 Start Date: 25/Oct/19 20:03 Worklog Time Spent: 10m Work Description: udim commented on pull request #9888: [BEAM-8487] Convert forward references to Any URL: https://github.com/apache/beam/pull/9888 Changes convert_to_beam_type to support string literals, but requires #9602 to actually call convert_to_beam_type on typehints. Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily: - [ ] [**Choose reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and mention them in a comment (`R: @username`). - [ ] Format the pull request title like `[BEAM-XXX] Fixes bug in ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue. - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://beam.apache.org/contribute/#make-reviewers-job-easier). Post-Commit Tests Status (on master branch) Lang | SDK | Apex | Dataflow | Flink | Gearpump | Samza | Spark --- | --- | --- | --- | --- | --- | --- | --- Go | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/) | --- | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Go_VR_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go_VR_Flink/lastCompletedBuild/) | --- | --- | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Go_VR_Spark/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go_VR_Spark/lastCompletedBuild/) Java | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/)[![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/)[![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/) | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Spark/lastCompletedBuild/)[![Build Status](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Spark_Batch/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Spark_Batch/lastCompletedBuild/) Python | [![Build Status](https://builds.apache.org/job/beam_PostCommit_Python2/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python2/lastCompletedBuild/)[![Build Status](https://builds.apache.org/job/beam_PostCommit_Python35/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Python35/lastCompletedBuild/)[![Build