[jira] [Commented] (BEAM-9012) Include `-> None` on Pipeline and PipelineOptions `__init__` methods for pytype compatibility

2020-01-08 Thread Kenneth Knowles (Jira)


[ 
https://issues.apache.org/jira/browse/BEAM-9012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17011517#comment-17011517
 ] 

Kenneth Knowles commented on BEAM-9012:
---

Peanut gallery: Seems like satisfying both static checkers is worth it in this 
case. I'm employed by Google, but my heart belongs to types/verification, so 
I'm not just saying this because of my paycheck.

> Include `-> None` on Pipeline and PipelineOptions `__init__` methods for 
> pytype compatibility
> -
>
> Key: BEAM-9012
> URL: https://issues.apache.org/jira/browse/BEAM-9012
> Project: Beam
>  Issue Type: Improvement
>  Components: sdk-py-core
>Reporter: Brian Hulette
>Assignee: Brian Hulette
>Priority: Major
> Fix For: 2.19.0
>
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> mypy [made a decision|https://github.com/python/mypy/issues/604] to allow 
> init methods to omit {{\-> None}} return type annotations, but pytype has no 
> such feature. I think we should include {{\-> None}} annotations for pytype 
> compatibility.
> cc: [~chadrik]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (BEAM-9012) Include `-> None` on Pipeline and PipelineOptions `__init__` methods for pytype compatibility

2019-12-20 Thread Brian Hulette (Jira)


[ 
https://issues.apache.org/jira/browse/BEAM-9012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17001300#comment-17001300
 ] 

Brian Hulette commented on BEAM-9012:
-

My motivation: we use pytype internally at Google. Some teams are already 
running pytype on code that uses beam python. Before we had type hints it just 
happily ignored the beam code, but with the change some errors are cropping up. 
You have a good point that it could be a slippery slope to promise full pytype 
support... but so far across a lot of different code this is actually the only 
issue that's come up.

> Include `-> None` on Pipeline and PipelineOptions `__init__` methods for 
> pytype compatibility
> -
>
> Key: BEAM-9012
> URL: https://issues.apache.org/jira/browse/BEAM-9012
> Project: Beam
>  Issue Type: Improvement
>  Components: sdk-py-core
>Reporter: Brian Hulette
>Assignee: Brian Hulette
>Priority: Major
> Fix For: 2.19.0
>
>
> mypy [made a decision|https://github.com/python/mypy/issues/604] to allow 
> init methods to omit {{\-> None}} return type annotations, but pytype has no 
> such feature. I think we should include {{\-> None}} annotations for pytype 
> compatibility.
> cc: [~chadrik]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (BEAM-9012) Include `-> None` on Pipeline and PipelineOptions `__init__` methods for pytype compatibility

2019-12-20 Thread Chad Dombrova (Jira)


[ 
https://issues.apache.org/jira/browse/BEAM-9012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17001295#comment-17001295
 ] 

Chad Dombrova commented on BEAM-9012:
-

I imagine there are going to be _lots_ of little differences between mypy and 
pytype.  I'm curious your motivation for using pytype.   Do you think we should 
aim to support both?  I'd be a bit wary of doing so, since getting mypy to pass 
can be challenging enough on its own.  I can imagine scenarios where there is 
no solution that appeases both mypy and pytype (thinking particularly of 
overloads, whose semantics seem to vary between tools).

 

> Include `-> None` on Pipeline and PipelineOptions `__init__` methods for 
> pytype compatibility
> -
>
> Key: BEAM-9012
> URL: https://issues.apache.org/jira/browse/BEAM-9012
> Project: Beam
>  Issue Type: Improvement
>  Components: sdk-py-core
>Reporter: Brian Hulette
>Assignee: Brian Hulette
>Priority: Major
> Fix For: 2.19.0
>
>
> mypy [made a decision|https://github.com/python/mypy/issues/604] to allow 
> init methods to omit {{\-> None}} return type annotations, but pytype has no 
> such feature. I think we should include {{\-> None}} annotations for pytype 
> compatibility.
> cc: [~chadrik]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (BEAM-9012) Include `-> None` on Pipeline and PipelineOptions `__init__` methods for pytype compatibility

2019-12-20 Thread Brian Hulette (Jira)


[ 
https://issues.apache.org/jira/browse/BEAM-9012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17001281#comment-17001281
 ] 

Brian Hulette commented on BEAM-9012:
-

The gotcha is that pytype won't let you specify just a return type (see 
https://github.com/google/pytype/issues/480). The only workaround I've found is 
to include a full type annotation for the function, like {{#type: (int, str, 
float) -> None}}, which can be ugly, particularly for Pipeline :/

> Include `-> None` on Pipeline and PipelineOptions `__init__` methods for 
> pytype compatibility
> -
>
> Key: BEAM-9012
> URL: https://issues.apache.org/jira/browse/BEAM-9012
> Project: Beam
>  Issue Type: Improvement
>  Components: sdk-py-core
>Reporter: Brian Hulette
>Assignee: Brian Hulette
>Priority: Major
> Fix For: 2.19.0
>
>
> mypy [made a decision|https://github.com/python/mypy/issues/604] to allow 
> init methods to omit {{\-> None}} return type annotations, but pytype has no 
> such feature. I think we should include {{\-> None}} annotations for pytype 
> compatibility.
> cc: [~chadrik]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (BEAM-9012) Include `-> None` on Pipeline and PipelineOptions `__init__` methods for pytype compatibility

2019-12-20 Thread Chad Dombrova (Jira)


[ 
https://issues.apache.org/jira/browse/BEAM-9012?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17001279#comment-17001279
 ] 

Chad Dombrova commented on BEAM-9012:
-

Fine by me.  Brian, if you're into the static typing thing, you may want to 
poke in over at my second PR, which is waiting on some feedback:  
[https://github.com/apache/beam/pull/10367]

There will probably be a third (and hopefully final) PR after that one to get 
the project to a point where mypy is fully passing.  We can take care of this 
issue in that final PR. 

 

> Include `-> None` on Pipeline and PipelineOptions `__init__` methods for 
> pytype compatibility
> -
>
> Key: BEAM-9012
> URL: https://issues.apache.org/jira/browse/BEAM-9012
> Project: Beam
>  Issue Type: Improvement
>  Components: sdk-py-core
>Reporter: Brian Hulette
>Assignee: Brian Hulette
>Priority: Major
> Fix For: 2.19.0
>
>
> mypy [made a decision|https://github.com/python/mypy/issues/604] to allow 
> init methods to omit {{\-> None}} return type annotations, but pytype has no 
> such feature. I think we should include {{\-> None}} annotations for pytype 
> compatibility.
> cc: [~chadrik]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)