rokadepiyush49-rgb commented on issue #18303:
URL: https://github.com/apache/beam/issues/18303#issuecomment-6565189540
This is still relevant, and Python 3.12 adds a concrete batch:
`datetime.utcfromtimestamp()` and `datetime.utcnow()` now emit
DeprecationWarning and are scheduled for removal. In the SDK I found four uses
of `utcfromtimestamp`:
- `io/gcp/bigquery_tools.py` (formatting TIMESTAMP values)
- `typehints/schemas.py` (the `datetime.time` logical type, which only needs
the epoch date)
- `runners/interactive/display/pcoll_visualization.py`
- `examples/complete/game/hourly_team_score.py`
plus two in `dataframe/io_test.py` and one `utcnow()` in
`io/gcp/datastore/v1new/types_test.py`.
One thing to be careful about: `utcfromtimestamp` returns a naive datetime,
and the suggested `fromtimestamp(ts, tz=timezone.utc)` returns an aware one.
Where the result is formatted or compared with naive values, it needs
`.replace(tzinfo=None)` to keep the same output. And since `setup.py` still
allows Python 3.10, it has to be `datetime.timezone.utc` rather than the 3.11+
`datetime.UTC` alias.
Would a PR scoped to just these datetime deprecations be welcome as a first
slice of this issue? I'd keep it to that so it's easy to review.
```mermaid
flowchart TD
subgraph P1["1. Prepare"]
A1["Optional short comment, or go straight to a PR"] --> A2["Enable
Issues on your fork in Settings"]
end
subgraph P2["2. Edit .github/ISSUE_TEMPLATE/bug-report.yml"]
B1["Error message field: delete render: shell"] --> B2["Replace
placeholder with value:<br/>a details block around a fenced shell block"]
B2 --> B3["Version information field:<br/>placeholder becomes value
with details"]
B3 --> B4["Leave Reproducible code example<br/>with render: python"]
end
subgraph P3["3. Check"]
C1["Parse the file with yaml.safe_load"] --> C2["Push to your fork's
default branch,<br/>issue forms only load from it"]
C2 --> C3["New issue, Bug report:<br/>the preview shows a
collapsible block"]
C3 --> C4["Take before and after screenshots"]
end
subgraph P4["4. Pull request"]
D1["Open the PR from a feature branch<br/>gh pr create --repo
pymc-devs/pytensor"] --> D2["Body: Closes 153, attach the screenshots"]
end
A2 --> B1
B4 --> C1
C4 --> D1
```
--
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]