You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "Brian Hulette (Jira)" <ji...@apache.org> on 2022/04/29 17:51:00 UTC

[jira] [Reopened] (BEAM-5878) Support DoFns with Keyword-only arguments in Python 3.

     [ https://issues.apache.org/jira/browse/BEAM-5878?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brian Hulette reopened BEAM-5878:
---------------------------------

This jira is still tagged in multiple TODOs, is it actually complete?

- https://github.com/apache/beam/blob/77b1aebc5dcff45cd77563718ecfec3c8b7b8e3c/sdks/python/apache_beam/typehints/typed_pipeline_test.py#L372
- https://github.com/apache/beam/blob/c14d24d0de17c559878707c21a1406f45027b721/sdks/python/apache_beam/transforms/ptransform.py#L989
- https://github.com/apache/beam/blob/1c579f9524a35bcf9a3a7b758359c8f7aeabf5fe/sdks/python/apache_beam/runners/common.py#L137
- https://github.com/apache/beam/blob/68b9100db4b82196eba025bd417c46d03656f7c0/sdks/python/apache_beam/transforms/core.py#L387

> Support DoFns with Keyword-only arguments in Python 3.
> ------------------------------------------------------
>
>                 Key: BEAM-5878
>                 URL: https://issues.apache.org/jira/browse/BEAM-5878
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-py-core
>            Reporter: Valentyn Tymofieiev
>            Assignee: yoshiki obata
>            Priority: P3
>             Fix For: 2.18.0
>
>          Time Spent: 16.5h
>  Remaining Estimate: 0h
>
> Python 3.0 [adds a possibility|https://www.python.org/dev/peps/pep-3102/] to define functions with keyword-only arguments. 
> Currently Beam does not handle them correctly. [~ruoyu] pointed out [one place|https://github.com/apache/beam/blob/a56ce43109c97c739fa08adca45528c41e3c925c/sdks/python/apache_beam/typehints/decorators.py#L118] in our codebase that we should fix: in Python in 3.0 inspect.getargspec() will fail on functions with keyword-only arguments, but a new method [inspect.getfullargspec()|https://docs.python.org/3/library/inspect.html#inspect.getfullargspec] supports them.
> There may be implications for our (best-effort) type-hints machinery.
> We should also add a Py3-only unit tests that covers DoFn's with keyword-only arguments once Beam Python 3 tests are in a good shape.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)