Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 19, 2025

This PR removes the pytz dependency from django-dbbackup, aligning with Django's migration to Python's standard library zoneinfo as the default timezone implementation since Django 4.0.

Changes Made

  • Removed pytz from project dependencies in pyproject.toml
  • Updated test code to use datetime.timezone.utc instead of pytz.utc
  • Updated changelog to document this breaking change

Background

Django 4.0 introduced zoneinfo as the default timezone implementation, moving away from pytz. The django-dbbackup package was still carrying pytz as a dependency despite only using it in a single test case for timezone-aware datetime testing.

Impact

This change:

  • Reduces the package's dependency footprint
  • Aligns with modern Django timezone handling practices
  • Maintains full backward compatibility for end users
  • Has no impact on the core backup/restore functionality

Testing

  • ✅ All 242 unit tests pass across Python 3.12 and Django 4.2, 5.0, 5.1, 5.2
  • ✅ Functional tests pass (database and media backup/restore workflows)
  • ✅ Code linting and formatting checks pass
  • ✅ Manual verification confirms dbbackup.utils.timestamp() works correctly with datetime.timezone.utc

The utils.timestamp() function already uses Django's timezone utilities (django.utils.timezone), so no changes were needed to the core functionality.

Fixes #611.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Drop pytz dependency Drop pytz dependency in favor of Python's standard library timezone Aug 19, 2025
@Copilot Copilot AI requested a review from Archmonger August 19, 2025 03:39
Copilot finished work on behalf of Archmonger August 19, 2025 03:39
@Archmonger Archmonger requested a review from Copilot August 19, 2025 03:39
Copy link
Contributor

@Copilot 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 PR modernizes django-dbbackup's timezone handling by removing the pytz dependency and using Python's standard library datetime.timezone.utc instead. This aligns with Django 4.0+'s migration to zoneinfo as the default timezone implementation.

  • Remove pytz dependency from project dependencies
  • Update test code to use datetime.timezone.utc instead of pytz.utc
  • Document the breaking change in the changelog

Reviewed Changes

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

File Description
pyproject.toml Removes pytz from the dependencies list
tests/test_utils.py Updates import and test code to use standard library timezone
CHANGELOG.md Documents the breaking change for the next major release

@Archmonger Archmonger marked this pull request as ready for review August 19, 2025 03:43
@Archmonger Archmonger merged commit 29fef88 into master Aug 19, 2025
19 checks passed
@Archmonger Archmonger deleted the copilot/fix-611 branch August 19, 2025 03:45
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.

Drop pytz dependency

2 participants