Skip to content

Commit 2c9af66

Browse files
authored
Merge branch 'master' into fix-async-client-safety
2 parents a12aff3 + 67ab74d commit 2c9af66

File tree

159 files changed

+12139
-5819
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+12139
-5819
lines changed

.flake8

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ _Please make sure to review and check all of these items:_
77
- [ ] Is the new or changed code fully tested?
88
- [ ] Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
99
- [ ] Is there an example added to the examples folder (if applicable)?
10-
- [ ] Was the change added to CHANGES file?
1110

1211
_NOTE: these things are not required to open a PR and can be done
1312
afterwards / while the PR is open._

.github/actions/run-tests/action.yml

Lines changed: 47 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ inputs:
1414
description: 'hiredis version to test against'
1515
required: false
1616
default: '>3.0.0'
17+
hiredis-branch:
18+
description: 'hiredis branch to test against'
19+
required: false
20+
default: 'master'
1721
event-loop:
1822
description: 'Event loop to use'
1923
required: false
@@ -28,94 +32,106 @@ runs:
2832
python-version: ${{ inputs.python-version }}
2933
cache: 'pip'
3034

35+
- uses: actions/checkout@v4
36+
if: ${{ inputs.parser-backend == 'hiredis' && inputs.hiredis-version == 'unstable' }}
37+
with:
38+
repository: redis/hiredis-py
39+
submodules: true
40+
path: hiredis-py
41+
ref: ${{ inputs.hiredis-branch }}
42+
3143
- name: Setup Test environment
3244
env:
3345
REDIS_VERSION: ${{ inputs.redis-version }}
3446
CLIENT_LIBS_TEST_IMAGE_TAG: ${{ inputs.redis-version }}
3547
run: |
3648
set -e
37-
49+
3850
echo "::group::Installing dependencies"
39-
pip install -U setuptools wheel
40-
pip install -r requirements.txt
4151
pip install -r dev_requirements.txt
52+
pip uninstall -y redis # uninstall Redis package installed via redis-entraid
53+
pip install -e .[jwt] # install the working copy
4254
if [ "${{inputs.parser-backend}}" == "hiredis" ]; then
43-
pip install "hiredis${{inputs.hiredis-version}}"
44-
echo "PARSER_BACKEND=$(echo "${{inputs.parser-backend}}_${{inputs.hiredis-version}}" | sed 's/[^a-zA-Z0-9]/_/g')" >> $GITHUB_ENV
55+
if [[ "${{inputs.hiredis-version}}" == "unstable" ]]; then
56+
echo "Installing unstable version of hiredis from local directory"
57+
pip install -e ./hiredis-py
58+
else
59+
pip install "hiredis${{inputs.hiredis-version}}"
60+
fi
61+
echo "PARSER_BACKEND=$(echo "${{inputs.parser-backend}}_${{inputs.hiredis-version}}" | sed 's/[^a-zA-Z0-9]/_/g')" >> $GITHUB_ENV
4562
else
4663
echo "PARSER_BACKEND=${{inputs.parser-backend}}" >> $GITHUB_ENV
4764
fi
4865
echo "::endgroup::"
49-
66+
5067
echo "::group::Starting Redis servers"
5168
redis_major_version=$(echo "$REDIS_VERSION" | grep -oP '^\d+')
52-
69+
echo "REDIS_MAJOR_VERSION=${redis_major_version}" >> $GITHUB_ENV
70+
5371
if (( redis_major_version < 8 )); then
5472
echo "Using redis-stack for module tests"
55-
56-
# Mapping of redis version to stack version
73+
74+
# Mapping of redis version to stack version
5775
declare -A redis_stack_version_mapping=(
58-
["7.4.2"]="rs-7.4.0-v2"
59-
["7.2.7"]="rs-7.2.0-v14"
60-
["6.2.17"]="rs-6.2.6-v18"
76+
["7.4.4"]="rs-7.4.0-v5"
77+
["7.2.9"]="rs-7.2.0-v17"
6178
)
62-
79+
6380
if [[ -v redis_stack_version_mapping[$REDIS_VERSION] ]]; then
6481
export CLIENT_LIBS_TEST_STACK_IMAGE_TAG=${redis_stack_version_mapping[$REDIS_VERSION]}
6582
echo "REDIS_MOD_URL=redis://127.0.0.1:6479/0" >> $GITHUB_ENV
6683
else
6784
echo "Version not found in the mapping."
6885
exit 1
6986
fi
70-
87+
7188
if (( redis_major_version < 7 )); then
7289
export REDIS_STACK_EXTRA_ARGS="--tls-auth-clients optional --save ''"
7390
export REDIS_EXTRA_ARGS="--tls-auth-clients optional --save ''"
74-
echo "REDIS_MAJOR_VERSION=${redis_major_version}" >> $GITHUB_ENV
7591
fi
76-
92+
7793
invoke devenv --endpoints=all-stack
94+
7895
else
7996
echo "Using redis CE for module tests"
97+
export CLIENT_LIBS_TEST_STACK_IMAGE_TAG=$REDIS_VERSION
8098
echo "REDIS_MOD_URL=redis://127.0.0.1:6379" >> $GITHUB_ENV
8199
invoke devenv --endpoints all
82-
fi
83-
100+
fi
101+
84102
sleep 10 # time to settle
85103
echo "::endgroup::"
86104
shell: bash
87105

