Skip to content

Comments

Fix deprecation warnings in dependencies#2945

Merged
JacobCoffee merged 3 commits intopython:mainfrom
hugovk:fix-more-deprecation-warnings
Feb 24, 2026
Merged

Fix deprecation warnings in dependencies#2945
JacobCoffee merged 3 commits intopython:mainfrom
hugovk:fix-more-deprecation-warnings

Conversation

@hugovk
Copy link
Member

@hugovk hugovk commented Feb 24, 2026

Description

There's lots of deprecation warnings at https://github.com/python/pythondotorg/actions/runs/22328504402/job/64605126832#step:9:13

Most are from Django, but these are from dependencies:

/opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/dateutil/tz/tz.py:37: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
  EPOCH = datetime.datetime.utcfromtimestamp(0)
/opt/hostedtoolcache/Python/3.12.6/x64/lib/python3.12/site-packages/pytz/tzinfo.py:27: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
  _epoch = datetime.utcfromtimestamp(0)

The first is from dateutil. We can fix by upgrading to the latest version.

The second is from pytz. We only use pytz.UTC from here, and can instead replace it with the stdlib's datetime.UTC, and ditch the dependency altogether.

And run uv lock to update uv.lock.

Copilot AI review requested due to automatic review settings February 24, 2026 15:09
@hugovk hugovk requested a review from JacobCoffee as a code owner February 24, 2026 15:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes deprecation warnings from dependencies by upgrading python-dateutil and replacing the pytz library with Python's standard library datetime.UTC. The changes address warnings about datetime.datetime.utcfromtimestamp() being deprecated in favor of timezone-aware datetime objects.

Changes:

  • Upgraded python-dateutil from 2.8.2 to 2.9.0.post0 to fix dateutil deprecation warnings
  • Removed pytz dependency and replaced all usages with datetime.UTC (Python 3.11+ standard library)
  • Updated uv.lock with dependency upgrades including django-tastypie, factory-boy, faker, model-bakery, and other transitive dependencies

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
pyproject.toml Removed pytz dependency, upgraded python-dateutil to 2.9.0.post0
apps/events/utils.py Replaced pytz imports and pytz.UTC references with datetime.UTC
uv.lock Updated lock file with new dependency versions after running uv lock

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JacobCoffee JacobCoffee merged commit 929affd into python:main Feb 24, 2026
9 checks passed
@JacobCoffee
Copy link
Member

thanks!

@hugovk hugovk deleted the fix-more-deprecation-warnings branch February 24, 2026 18:27
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.

2 participants