feat: remove extra dependencies#533
Merged
s3rius merged 10 commits intotaskiq-python:masterfrom Nov 14, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
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.
s3rius
approved these changes
Nov 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Removed libraries
pytz (and types-pytz)
Can be replaced with:
datetime.timezone.utc(instead ofpytz.utc).For tests on Windows I added
tzdatabecausezoneinfodoesn'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.metadatafunctionallity in old python versions. Since this project is using this livrary only for getting version of pydantic library, it can be replaced with built-inmportlibpackage.mock (and types-mock)
This package is a part of standard library since python 3.3 and can be called
import unittest.mockinstead ofimport mock.pytest-mock
This project is using this package only in one place to get
mocker fixture. So it can be replaced withpatchfunction fromunittest.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_extensionmigrate totypingpackage. 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.