88106
- name: Run tests
89107
run: |
90108
set -e
91-
109+
92110
run_tests() {
93111
local protocol=$1
94112
local eventloop=""
95-
113+
96114
if [ "${{inputs.event-loop}}" == "uvloop" ]; then
97115
eventloop="--uvloop"
98116
fi
99-
117+
100118
echo "::group::RESP${protocol} standalone tests"
101119
echo "REDIS_MOD_URL=${REDIS_MOD_URL}"
102-
120+
103121
if (( $REDIS_MAJOR_VERSION < 7 )) && [ "$protocol" == "3" ]; then
104122
echo "Skipping module tests: Modules doesn't support RESP3 for Redis versions < 7"
105123
invoke standalone-tests --redis-mod-url=${REDIS_MOD_URL} $eventloop --protocol="${protocol}" --extra-markers="not redismod and not cp_integration"
106-
else
124+
else
107125
invoke standalone-tests --redis-mod-url=${REDIS_MOD_URL} $eventloop --protocol="${protocol}"
108126
fi
109-
127+
128+
echo "::endgroup::"
129+
130+
echo "::group::RESP${protocol} cluster tests"
131+
invoke cluster-tests $eventloop --protocol=${protocol}
110132
echo "::endgroup::"
111-
112-
if [ "$protocol" == "2" ] || [ "${{inputs.parser-backend}}" != 'hiredis' ]; then
113-
echo "::group::RESP${protocol} cluster tests"
114-
invoke cluster-tests $eventloop --protocol=${protocol}
115-
echo "::endgroup::"
116-
fi
117133
}
118-
134+
119135
run_tests 2 "${{inputs.event-loop}}"
120136
run_tests 3 "${{inputs.event-loop}}"
121137
shell: bash

.github/wordlist.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ APM
22
ARGV
33
BFCommands
44
CacheImpl
5+
CAS
56
CFCommands
67
CMSCommands
78
ClusterNode
@@ -12,7 +13,6 @@ ConnectionPool
1213
CoreCommands
1314
EVAL
1415
EVALSHA
15-
GraphCommands
1616
Grokzen's
1717
INCR
1818
IOError
@@ -39,7 +39,6 @@ RedisCluster
3939
RedisClusterCommands
4040
RedisClusterException
4141
RedisClusters
42-
RedisGraph
4342
RedisInstrumentor
4443
RedisJSON
4544
RedisTimeSeries

