Anurag-S1ngh opened a new pull request, #41740: URL: https://github.com/apache/beam/pull/41740
Replaces deprecated datetime APIs in the Python SDK that emit `DeprecationWarning` on Python 3.12. `datetime.datetime.utcnow()` and `datetime.datetime.utcfromtimestamp()` are scheduled for removal, and Beam supports Python 3.11 through 3.14. This is a first slice of #18303, limited to the datetime deprecations so it stays easy to review. ## Changes - `apache_beam/dataframe/io_test.py`: build expected window timestamps with `datetime.fromtimestamp(..., timezone.utc)`. - `apache_beam/io/gcp/bigquery_tools.py`: convert BigQuery TIMESTAMP cells with a UTC-aware `fromtimestamp`. - `apache_beam/io/gcp/datastore/v1new/types_test.py`: use `datetime.now(timezone.utc)` in the entity conversion test. - `apache_beam/examples/complete/game/hourly_team_score.py`: use the epoch date literal instead of `utcfromtimestamp(0)`. - `apache_beam/runners/interactive/display/pcoll_visualization.py`: use an aware `fromtimestamp` and remove the unused `dateutil.tz` import. - `apache_beam/typehints/schemas.py`: use the epoch date literal in `JdbcTimeType`. Naive UTC values are kept where existing comparisons or formatted output depend on them. ## Tests - `python -m pytest apache_beam/dataframe/io_test.py -k test_windowed_write` - `python -m pytest apache_beam/io/gcp/datastore/v1new/types_test.py` - `python -m pytest apache_beam/typehints/schemas_test.py` - `yapf --diff` on all touched files addresses #18303 -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
