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

Fix naming for NewType and NamedTuple #3

Merged
merged 1 commit into from
Sep 8, 2022

Conversation

yeandy
Copy link

@yeandy yeandy commented Sep 8, 2022

A few unit tests were failing.

In Python 3.10, NewType is now a class rather than a function. See details here.

Also going to start use repr for Python 3.10. New PR to address that issue (apache#20982) is coming soon.


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.
  • Update CHANGES.md with noteworthy changes.
  • 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.

ValidatesRunner compliance status (on master branch)

Lang ULR Dataflow Flink Samza Spark Twister2
Go --- Build Status 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
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 ---
XLang Build Status Build Status Build Status Build Status Build Status ---

Examples testing status on various runners

Lang ULR Dataflow Flink Samza Spark Twister2
Go --- --- --- --- --- --- ---
Java --- Build Status
Build Status
Build Status
--- --- --- --- ---
Python --- --- --- --- --- --- ---
XLang --- --- --- --- --- --- ---

Post-Commit SDK/Transform Integration Tests Status (on master branch)

Go Java Python
Build Status Build Status Build Status
Build Status
Build Status

Pre-Commit Tests Status (on master branch)

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

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

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests

See CI.md for more information about GitHub Actions CI.

@yeandy
Copy link
Author

yeandy commented Sep 8, 2022

R: @AnandInguva

@github-actions github-actions bot added the python label Sep 8, 2022
# Special case for NewType, where, since Python 3.10, NewType is now a class
# rather than a function.
# TODO(https://github.com/apache/beam/issues/20076): Currently unhandled.
_LOGGER.info('Converting NewType type hint to Any: "%s"', typ)
Copy link
Owner

@AnandInguva AnandInguva Sep 8, 2022

Choose a reason for hiding this comment

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

Makes sense. Before this change in Python 3.10,

if NewType('Number', int) was passed, then the type would be apache_beam.typehints.native_type_compatibility_test.Number instead of Any right?. With this change, it would become Any

Copy link
Author

Choose a reason for hiding this comment

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

Correct.

We still need to handle it fully in apache#20076, but that can be done outside of this 3.10 PR.

@AnandInguva AnandInguva merged commit 2ec2483 into AnandInguva:py310_opcodes Sep 8, 2022
AnandInguva added a commit that referenced this pull request Oct 11, 2022
* Update Pytest version to support Python 3.10

* Update pytest-cov

* update dependencies with updated pytest related changes

* set upToDateWhen = false

* add 3.10 to tox and pytest

* Change float to string for python versions

* Add python 3.10 container

update python 3.10 dependencies

* Add precommit and postcommit changes

apache#21971

* Add Python 3.10 build file to the test suites

* Update tox with python 3.10 and add python 3.10 test suites to settings.gradle.kts

* Add InferencePostCommit to Py310 from Py39

* Change jump offset multiplier

* Add GEN_START

* Update comment

* add tox test suite

* Fix NewType and NamedTuple (#3)

* Remove unified repr (#4)

* Fix NewType and NamedTuple

* Fix names in unit tests

* Remove commented out code (#5)

* Fix more failing tests (#6)

* Remove commented out code

* Fix other tests

* fixup assertion

* resolve merge conflicts

* Add Python 3.10 to Dataflow supported version. Sickbay runner v1 tests

* Remove Python 3.10 warning

* Fixup test

* Enable additional Dataflow  test suites

* Update dependencies

* Add Python 3.10 to GH actions tests

* Add Python 3.10 to some dataflow test-suites

* Unskip tests that were sickbayed for runner_v1

* Update pandas dep for Python 3.10

* Fixup: typo

* generate dependencies

* pin protobuf requirement

* pin grpcio version

* Revert "pin grpcio version"

This reverts commit 82f9bbb.

* Revert "pin protobuf requirement"

This reverts commit 00e5b98.

* install protobuf from source

* Revert "install protobuf from source"

This reverts commit 2aa434a.

* Pin Protobuf to 3.19.4

Co-authored-by: Anand Inguva <anandinguva@google.com>
Co-authored-by: Andy Ye <andyye333@gmail.com>
AnandInguva added a commit that referenced this pull request Oct 11, 2022
Remove unified repr (#4)

* Fix NewType and NamedTuple

* Fix names in unit tests
Remove commented out code (#5)


Fix more failing tests (#6)

* Remove commented out code

* Fix other tests
fixup assertion
resolve merge conflicts
AnandInguva added a commit that referenced this pull request Oct 19, 2022
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.

2 participants