.github/workflows/docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
sudo apt-get install -yqq pandoc make
3737
- name: run code linters
3838
run: |
39-
pip install -r requirements.txt -r dev_requirements.txt -r docs/requirements.txt
39+
pip install -r dev_requirements.txt -r docs/requirements.txt
4040
invoke build-docs
4141
4242
- name: upload docs
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Hiredis-py integration tests
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
redis-py-branch:
7+
description: 'redis-py branch to run tests on'
8+
required: true
9+
default: 'master'
10+
hiredis-branch:
11+
description: 'hiredis-py branch to run tests on'
12+
required: true
13+
default: 'master'
14+
15+
concurrency:
16+
group: ${{ github.event.pull_request.number || github.ref }}-hiredis-integration
17+
cancel-in-progress: true
18+
19+
permissions:
20+
contents: read # to fetch code (actions/checkout)
21+
22+
env:
23+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
24+
# this speeds up coverage with Python 3.12: https://github.com/nedbat/coveragepy/issues/1665
25+
COVERAGE_CORE: sysmon
26+
CURRENT_CLIENT_LIBS_TEST_STACK_IMAGE_TAG: '8.0.2'
27+
CURRENT_REDIS_VERSION: '8.0.2'
28+
29+
jobs:
30+
redis_version:
31+
runs-on: ubuntu-latest
32+
outputs:
33+
CURRENT: ${{ env.CURRENT_REDIS_VERSION }}
34+
steps:
35+
- name: Compute outputs
36+
run: |
37+
echo "CURRENT=${{ env.CURRENT_REDIS_VERSION }}" >> $GITHUB_OUTPUT
38+
39+
hiredis-tests:
40+
runs-on: ubuntu-latest
41+
needs: [redis_version]
42+
timeout-minutes: 60
43+
strategy:
44+
max-parallel: 15
45+
fail-fast: false
46+
matrix:
47+
redis-version: [ '${{ needs.redis_version.outputs.CURRENT }}' ]
48+
python-version: [ '3.9', '3.13']
49+
parser-backend: [ 'hiredis' ]
50+
hiredis-version: [ 'unstable' ]
51+
event-loop: [ 'asyncio' ]
52+
env:
53+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
54+
name: Redis ${{ matrix.redis-version }}; Python ${{ matrix.python-version }}; RESP Parser:${{matrix.parser-backend}} (${{ matrix.hiredis-version }}); EL:${{matrix.event-loop}}
55+
steps:
56+
- uses: actions/checkout@v4
57+
with:
58+
ref: ${{ inputs.redis-py-branch }}
59+
- name: Run tests
60+
uses: ./.github/actions/run-tests
61+
with:
62+
python-version: ${{ matrix.python-version }}
63+
parser-backend: ${{ matrix.parser-backend }}
64+
redis-version: ${{ matrix.redis-version }}
65+
hiredis-version: ${{ matrix.hiredis-version }}
66+
hiredis-branch: ${{ inputs.hiredis-branch }}

.github/workflows/install_and_test.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ python -m venv ${DESTENV}
2121
source ${DESTENV}/bin/activate
2222
pip install --upgrade --quiet pip
2323
pip install --quiet -r dev_requirements.txt
24+
pip uninstall -y redis # uninstall Redis package installed via redis-entraid
2425
invoke devenv --endpoints=all-stack
2526
invoke package
2627

@@ -39,9 +40,9 @@ cd ${TESTDIR}
3940
# install, run tests
4041
pip install ${PKG}
4142
# Redis tests
42-
pytest -m 'not onlycluster and not graph'
43+
pytest -m 'not onlycluster'
4344
# RedisCluster tests
4445
CLUSTER_URL="redis://localhost:16379/0"
4546
CLUSTER_SSL_URL="rediss://localhost:27379/0"
46-
pytest -m 'not onlynoncluster and not redismod and not ssl and not graph' \
47+
pytest -m 'not onlynoncluster and not redismod and not ssl' \
4748
--redis-url="${CLUSTER_URL}" --redis-ssl-url="${CLUSTER_SSL_URL}"

