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

Switch to PEP 517 packaging using hatchling #2930

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions .github/actions/run-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ runs:
pip install -U setuptools wheel
pip install -r requirements.txt
pip install -r dev_requirements.txt
pip uninstall -y redis # uninstall Redis package installed via redis-entraid
pip install -e . # install the working copy
if [ "${{inputs.parser-backend}}" == "hiredis" ]; then
pip install "hiredis${{inputs.hiredis-version}}"
echo "PARSER_BACKEND=$(echo "${{inputs.parser-backend}}_${{inputs.hiredis-version}}" | sed 's/[^a-zA-Z0-9]/_/g')" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
sudo apt-get install -yqq pandoc make
- name: run code linters
run: |
pip install -r requirements.txt -r dev_requirements.txt -r docs/requirements.txt
pip install -r dev_requirements.txt -r docs/requirements.txt
invoke build-docs

- name: upload docs
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/install_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ python -m venv ${DESTENV}
source ${DESTENV}/bin/activate
pip install --upgrade --quiet pip
pip install --quiet -r dev_requirements.txt
pip uninstall -y redis # uninstall Redis package installed via redis-entraid
invoke devenv --endpoints=all-stack
invoke package

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ jobs:
- name: run code linters
run: |
pip install -r dev_requirements.txt
pip uninstall -y redis # uninstall Redis package installed via redis-entraid
invoke linters

redis_version:
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/pypi-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ jobs:
- name: Install dev tools
run: |
pip install -r dev_requirements.txt
pip install twine wheel
pip uninstall -y redis # uninstall Redis package installed via redis-entraid
pip install build twine wheel

- name: Build package
run: |
python setup.py build
python setup.py sdist bdist_wheel
run: python -m build .

- name: Basic package test prior to upload
run: |
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Here's how to get started with your code contribution:
a. python -m venv .venv
b. source .venv/bin/activate
c. pip install -r dev_requirements.txt
c. pip install -r requirements.txt
c. pip install -e .

4. If you need a development environment, run `invoke devenv`. Note: this relies on docker-compose to build environments, and assumes that you have a version supporting [docker profiles](https://docs.docker.com/compose/profiles/).
5. While developing, make sure the tests pass by running `invoke tests`
Expand Down
6 changes: 0 additions & 6 deletions INSTALL

This file was deleted.

8 changes: 0 additions & 8 deletions MANIFEST.in

This file was deleted.

2 changes: 1 addition & 1 deletion docs/examples/opentelemetry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ source .venv/bin/active
**Step 3**. Install dependencies:

```shell
pip install -r requirements.txt
pip install -e .
```

**Step 4**. Start the services using Docker and make sure Uptrace is running:
Expand Down
65 changes: 65 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "redis"
dynamic = ["version"]
description = "Python client for Redis database and key-value store"
readme = "README.md"
license = "MIT"
requires-python = ">=3.8"
authors = [
{ name = "Redis Inc.", email = "[email protected]" },
]
keywords = [
"Redis",
"database",
"key-value-store",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Programming Language :: Python",
]
dependencies = [
'async-timeout>=4.0.3; python_full_version<"3.11.3"',
"PyJWT~=2.9.0",
]

[project.optional-dependencies]
hiredis = [
"hiredis>=3.0.0",
]
ocsp = [
"cryptography>=36.0.1",
"pyopenssl==20.0.1",
"requests>=2.31.0",
]

[project.urls]
Changes = "https://github.com/redis/redis-py/releases"
Code = "https://github.com/redis/redis-py"
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",
]
13 changes: 2 additions & 11 deletions redis/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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.2.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",
Expand Down
65 changes: 0 additions & 65 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ def clean(c):
@task
def package(c):
"""Create the python packages"""
run("python setup.py sdist bdist_wheel")
run("python -m build .")
Loading