diff --git a/pyproject.toml b/pyproject.toml index 7d3e560636..2e536aab15 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "redis" -version = "5.1.0b7" +dynamic = ["version"] description = "Python client for Redis database and key-value store" readme = "README.md" license = "MIT" @@ -55,6 +55,9 @@ Documentation = "https://redis.readthedocs.io/en/latest/" Homepage = "https://github.com/redis/redis-py" "Issue tracker" = "https://github.com/redis/redis-py/issues" +[tool.hatch.version] +path = "redis/__init__.py" + [tool.hatch.build.targets.sdist] include = [ "/redis", diff --git a/redis/__init__.py b/redis/__init__.py index 94324a0de8..a713c4c24d 100644 --- a/redis/__init__.py +++ b/redis/__init__.py @@ -1,5 +1,3 @@ -from importlib import metadata - from redis import asyncio # noqa from redis.backoff import default_backoff from redis.client import Redis, StrictRedis @@ -44,16 +42,9 @@ def int_or_str(value): return value -try: - __version__ = metadata.version("redis") -except metadata.PackageNotFoundError: - __version__ = "99.99.99" - +__version__ = "5.1.0b7" +VERSION = tuple(map(int_or_str, __version__.split("."))) -try: - VERSION = tuple(map(int_or_str, __version__.split("."))) -except AttributeError: - VERSION = tuple([99, 99, 99]) __all__ = [ "AuthenticationError",