[ 
https://issues.apache.org/jira/browse/BEAM-7746?focusedWorklogId=278046&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-278046
 ]

ASF GitHub Bot logged work on BEAM-7746:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 17/Jul/19 08:04
            Start Date: 17/Jul/19 08:04
    Worklog Time Spent: 10m 
      Work Description: robertwb commented on pull request #9056: [BEAM-7746] 
Add python type hints
URL: https://github.com/apache/beam/pull/9056#discussion_r304268742
 
 

 ##########
 File path: sdks/python/apache_beam/examples/wordcount.py
 ##########
 @@ -85,31 +98,66 @@ def run(argv=None):
   pipeline_options.view_as(SetupOptions).save_main_session = True
   p = beam.Pipeline(options=pipeline_options)
 
+  reveal_type(p)
+
+  _read = ReadFromText(known_args.input)
+  reveal_type(_read)
+
+  read = 'read' >> _read
+  reveal_type(read)
+
   # Read the text file[pattern] into a PCollection.
-  lines = p | 'read' >> ReadFromText(known_args.input)
+  lines = p | read
+  reveal_type(lines)  # PCollection[unicode*]
+
+  def make_ones(x):
+    # type: (T) -> Tuple[T, int]
 
 Review comment:
   That's really unfortunate... I'd have expected more of mypy :(. In that case 
our own inference (which does handle this) is all the more important.
 
----------------------------------------------------------------
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: 278046)
    Time Spent: 0.5h  (was: 20m)

> 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
>            Priority: Major
>          Time Spent: 0.5h
>  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)

Reply via email to