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

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

                Author: ASF GitHub Bot
            Created on: 17/Jul/19 19:34
            Start Date: 17/Jul/19 19:34
    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_r304605958
 
 

 ##########
 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:
   True.  I think the somewhat unsatisfactory answer is that for the time being 
you need both: one for runtime checking and the other for static checking, 
until such a time as they can become the same.  I think trying to do that all 
in one PR is going to be too much.
   
   off the top of my head, the order this should probably be done is:
   
   1. support runtime type hints using `typing` module instead of `typehints`
   2. add static type hints to the beam code and begin enforcing it using mypy 
(this PR)
   3. support static validation of user pipelines (mypy plugin, etc)
   4. support runtime validations based on `typing` annotations
   
   There are a lot of "ifs" surrounding step 4.  We may need to get to 
python3-only first to avoid the pitfalls of type comments.  We may find that 
step 3 makes it less 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: 278429)
    Time Spent: 2h 20m  (was: 2h 10m)

> 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: 2h 20m
>  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