Skip to content

fix: Replace pytz with stdlib datetime.timezone and zoneinfo (#5863)#5917

Open
sagemaker-bot wants to merge 1 commit into
master-v2from
fix/modulenotfounderror-no-module-named-pytz-when-5863
Open

fix: Replace pytz with stdlib datetime.timezone and zoneinfo (#5863)#5917
sagemaker-bot wants to merge 1 commit into
master-v2from
fix/modulenotfounderror-no-module-named-pytz-when-5863

Conversation

@sagemaker-bot
Copy link
Copy Markdown
Collaborator

Description

Replaces pytz usage with Python stdlib datetime.timezone.utc and zoneinfo.ZoneInfo in sagemaker.workflow.pipeline and sagemaker.workflow.triggers. This eliminates the undeclared pytz dependency that causes ModuleNotFoundError when pandas>=3 removes its transitive pytz dependency.

Related Issue

Fixes #5863

Changes Made

  • src/sagemaker/workflow/pipeline.py — replaced pytz.utc with datetime.timezone.utc
  • src/sagemaker/workflow/triggers.py — replaced pytz.timezone() with zoneinfo.ZoneInfo()
  • tests/unit/sagemaker/workflow/test_triggers.py — updated tests to use zoneinfo

AI-Generated PR

This PR was generated and validated by the PR Generator Sandbox. The sandbox:

  1. Generated the fix using Bedrock Agent
  2. Caught a test failure (.localize() not available on ZoneInfo) and auto-fixed it
  3. Passed the full V2 test suite (unit + integ)

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.15%. Comparing base (a140cfc) to head (b752fec).
⚠️ Report is 26 commits behind head on master-v2.

Additional details and impacted files
@@              Coverage Diff              @@
##           master-v2    #5917      +/-   ##
=============================================
+ Coverage      86.07%   86.15%   +0.08%     
=============================================
  Files            455      455              
  Lines          44414    44672     +258     
=============================================
+ Hits           38229    38488     +259     
+ Misses          6185     6184       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mohamedzeidan2021 mohamedzeidan2021 marked this pull request as ready for review June 1, 2026 18:40
@mohamedzeidan2021 mohamedzeidan2021 requested a review from a team as a code owner June 1, 2026 18:40
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.

1 participant