Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BEAM-8280] Enable type hint annotations #10717

Merged
merged 1 commit into from
Mar 20, 2020
Merged

Conversation

udim
Copy link
Member

@udim udim commented Jan 29, 2020

Changes default to use type annotations.

Adds a couple of way to disable them:

  • apache_beam.typehints.disable_type_annotations() to disable globally.
  • @apache_beam.typehints.no_annotations decorator to disable on a specific
    function.

Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

Post-Commit Tests Status (on master branch)

Lang SDK Apex Dataflow Flink Gearpump Samza Spark
Go Build Status --- --- Build Status --- --- Build Status
Java Build Status Build Status Build Status Build Status
Build Status
Build Status
Build Status Build Status Build Status
Build Status
Build Status
Python Build Status
Build Status
Build Status
Build Status
--- Build Status
Build Status
Build Status
Build Status
--- --- Build Status
XLang --- --- --- Build Status --- --- ---

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website
Non-portable Build Status Build Status
Build Status
Build Status Build Status
Portable --- Build Status --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

@udim
Copy link
Member Author

udim commented Feb 12, 2020

Run Portable_Python PreCommit

@udim
Copy link
Member Author

udim commented Feb 12, 2020

Run PythonFormatter PreCommit

@udim
Copy link
Member Author

udim commented Feb 12, 2020

Run Python PreCommit

udim added a commit to udim/beam that referenced this pull request Feb 19, 2020
Adds `@decorators.no_annotations` decorator to disable on a specific
function.

Split out of apache#10717
@udim udim mentioned this pull request Feb 19, 2020
4 tasks
udim added a commit that referenced this pull request Feb 20, 2020
* [BEAM-8280] no_annotations decorator

Adds `@decorators.no_annotations` decorator to disable on a specific
function.

Split out of #10717

* Refactor test
@udim udim force-pushed the from-callable-flag branch from 469319e to cccd4b6 Compare February 28, 2020 19:51
@udim
Copy link
Member Author

udim commented Mar 6, 2020

Run Python PreCommit

@udim
Copy link
Member Author

udim commented Mar 6, 2020

Run Python2_PVR_Flink PreCommit

@udim udim force-pushed the from-callable-flag branch from 26c6281 to fb3230b Compare March 6, 2020 01:07
@udim
Copy link
Member Author

udim commented Mar 6, 2020

R: @robertwb

Copy link
Contributor

@robertwb robertwb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

CHANGES.md Outdated Show resolved Hide resolved
@udim udim force-pushed the from-callable-flag branch from fb3230b to e8d2844 Compare March 20, 2020 01:15
Changes default to use type annotations.

Adds `apache_beam.typehints.disable_type_annotations()`, which disables
annotations globally.
@udim udim force-pushed the from-callable-flag branch from e8d2844 to 636de82 Compare March 20, 2020 01:20
@udim
Copy link
Member Author

udim commented Mar 20, 2020

Run Python PreCommit

1 similar comment
@udim
Copy link
Member Author

udim commented Mar 20, 2020

Run Python PreCommit

@udim udim merged commit 0351b49 into apache:master Mar 20, 2020
Copy link
Contributor

@angoenka angoenka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking into it while triaging failing import.

@@ -138,8 +139,7 @@ def foo((a, b)):

_ANY_VAR_POSITIONAL = typehints.Tuple[typehints.Any, ...]
_ANY_VAR_KEYWORD = typehints.Dict[typehints.Any, typehints.Any]
# TODO(BEAM-8280): Remove this when from_callable is ready to be enabled.
_enable_from_callable = False
_disable_from_callable = False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be True? (based on the check in line 234)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I inverted the logic and made using type annotations on by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants