Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: redis/redis-py
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.4.1
Choose a base ref
...
head repository: redis/redis-py
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: refs/heads/master
Choose a head ref
Loading
Showing 303 changed files with 42,479 additions and 14,690 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
**/__pycache__
**/*.pyc
.tox
.coverage
.coverage.*
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
doctests/* @dmaier-redislabs
3 changes: 1 addition & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -2,12 +2,11 @@

_Please make sure to review and check all of these items:_

- [ ] Does `$ tox` pass with this change (including linting)?
- [ ] Do tests and lints pass with this change?
- [ ] Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
- [ ] Is the new or changed code fully tested?
- [ ] Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
- [ ] Is there an example added to the examples folder (if applicable)?
- [ ] Was the change added to CHANGES file?

_NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open._
162 changes: 162 additions & 0 deletions .github/actions/run-tests/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
name: 'Run redis-py tests'
description: 'Runs redis-py tests against different Redis versions and configurations'
inputs:
python-version:
description: 'Python version to use for running tests'
default: '3.12'
parser-backend:
description: 'Parser backend to use: plain or hiredis'
required: true
redis-version:
description: 'Redis version to test against'
required: true
hiredis-version:
description: 'hiredis version to test against'
required: false
default: '>3.0.0'
hiredis-branch:
description: 'hiredis branch to test against'
required: false
default: 'master'
event-loop:
description: 'Event loop to use'
required: false
default: 'asyncio'
runs:
using: "composite"
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
cache: 'pip'

- uses: actions/checkout@v4
if: ${{ inputs.parser-backend == 'hiredis' && inputs.hiredis-version == 'unstable' }}
with:
repository: redis/hiredis-py
submodules: true
path: hiredis-py
ref: ${{ inputs.hiredis-branch }}

- name: Setup Test environment
env:
REDIS_VERSION: ${{ inputs.redis-version }}
CLIENT_LIBS_TEST_IMAGE_TAG: ${{ inputs.redis-version }}
run: |
set -e
echo "::group::Installing dependencies"
pip install -r dev_requirements.txt
pip uninstall -y redis # uninstall Redis package installed via redis-entraid
pip install -e .[jwt] # install the working copy
if [ "${{inputs.parser-backend}}" == "hiredis" ]; then
if [[ "${{inputs.hiredis-version}}" == "unstable" ]]; then
echo "Installing unstable version of hiredis from local directory"
pip install -e ./hiredis-py
else
pip install "hiredis${{inputs.hiredis-version}}"
fi
echo "PARSER_BACKEND=$(echo "${{inputs.parser-backend}}_${{inputs.hiredis-version}}" | sed 's/[^a-zA-Z0-9]/_/g')" >> $GITHUB_ENV
else
echo "PARSER_BACKEND=${{inputs.parser-backend}}" >> $GITHUB_ENV
fi
echo "::endgroup::"
echo "::group::Starting Redis servers"
redis_major_version=$(echo "$REDIS_VERSION" | grep -oP '^\d+')
echo "REDIS_MAJOR_VERSION=${redis_major_version}" >> $GITHUB_ENV
if (( redis_major_version < 8 )); then
echo "Using redis-stack for module tests"
# Mapping of redis version to stack version
declare -A redis_stack_version_mapping=(
["7.4.4"]="rs-7.4.0-v5"
["7.2.9"]="rs-7.2.0-v17"
)
if [[ -v redis_stack_version_mapping[$REDIS_VERSION] ]]; then
export CLIENT_LIBS_TEST_STACK_IMAGE_TAG=${redis_stack_version_mapping[$REDIS_VERSION]}
echo "REDIS_MOD_URL=redis://127.0.0.1:6479/0" >> $GITHUB_ENV
else
echo "Version not found in the mapping."
exit 1
fi
if (( redis_major_version < 7 )); then
export REDIS_STACK_EXTRA_ARGS="--tls-auth-clients optional --save ''"
export REDIS_EXTRA_ARGS="--tls-auth-clients optional --save ''"
fi
invoke devenv --endpoints=all-stack
else
echo "Using redis CE for module tests"
export CLIENT_LIBS_TEST_STACK_IMAGE_TAG=$REDIS_VERSION
echo "REDIS_MOD_URL=redis://127.0.0.1:6379" >> $GITHUB_ENV
invoke devenv --endpoints all
fi
sleep 10 # time to settle
echo "::endgroup::"
shell: bash

- name: Run tests
run: |
set -e
run_tests() {
local protocol=$1
local eventloop=""
if [ "${{inputs.event-loop}}" == "uvloop" ]; then
eventloop="--uvloop"
fi
echo "::group::RESP${protocol} standalone tests"
echo "REDIS_MOD_URL=${REDIS_MOD_URL}"
if (( $REDIS_MAJOR_VERSION < 7 )) && [ "$protocol" == "3" ]; then
echo "Skipping module tests: Modules doesn't support RESP3 for Redis versions < 7"
invoke standalone-tests --redis-mod-url=${REDIS_MOD_URL} $eventloop --protocol="${protocol}" --extra-markers="not redismod and not cp_integration"
else
invoke standalone-tests --redis-mod-url=${REDIS_MOD_URL} $eventloop --protocol="${protocol}"
fi
echo "::endgroup::"
echo "::group::RESP${protocol} cluster tests"
invoke cluster-tests $eventloop --protocol=${protocol}
echo "::endgroup::"
}
run_tests 2 "${{inputs.event-loop}}"
run_tests 3 "${{inputs.event-loop}}"
shell: bash

- name: Debug
if: failure()
run: |
sudo apt-get install -y redis-tools
echo "Docker Containers:"
docker ps
redis-cli -p 16379 CLUSTER NODES
shell: bash

- name: Upload test results and profiling data
uses: actions/upload-artifact@v4
with:
name: pytest-results-redis_${{inputs.redis-version}}-python_${{inputs.python-version}}-parser_${{env.PARSER_BACKEND}}-el_${{inputs.event-loop}}
path: |
*-results.xml
prof/**
profile_output*
if-no-files-found: error
retention-days: 10

- name: Upload codecov coverage
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
labels:
- "maintenance"
schedule:
interval: "monthly"
11 changes: 9 additions & 2 deletions .github/release-drafter-config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name-template: '$NEXT_MINOR_VERSION'
tag-template: 'v$NEXT_MINOR_VERSION'
filter-by-commitish: true
commitish: master
autolabeler:
- label: 'maintenance'
files:
@@ -15,7 +17,7 @@ autolabeler:
branch:
- '/feature-.+'
categories:
- title: 'Breaking Changes'
- title: '🔥 Breaking Changes'
labels:
- 'breakingchange'
- title: '🧪 Experimental Features'
@@ -32,7 +34,12 @@ categories:
- 'bug'
- 'BUG'
- title: '🧰 Maintenance'
label: 'maintenance'
labels:
- 'maintenance'
- 'dependencies'
- 'documentation'
- 'docs'
- 'testing'
change-template: '- $TITLE (#$NUMBER)'
exclude-labels:
- 'skip-changelog'
29 changes: 29 additions & 0 deletions .github/spellcheck-settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
matrix:
- name: Markdown
expect_match: false
apsell:
lang: en
d: en_US
ignore-case: true
dictionary:
wordlists:
- .github/wordlist.txt
output: wordlist.dic
pipeline:
- pyspelling.filters.markdown:
markdown_extensions:
- markdown.extensions.extra:
- pyspelling.filters.html:
comments: false
attributes:
- alt
ignores:
- ':matches(code, pre)'
- code
- pre
- blockquote
- img
sources:
- '*.md'
- 'docs/*.rst'
- 'docs/*.ipynb'
144 changes: 144 additions & 0 deletions .github/wordlist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
APM
ARGV
BFCommands
CacheImpl
CAS
CFCommands
CMSCommands
ClusterNode
ClusterNodes
ClusterPipeline
ClusterPubSub
ConnectionPool
CoreCommands
EVAL
EVALSHA
Grokzen's
INCR
IOError
Instrumentations
JSONCommands
Jaeger
Ludovico
Magnocavallo
McCurdy
NOSCRIPT
NUMPAT
NUMPT
NUMSUB
OSS
OpenCensus
OpenTelemetry
OpenTracing
Otel
PubSub
READONLY
RediSearch
RedisBloom
RedisCluster
RedisClusterCommands
RedisClusterException
RedisClusters
RedisInstrumentor
RedisJSON
RedisTimeSeries
SHA
SearchCommands
SentinelCommands
SentinelConnectionPool
Sharded
Solovyov
SpanKind
Specfiying
StatusCode
TCP
TOPKCommands
TimeSeriesCommands
Uptrace
ValueError
WATCHed
WatchError
api
args
async
asyncio
autoclass
automodule
backoff
bdb
behaviour
bool
boolean
booleans
bysource
charset
del
dev
docstring
docstrings
eg
exc
firsttimersonly
fo
genindex
gmail
hiredis
http
idx
iff
ini
json
keyslot
keyspace
kwarg
linters
localhost
lua
makeapullrequest
maxdepth
mget
microservice
microservices
mset
multikey
mykey
nonatomic
observability
opentelemetry
oss
performant
pmessage
png
pre
psubscribe
pubsub
punsubscribe
py
pypi
quickstart
readonly
readwrite
redis
redismodules
reinitialization
replicaof
repo
runtime
sedrik
sharded
ssl
str
stunnel
subcommands
thevalueofmykey
timeseries
toctree
topk
triaging
txt
un
unicode
url
virtualenv
www
yaml
Loading