.github/workflows/integration.yaml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ env:
2727
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2828
# this speeds up coverage with Python 3.12: https://github.com/nedbat/coveragepy/issues/1665
2929
COVERAGE_CORE: sysmon
30-
CURRENT_CLIENT_LIBS_TEST_STACK_IMAGE_TAG: 'rs-7.4.0-v2'
31-
CURRENT_REDIS_VERSION: '7.4.2'
30+
CURRENT_CLIENT_LIBS_TEST_STACK_IMAGE_TAG: '8.0.2'
31+
CURRENT_REDIS_VERSION: '8.0.2'
3232

3333
jobs:
3434
dependency-audit:
@@ -38,7 +38,7 @@ jobs:
3838
- uses: actions/checkout@v4
3939
- uses: pypa/[email protected]
4040
with:
41-
inputs: requirements.txt dev_requirements.txt
41+
inputs: dev_requirements.txt
4242
ignore-vulns: |
4343
GHSA-w596-4wvx-j9j6 # subversion related git pull, dependency for pytest. There is no impact here.
4444
@@ -54,6 +54,7 @@ jobs:
5454
- name: run code linters
5555
run: |
5656
pip install -r dev_requirements.txt
57+
pip uninstall -y redis # uninstall Redis package installed via redis-entraid
5758
invoke linters
5859
5960
redis_version:
@@ -73,8 +74,8 @@ jobs:
7374
max-parallel: 15
7475
fail-fast: false
7576
matrix:
76-
redis-version: ['8.0-M04-pre', '${{ needs.redis_version.outputs.CURRENT }}', '7.2.7', '6.2.17']
77-
python-version: ['3.8', '3.13']
77+
redis-version: ['8.2-RC1-pre', '${{ needs.redis_version.outputs.CURRENT }}', '7.4.4', '7.2.9']
78+
python-version: ['3.9', '3.13']
7879
parser-backend: ['plain']
7980
event-loop: ['asyncio']
8081
env:
@@ -122,9 +123,9 @@ jobs:
122123
fail-fast: false
123124
matrix:
124125
redis-version: [ '${{ needs.redis_version.outputs.CURRENT }}' ]
125-
python-version: [ '3.8', '3.13']
126+
python-version: [ '3.9', '3.13']
126127
parser-backend: [ 'hiredis' ]
127-
hiredis-version: [ '>=3.0.0', '<3.0.0' ]
128+
hiredis-version: [ '>=3.2.0', '<3.0.0' ]
128129
event-loop: [ 'asyncio' ]
129130
env:
130131
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
@@ -148,7 +149,7 @@ jobs:
148149
fail-fast: false
149150
matrix:
150151
redis-version: [ '${{ needs.redis_version.outputs.CURRENT }}' ]
151-
python-version: [ '3.8', '3.13' ]
152+
python-version: [ '3.9', '3.13' ]
152153
parser-backend: [ 'plain' ]
153154
event-loop: [ 'uvloop' ]
154155
env:
@@ -190,7 +191,7 @@ jobs:
190191
strategy:
191192
fail-fast: false
192193
matrix:
193-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10']
194+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10']
194195
steps:
195196
- uses: actions/checkout@v4
196197
- uses: actions/setup-python@v5

.github/workflows/pypi-publish.yaml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,10 @@ jobs:
1818
uses: actions/setup-python@v5
1919
with:
2020
python-version: 3.9
21-
- name: Install dev tools
22-
run: |
23-
pip install -r dev_requirements.txt
24-
pip install twine wheel
21+
- run: pip install build twine
2522

2623
- name: Build package
27-
run: |
28-
python setup.py build
29-
python setup.py sdist bdist_wheel
24+
run: python -m build .
3025

3126
- name: Basic package test prior to upload
3227
run: |

0 commit comments

Comments
 (0)