[
https://issues.apache.org/jira/browse/BEAM-7746?focusedWorklogId=279879&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-279879
]
ASF GitHub Bot logged work on BEAM-7746:
----------------------------------------
Author: ASF GitHub Bot
Created on: 19/Jul/19 18:21
Start Date: 19/Jul/19 18:21
Worklog Time Spent: 10m
Work Description: chadrik commented on pull request #9056: [BEAM-7746]
Add python type hints
URL: https://github.com/apache/beam/pull/9056#discussion_r305472735
##########
File path: sdks/python/apache_beam/typehints/decorators.py
##########
@@ -193,7 +200,7 @@ def __repr__(self):
self.input_types, self.output_types)
-class WithTypeHints(object):
+class WithTypeHints(Generic[InT, OutT]):
Review comment:
> How much of (2) is required for (3) and how invasive it is seems to still
be an open question, which this PR is giving good insight to.
agreed.
> Given that mypy can't even do beam.Map(lambda x: (x, 1)) I think we'll
have to rely a lot on (4).
I think people who want to use static typing for their pipelines will have
to stop using lambdas. So there will definitely be a split between those who
are willing to make that adjustment and those who want to continue relying on
the current interface for dynamic typing.
> All will be much nicer once we can have python-3 style annotations in the
code itself. We can't do that for our own codebase until Python 2 is LTS only,
but user code could start using it much sooner.
When we get to that stage, we can use this tool to convert comments to
annotations: https://github.com/ilevkivskyi/com2ann
----------------------------------------------------------------
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:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 279879)
Time Spent: 4h 10m (was: 4h)
> Add type hints to python code
> -----------------------------
>
> Key: BEAM-7746
> URL: https://issues.apache.org/jira/browse/BEAM-7746
> Project: Beam
> Issue Type: New Feature
> Components: sdk-py-core
> Reporter: Chad Dombrova
> Assignee: Chad Dombrova
> Priority: Major
> Time Spent: 4h 10m
> Remaining Estimate: 0h
>
> As a developer of the beam source code, I would like the code to use pep484
> type hints so that I can clearly see what types are required, get completion
> in my IDE, and enforce code correctness via a static analyzer like mypy.
> This may be considered a precursor to BEAM-7060
> Work has been started here: [https://github.com/apache/beam/pull/9056]
>
>
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)