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-3552] Support Python 3 in the metrics, internal, typehints, and utils modules. #4515

Merged
merged 1 commit into from Feb 15, 2018

Conversation

luke-zhu
Copy link
Contributor

  • Follow this checklist to help us incorporate your contribution quickly and easily:

  • [] Make sure there is a JIRA issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes.

  • [] Each commit in the pull request should have a meaningful subject line and body.

  • [] Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue.

  • [] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.

  • [] Run mvn clean verify to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.

  • If this contribution is large, please file an Apache Individual Contributor License Agreement.


Ensures that the unit tests in these modules which don't depend on other modules pass.

The changes include:

  • preferring new division over old div
  • implementing rich comparison methods for Duration, Timestamp, and Window
  • fixing standard library imports
  • using six to resolve problems with strings

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.

Thanks! Just some minor comments.

@@ -60,8 +60,8 @@ def test_non_function(self):
[1, 2, 3] | beam.Map(str.upper)

def test_loose_bounds(self):
@typehints.with_input_types(typehints.Union[int, float, long])
@typehints.with_output_types(basestring)
@typehints.with_input_types(typehints.Union[int, float, int])
Copy link
Contributor

Choose a reason for hiding this comment

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

redundant int

@typehints.with_input_types(typehints.Union[int, float, long])
@typehints.with_output_types(basestring)
@typehints.with_input_types(typehints.Union[int, float, int])
@typehints.with_output_types(type)
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be just str.

@luke-zhu
Copy link
Contributor Author

Great, I've made the changes and squashed it down to 1 commit.

@luke-zhu
Copy link
Contributor Author

Hi @robertwb, I've resolved recent merge conflicts. The unit tests that don't pass in Python 3 are the trivial inference tests and the ones in utils/ regarding using rich comparisons instead cmp (blocked by the Cython version).

@robertwb
Copy link
Contributor

Thanks! We should consider how we're going to test these to keep it working going forward.

@robertwb robertwb closed this Feb 15, 2018
@robertwb robertwb reopened this Feb 15, 2018
@robertwb robertwb merged commit a5d9fe1 into apache:master Feb 15, 2018
@luke-zhu
Copy link
Contributor Author

Great, I will add JIRA issues regarding the problems remaining in the above modules. I don't have too much experience with this type of migration, but t seems that until we can get rid of all major blockers (SyntaxError, NameError, ImportError, etc.) in the modules, it will be hard to test that Beam works correctly on Python3.

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

Successfully merging this pull request may close these issues.

None yet

2 participants