Skip to content
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

Single sourcing the package version #1791

Merged
merged 2 commits into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion redis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
import sys

if sys.version_info >= (3, 8):
from importlib import metadata
else:
import importlib_metadata as metadata

from redis.client import Redis, StrictRedis
from redis.cluster import RedisCluster
from redis.connection import (
Expand Down Expand Up @@ -38,7 +45,10 @@ def int_or_str(value):
return value


__version__ = "4.1.0rc2"
try:
__version__ = metadata.version("redis")
except metadata.PackageNotFoundError:
__version__ = "99.99.99"


VERSION = tuple(map(int_or_str, __version__.split(".")))
Expand Down
8 changes: 2 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
#!/usr/bin/env python
from setuptools import find_packages, setup

import redis

setup(
name="redis",
description="Python client for Redis database and key-value store",
long_description=open("README.md").read().strip(),
long_description_content_type="text/markdown",
keywords=["Redis", "key-value store", "database"],
license="MIT",
version=redis.__version__,
version="4.1.0rc2",
packages=find_packages(
include=[
"redis",
Expand All @@ -26,12 +24,10 @@
author="Redis Inc.",
author_email="oss@redis.com",
python_requires=">=3.6",
setup_requires=[
"packaging>=21.3",
],
install_requires=[
"deprecated>=1.2.3",
"packaging>=21.3",
'importlib-metadata >= 1.0; python_version < "3.8"',
],
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down