Skip to content

Conversation

@danfimov
Copy link
Contributor

@danfimov danfimov commented Nov 4, 2025

Changes

  • Migrate from poetry-specific dependency declaration to declaration specified in PEP-621;
  • Remove unused or easy-replacable dependencies to make package smaller;

Removed libraries

pytz (and types-pytz)

Can be replaced with:

  • built-in zoneinfo library (added in python 3.9);
  • datetime.timezone.utc (instead of pytz.utc).

For tests on Windows I added tzdata because zoneinfo doesn't have access to the IANA timezone database by default on this platform.

importlib_metadata

This package is basically third-party tool for accessing importlib.metadata functionallity in old python versions. Since this project is using this livrary only for getting version of pydantic library, it can be replaced with built-in mportlib package.

mock (and types-mock)

This package is a part of standard library since python 3.3 and can be called import unittest.mock instead of import mock.

pytest-mock

This project is using this package only in one place to get mocker fixture. So it can be replaced with patch function from unittest.mock.

tzlocal (and types-tzlocal)

Used only in tests for getting arbitrary timezone (local in this case). So it can be replaced with fixed timezone - ZoneInfo("Europe/Paris") for example.

typing_extension

In every python release part of typing_extension migrate to typing package. So I make it required only for projects with python <3.11.

All imports of this package are wrapped in if-else blocks with Python version checks. If we remove compatibility with older Python versions, we can remove these constructs along with it.

Copilot AI review requested due to automatic review settings November 4, 2025 13:43
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 modernizes the project's dependency management and Python standard library usage by migrating from Poetry to a native pyproject.toml format and replacing third-party dependencies with Python's built-in alternatives where available. The changes drop Python 3.8 support and set the minimum version to Python 3.9.

Key changes include:

  • Migrated from Poetry to native pyproject.toml with PEP 621 standard format
  • Replaced third-party packages (pytz, importlib-metadata, mock, pytest-mock, tzlocal) with Python standard library equivalents (datetime.timezone, zoneinfo, importlib.metadata, unittest.mock)
  • Added conditional imports for typing features based on Python version to use stdlib when available

Reviewed Changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pyproject.toml Converted from Poetry format to native PEP 621 format, removed Python 3.8 support, removed deprecated dependencies
poetry.lock Updated lock file reflecting removal of importlib-metadata, mock, pytest-mock, pytz, tzlocal, types-mock, types-pytz, types-tzlocal, and zipp
tests/test_funcs.py Replaced mock.AsyncMock with unittest.mock.AsyncMock
tests/middlewares/test_simple_retry.py Replaced mock.AsyncMock with unittest.mock.AsyncMock
tests/conftest.py Replaced pytest_mock.MockerFixture with unittest.mock.patch and updated fixture to use context manager
tests/serializers/test_serializers.py Replaced pytz.UTC with datetime.timezone.utc
tests/scheduler/test_label_based_sched.py Replaced pytz.UTC with datetime.timezone.utc
tests/cli/scheduler/test_task_delays.py Replaced pytz and tzlocal with datetime.timezone and zoneinfo.ZoneInfo
taskiq/cli/scheduler/run.py Replaced pytz with datetime.timezone and zoneinfo.ZoneInfo
taskiq/cli/watcher.py Added !r formatting for better path representation in error message
taskiq/main.py Replaced importlib_metadata with importlib.metadata
taskiq/compat.py Replaced importlib_metadata with importlib.metadata, added type ignore comment
taskiq/task.py Replaced typing_extensions.TypeVar with typing.TypeVar
taskiq/serialization.py Moved Protocol, TypeVar, runtime_checkable from typing_extensions to typing
taskiq/scheduler/scheduled_task/v2.py Added conditional import for Self (Python 3.11+ from typing, else from typing_extensions)
taskiq/result/result.py Added conditional import for Self (Python 3.11+ from typing, else from typing_extensions)
taskiq/kicker.py Added conditional import for ParamSpec (Python 3.10+ from typing, else from typing_extensions)
taskiq/depends/progress_tracker.py Replaced typing_extensions.TypeVar with typing.TypeVar
taskiq/decor.py Added conditional import for ParamSpec, removed ellipsis from separate lines in overload methods
taskiq/brokers/shared_broker.py Added conditional import for ParamSpec (Python 3.10+ from typing, else from typing_extensions)
taskiq/abc/broker.py Added conditional imports for ParamSpec, Self, TypeAlias based on Python version

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

@danfimov danfimov marked this pull request as draft November 4, 2025 13:47
@danfimov danfimov marked this pull request as ready for review November 4, 2025 14:03
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