Skip to content

Conversation

@malhotra5
Copy link
Collaborator

@malhotra5 malhotra5 commented Nov 19, 2025

Summary

This PR fixes the deprecation warning for datetime.utcnow() which is scheduled for removal in a future Python version.

Changes Made

  • Updated import: Added UTC to the datetime import in tests/integration/utils/consolidate_results.py
  • Replaced deprecated method: Changed datetime.utcnow() to datetime.now(UTC) on line 57

Details

The deprecation warning was:

DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).

The fix follows the recommended approach from the warning message and uses the modern timezone-aware datetime approach.

Testing

  • ✅ All pre-commit hooks pass (ruff format, ruff lint, pycodestyle, pyright)
  • ✅ Verified the function works correctly without deprecation warnings
  • ✅ No functional changes - the behavior remains identical

Files Changed

  • tests/integration/utils/consolidate_results.py: Updated datetime usage to use modern timezone-aware approach

Backward Compatibility

This change maintains full backward compatibility. The output format and functionality remain exactly the same, only the internal implementation uses the modern datetime API.

@malhotra5 can click here to continue refining the PR


Agent Server images for this PR

GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server

Variants & Base Images

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python amd64, arm64 nikolaik/python-nodejs:python3.12-nodejs22 Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:a3ac878-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-a3ac878-python \
  ghcr.io/openhands/agent-server:a3ac878-python

All tags pushed for this build

ghcr.io/openhands/agent-server:a3ac878-golang-amd64
ghcr.io/openhands/agent-server:a3ac878-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:a3ac878-golang-arm64
ghcr.io/openhands/agent-server:a3ac878-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:a3ac878-java-amd64
ghcr.io/openhands/agent-server:a3ac878-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:a3ac878-java-arm64
ghcr.io/openhands/agent-server:a3ac878-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:a3ac878-python-amd64
ghcr.io/openhands/agent-server:a3ac878-nikolaik_s_python-nodejs_tag_python3.12-nodejs22-amd64
ghcr.io/openhands/agent-server:a3ac878-python-arm64
ghcr.io/openhands/agent-server:a3ac878-nikolaik_s_python-nodejs_tag_python3.12-nodejs22-arm64
ghcr.io/openhands/agent-server:a3ac878-golang
ghcr.io/openhands/agent-server:a3ac878-java
ghcr.io/openhands/agent-server:a3ac878-python

About Multi-Architecture Support

  • Each variant tag (e.g., a3ac878-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., a3ac878-python-amd64) are also available if needed

Replace deprecated datetime.utcnow() with datetime.now(UTC) in consolidate_results.py
to resolve DeprecationWarning about datetime.utcnow() being scheduled for removal.

Co-authored-by: openhands <openhands@all-hands.dev>
@malhotra5 malhotra5 marked this pull request as ready for review November 19, 2025 18:58
@malhotra5 malhotra5 merged commit 49c42ee into main Nov 19, 2025
22 checks passed
@malhotra5 malhotra5 deleted the fix/datetime-utcnow-deprecation branch November 19, 2025 19:02
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.

4 participants