You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "A1K28 (via GitHub)" <gi...@apache.org> on 2025/07/29 17:10:50 UTC
[PR] adapt to new np outputs (#35691) [beam]
A1K28 opened a new pull request, #35729:
URL: https://github.com/apache/beam/pull/35729
### Description
This PR fixes a flaky test, which is caused by pandas_doctests_test.py::DoctestTest::test_top_level, that fails intermittently in CI on Python 3.12.
### Issue
The test fails with an AssertionError: 4 != 0 due to a doctest mismatch. This occurs because newer versions of numpy, particularly when run on Python 3.12, produce a more explicit string representation for arrays (e.g., [np.int32(1)] instead of [1]).
### Solution
The project's custom _DeferrredDataframeOutputChecker already contains logic to normalize these string representations. However, this logic was incorrectly guarded by a version check:
```Python
if sys.version_info < (3, 11) and 'NumpyExtensionArray' in got:
# ... normalization logic ...
```
This prevented the fix from running on Python 3.12 environments. This PR removes the obsolete sys.version_info < (3, 11) condition, allowing the output normalization to run on all Python versions and resolving the test failure.
### Verification
I have verified this fix locally by:
Creating a clean environment using Python 3.12.10 to reliably reproduce the AssertionError.
Applying this code change, which caused the test to pass consistently in the same Python 3.12.10 environment.
This change makes our doctests more resilient to environmental differences.
Related Issue: Fixes #35691
Related PR:
------------------------
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
- [ ] Mention the appropriate issue in your description (for example: `addresses #123`), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment `fixes #<ISSUE NUMBER>` instead.
- [ ] Update `CHANGES.md` with noteworthy changes.
- [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://github.com/apache/beam/blob/master/CONTRIBUTING.md#make-the-reviewers-job-easier).
To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
GitHub Actions Tests Status (on master branch)
------------------------------------------------------------------------------------------------
[](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
[](https://github.com/apache/beam/actions?query=workflow%3A%22Go+tests%22+branch%3Amaster+event%3Aschedule)
See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI or the [workflows README](https://github.com/apache/beam/blob/master/.github/workflows/README.md) to see a list of phrases to trigger workflows.
--
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.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] adapt to new np outputs (#35691) [beam]
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on code in PR #35729:
URL: https://github.com/apache/beam/pull/35729#discussion_r2240809489
##########
CHANGES.md:
##########
@@ -135,7 +135,8 @@
* Fixed X (Java/Python) ([#X](https://github.com/apache/beam/issues/X)).
* [YAML] Fixed handling of missing optional fields in JSON parsing ([#35179](https://github.com/apache/beam/issues/35179)).
* [Python] Fix WriteToBigQuery transform using CopyJob does not work with WRITE_TRUNCATE write disposition ([#34247](https://github.com/apache/beam/issues/34247))
-* [Python] Fixed dicomio tags mismatch in integration tests ([#35658](https://github.com/apache/beam/pull/35658)).
+* [Python] Fixed dicomio tags mismatch in integration tests ([#30760](https://github.com/apache/beam/issues/30760)).
+* [Python] Fixed flaky workflow: PreCommit_Python_Dataframes which was caused by newer numpy versions ([#35691](https://github.com/apache/beam/issues/35691)).
Review Comment:
The change isn't user facing (doctests.py) so no need to add CHANGES.md
--
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.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] adapt to new np outputs (#35691) [beam]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #35729:
URL: https://github.com/apache/beam/pull/35729#issuecomment-3133968994
## [Codecov](https://app.codecov.io/gh/apache/beam/pull/35729?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 56.56%. Comparing base ([`ef04862`](https://app.codecov.io/gh/apache/beam/commit/ef0486285dd025b4cd07ed9bfedf198e3e78571e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`240519b`](https://app.codecov.io/gh/apache/beam/commit/240519bcc539e6a9c4953328974dec7bee237e58?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 13 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #35729 +/- ##
============================================
+ Coverage 56.53% 56.56% +0.02%
Complexity 3381 3381
============================================
Files 1203 1204 +1
Lines 183894 183750 -144
Branches 3490 3490
============================================
- Hits 103968 103935 -33
+ Misses 76599 76491 -108
+ Partials 3327 3324 -3
```
| [Flag](https://app.codecov.io/gh/apache/beam/pull/35729/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [python](https://app.codecov.io/gh/apache/beam/pull/35729/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `80.78% <100.00%> (+0.11%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/beam/pull/35729?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] adapt to new np outputs (#35691) [beam]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #35729:
URL: https://github.com/apache/beam/pull/35729#issuecomment-3133644355
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment `assign set of reviewers`
--
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.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] adapt to new np outputs (#35691) [beam]
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on PR #35729:
URL: https://github.com/apache/beam/pull/35729#issuecomment-3134605914
Python ML precommit failing not related to this change. Merging for now
--
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.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] adapt to new np outputs (#35691) [beam]
Posted by "A1K28 (via GitHub)" <gi...@apache.org>.
A1K28 closed pull request #35729: adapt to new np outputs (#35691)
URL: https://github.com/apache/beam/pull/35729
--
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.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] adapt to new np outputs (#35691) [beam]
Posted by "A1K28 (via GitHub)" <gi...@apache.org>.
A1K28 commented on PR #35729:
URL: https://github.com/apache/beam/pull/35729#issuecomment-3137042809
Sorry, I will do that in the future instead of reopening. thanks!
--
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.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] adapt to new np outputs (#35691) [beam]
Posted by "A1K28 (via GitHub)" <gi...@apache.org>.
A1K28 commented on PR #35729:
URL: https://github.com/apache/beam/pull/35729#issuecomment-3133373792
@Amar3tto
--
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.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] adapt to new np outputs (#35691) [beam]
Posted by "A1K28 (via GitHub)" <gi...@apache.org>.
A1K28 commented on PR #35729:
URL: https://github.com/apache/beam/pull/35729#issuecomment-3133641681
R: @Abacn
--
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.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] adapt to new np outputs (#35691) [beam]
Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on code in PR #35729:
URL: https://github.com/apache/beam/pull/35729#discussion_r2240474798
##########
CHANGES.md:
##########
@@ -135,7 +135,8 @@
* Fixed X (Java/Python) ([#X](https://github.com/apache/beam/issues/X)).
* [YAML] Fixed handling of missing optional fields in JSON parsing ([#35179](https://github.com/apache/beam/issues/35179)).
* [Python] Fix WriteToBigQuery transform using CopyJob does not work with WRITE_TRUNCATE write disposition ([#34247](https://github.com/apache/beam/issues/34247))
-* [Python] Fixed dicomio tags mismatch in integration tests ([#35658](https://github.com/apache/beam/pull/35658)).
+* [Python] Fixed dicomio tags mismatch in integration tests ([#30760](https://github.com/apache/beam/issues/30760)).
+* [Python] Fixed flaky workflow: PreCommit_Python_Dataframes which was caused by newer numpy versions ([35691](https://github.com/apache/beam/issues/35691)).
Review Comment:

For consistency with other entries in this file, please add a `#` prefix to the issue number in the Markdown link.
```suggestion
* [Python] Fixed flaky workflow: PreCommit_Python_Dataframes which was caused by newer numpy versions ([#35691](https://github.com/apache/beam/issues/35691)).
```
--
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.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] adapt to new np outputs (#35691) [beam]
Posted by "A1K28 (via GitHub)" <gi...@apache.org>.
A1K28 commented on PR #35729:
URL: https://github.com/apache/beam/pull/35729#issuecomment-3136836058
I will recreate the PR in order to avoid bloated commits.
--
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.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] adapt to new np outputs (#35691) [beam]
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn commented on PR #35729:
URL: https://github.com/apache/beam/pull/35729#issuecomment-3137034321
No need to open a new PR, you can use same PR and rebase your branch onto latest master then force push
--
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.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] adapt to new np outputs (#35691) [beam]
Posted by "A1K28 (via GitHub)" <gi...@apache.org>.
A1K28 commented on code in PR #35729:
URL: https://github.com/apache/beam/pull/35729#discussion_r2240834798
##########
CHANGES.md:
##########
@@ -135,7 +135,8 @@
* Fixed X (Java/Python) ([#X](https://github.com/apache/beam/issues/X)).
* [YAML] Fixed handling of missing optional fields in JSON parsing ([#35179](https://github.com/apache/beam/issues/35179)).
* [Python] Fix WriteToBigQuery transform using CopyJob does not work with WRITE_TRUNCATE write disposition ([#34247](https://github.com/apache/beam/issues/34247))
-* [Python] Fixed dicomio tags mismatch in integration tests ([#35658](https://github.com/apache/beam/pull/35658)).
+* [Python] Fixed dicomio tags mismatch in integration tests ([#30760](https://github.com/apache/beam/issues/30760)).
+* [Python] Fixed flaky workflow: PreCommit_Python_Dataframes which was caused by newer numpy versions ([#35691](https://github.com/apache/beam/issues/35691)).
Review Comment:
Done. I removed the change from CHANGES.md
--
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.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org