-
-
Notifications
You must be signed in to change notification settings - Fork 94
feat: remove extra dependencies #533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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.
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.