Skip to content

Commit 4dbdd76

Browse files
committed
Use a single source of truth for version info
1 parent cc39d30 commit 4dbdd76

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

Diff for: pyproject.toml

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "redis"
7-
version = "5.1.0b7"
7+
dynamic = ["version"]
88
description = "Python client for Redis database and key-value store"
99
readme = "README.md"
1010
license = "MIT"
@@ -26,7 +26,7 @@ classifiers = [
2626
"Programming Language :: Python :: 3 :: Only",
2727
"Programming Language :: Python :: 3",
2828
"Programming Language :: Python :: 3.8",
29-
"Programming Language :: Python :: 3.9",x
29+
"Programming Language :: Python :: 3.9",
3030
"Programming Language :: Python :: 3.10",
3131
"Programming Language :: Python :: 3.11",
3232
"Programming Language :: Python :: 3.12",
@@ -55,6 +55,9 @@ Documentation = "https://redis.readthedocs.io/en/latest/"
5555
Homepage = "https://github.com/redis/redis-py"
5656
"Issue tracker" = "https://github.com/redis/redis-py/issues"
5757

58+
[tool.hatch.version]
59+
path = "redis/__init__.py"
60+
5861
[tool.hatch.build.targets.sdist]
5962
include = [
6063
"/redis",

Diff for: redis/__init__.py

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from importlib import metadata
2-
31
from redis import asyncio # noqa
42
from redis.backoff import default_backoff
53
from redis.client import Redis, StrictRedis
@@ -44,16 +42,9 @@ def int_or_str(value):
4442
return value
4543

4644

47-
try:
48-
__version__ = metadata.version("redis")
49-
except metadata.PackageNotFoundError:
50-
__version__ = "99.99.99"
51-
45+
__version__ = "5.1.0b7"
46+
VERSION = tuple(map(int_or_str, __version__.split(".")))
5247

53-
try:
54-
VERSION = tuple(map(int_or_str, __version__.split(".")))
55-
except AttributeError:
56-
VERSION = tuple([99, 99, 99])
5748

5849
__all__ = [
5950
"AuthenticationError",

0 commit comments

Comments
 (0)