From b0fe33b7351748d6b20d965d81762c63feb0cbc8 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Tue, 27 Aug 2024 12:26:37 +0300 Subject: [PATCH] Use a single source of truth for version info --- pyproject.toml | 7 +++++-- redis/__init__.py | 13 ++----------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7d3e560636..f02473362b 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" @@ -26,7 +26,7 @@ classifiers = [ "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9",x + "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", @@ -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..f68eb8969a 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.1" +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",