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

Cherry pick for v5.0.2 #3159

Merged
merged 48 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
db03189
Bump actions/checkout from 3 to 4 (#2969)
dependabot[bot] Oct 5, 2023
e7cc3bb
Bump rojopolis/spellcheck-github-actions from 0.33.1 to 0.34.0 (#2970)
dependabot[bot] Oct 5, 2023
0172ded
fix type hint (#2963)
d184230 Oct 9, 2023
565171c
Don't perform blocking connect inside the BlockingConnectionQueue Con…
kristjanvalur Oct 11, 2023
697da37
Creating CODEOWNERS for the examples (#2993)
chayim Oct 11, 2023
9970fb4
Close various objects created during asyncio tests (#3005)
kristjanvalur Oct 16, 2023
194d710
Linking to Redis resources (#3006)
chayim Oct 16, 2023
b5e8e55
Add GEOSHAPE field type for index creation of RediSearch (#2957)
sjpotter Oct 16, 2023
30c1686
Better deal with "lost" connections for async Redis (#2999)
kristjanvalur Oct 16, 2023
63239fa
Update client.py sleep_time typing for run_in_thread function (#2977)
danielzhangau Oct 16, 2023
e2127e4
Fix BlockingConnectionPool.from_url parsing of timeout in query args …
r0ro Nov 13, 2023
45e858a
Fix parsing resp3 dicts (#2982)
kristjanvalur Nov 13, 2023
63b562f
Update ocsp.py (#3022)
AniketP04 Nov 29, 2023
a9306e3
Bump rojopolis/spellcheck-github-actions from 0.34.0 to 0.35.0 (#3060)
dependabot[bot] Dec 3, 2023
9402c30
Use `disable_decoding` in async `read_response`. (#3042)
MrDenkoV Dec 3, 2023
ab82697
Add "sum" to DUPLICATE_POLICY documentation of TS.CREATE, TS.ADD and …
Pedram-Parsian Dec 3, 2023
f2fa734
Update advanced_features.rst (#3019)
BackflipPenguin Dec 3, 2023
c1a881e
Fix typos. (#3016)
AYMENJD Dec 3, 2023
7c13191
Fix parsing of `FT.PROFILE` result (#3063)
dvora-h Dec 4, 2023
3f4f5e3
Make the connection callback methods public again, add documentation …
kristjanvalur Dec 11, 2023
f29a7d7
Fix reported version of deprecations in asyncio.client (#2968)
zware Dec 11, 2023
7573448
Allow the parsing of the asking command to forward original options (…
tbbream Dec 11, 2023
b7dbb7e
Fix Specifying Target Nodes broken hyperlink (#3072)
enjoy-binbin Dec 11, 2023
ce6d7b4
Fix return types in json commands (#3071)
parmenashp Dec 11, 2023
6116c38
fix acl_genpass with bits (#3062)
dvora-h Jan 1, 2024
d9d3054
Bump github/codeql-action from 2 to 3 (#3096)
dependabot[bot] Jan 2, 2024
4f8c7d2
Bump actions/upload-artifact from 3 to 4 (#3097)
dependabot[bot] Jan 2, 2024
8f45068
Bump actions/setup-python from 4 to 5 (#3095)
dependabot[bot] Jan 2, 2024
813187e
Always sending codecov (#3101)
chayim Jan 9, 2024
5c94a95
filter commits for main branch (#3036)
chayim Jan 9, 2024
7b1965a
fix(docs): organize cluster mode part of lua scripting (#3073)
mattwang44 Jan 9, 2024
d63ba59
Fix typing for `HashCommand.hdel` (#3029)
dmkulazhenko Jan 9, 2024
33450d9
Adding lock_name to LockError (#3023)
TheBlusky Jan 9, 2024
a32b513
Fix objlen type hint (#2966)
trkwyk Jan 9, 2024
a0b820d
Fix type hint of arbitrary argument lists (#2908)
zxjlm Jan 9, 2024
316667e
Fix: hset unexpectedly mutates the list passed to items (#3103)
dvora-h Jan 11, 2024
4528726
Fix possible pipeline connections leak (#3104)
ING-XIAOJIAN Jan 11, 2024
8e5020e
Add modules support to async RedisCluster (#3115)
dvora-h Jan 21, 2024
3f23fff
Fix grammer in BlockingConnectionPool class documentation (#3120)
ahmedabdou14 Jan 23, 2024
101a28d
release already acquired connections on ClusterPipeline, when get_con…
zakaf Feb 4, 2024
c6dfc91
Bump actions/stale from 3 to 9 (#3132)
dependabot[bot] Feb 4, 2024
a54617c
Bump codecov/codecov-action from 3 to 4 (#3131)
dependabot[bot] Feb 4, 2024
e868a11
Allow to control the minimum SSL version (#3127)
poiuj Feb 5, 2024
87a4d8a
docs: Add timeout parameter for get_message example (#3129)
hongqn Feb 5, 2024
b3f4710
Revert stale isuue version update (#3142)
dvora-h Feb 12, 2024
7fa3bd4
Update connection.py (#3149)
wKollendorf Feb 19, 2024
5dff4ef
Fix retry logic for pubsub and pipeline (#3134)
w-miller Feb 19, 2024
3b18dc0
Update install_requires (#3109)
dvora-h Jan 15, 2024
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
doctests/* @dmaier-redislabs
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:
Expand All @@ -15,7 +17,7 @@ autolabeler:
branch:
- '/feature-.+'
categories:
- title: 'Breaking Changes'
- title: '🔥 Breaking Changes'
labels:
- 'breakingchange'
- title: '🧪 Experimental Features'
Expand All @@ -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'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -51,7 +51,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -65,4 +65,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
6 changes: 3 additions & 3 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
name: Build docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
cache: 'pip'
Expand All @@ -40,7 +40,7 @@ jobs:
invoke build-docs

- name: upload docs
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: redis-py-docs
path: |
Expand Down
27 changes: 13 additions & 14 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
name: Dependency audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: pypa/gh-action-pip-audit@v1.0.8
with:
inputs: requirements.txt dev_requirements.txt
Expand All @@ -40,8 +40,8 @@ jobs:
name: Code linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
cache: 'pip'
Expand All @@ -64,8 +64,8 @@ jobs:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
name: Python ${{ matrix.python-version }} ${{matrix.test-type}}-${{matrix.connection-type}} tests
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
Expand All @@ -81,15 +81,14 @@ jobs:
sleep 10 # time to settle
invoke ${{matrix.test-type}}-tests

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: pytest-results-${{matrix.test-type}}-${{matrix.connection-type}}-${{matrix.python-version}}
path: '${{matrix.test-type}}*results.xml'

- name: Upload codecov coverage
uses: codecov/codecov-action@v3
if: ${{matrix.python-version == '3.11'}}
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false

Expand Down Expand Up @@ -119,8 +118,8 @@ jobs:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
name: RESP3 [${{ matrix.python-version }} ${{matrix.test-type}}-${{matrix.connection-type}}]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
Expand All @@ -146,8 +145,8 @@ jobs:
matrix:
extension: ['tar.gz', 'whl']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Run installed unit tests
Expand All @@ -162,8 +161,8 @@ jobs:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy-3.7', 'pypy-3.8', 'pypy-3.9']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pypi-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
build_and_package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: install python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dev tools
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Check Spelling
uses: rojopolis/spellcheck-github-actions@0.33.1
uses: rojopolis/spellcheck-github-actions@0.35.0
with:
config_path: .github/spellcheck-settings.yml
task_name: Markdown
6 changes: 6 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
* Allow to control the minimum SSL version
* Add an optional lock_name attribute to LockError.
* Fix return types for `get`, `set_path` and `strappend` in JSONCommands
* Connection.register_connect_callback() is made public.
* Fix async `read_response` to use `disable_decoding`.
* Add 'aclose()' methods to async classes, deprecate async close().
* Fix #2831, add auto_close_connection_pool=True arg to asyncio.Redis.from_url()
* Fix incorrect redis.asyncio.Cluster type hint for `retry_on_error`
Expand Down Expand Up @@ -55,6 +60,7 @@
* Fix for Unhandled exception related to self.host with unix socket (#2496)
* Improve error output for master discovery
* Make `ClusterCommandsProtocol` an actual Protocol
* Add `sum` to DUPLICATE_POLICY documentation of `TS.CREATE`, `TS.ADD` and `TS.ALTER`

* 4.1.3 (Feb 8, 2022)
* Fix flushdb and flushall (#1926)
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ The Python interface to the Redis key-value store.

---------------------------------------------

## How do I Redis?

[Learn for free at Redis University](https://university.redis.com/)

[Build faster with the Redis Launchpad](https://launchpad.redis.com/)

[Try the Redis Cloud](https://redis.com/try-free/)

[Dive in developer tutorials](https://developer.redis.com/)

[Join the Redis community](https://redis.com/community/)

[Work at Redis](https://redis.com/company/careers/jobs/)

## Installation

Start a redis via docker:
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced_features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ running.

The third option runs an event loop in a separate thread.
pubsub.run_in_thread() creates a new thread and starts the event loop.
The thread object is returned to the caller of [un_in_thread(). The
The thread object is returned to the caller of run_in_thread(). The
caller can use the thread.stop() method to shut down the event loop and
thread. Behind the scenes, this is simply a wrapper around get_message()
that runs in a separate thread, essentially creating a tiny non-blocking
Expand Down
2 changes: 1 addition & 1 deletion docs/clustering.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ The ‘target_nodes’ parameter is explained in the following section,
>>> # target-node: default-node
>>> rc.ping()

Specfiying Target Nodes
Specifying Target Nodes
-----------------------

As mentioned above, all non key-based RedisCluster commands accept the
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ["_build", "**.ipynb_checkponts"]
exclude_patterns = ["_build", "**.ipynb_checkpoints"]

# The reST default role (used for this markup: `text`) to use for all
# documents.
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/asyncio_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
"\n",
"async def reader(channel: redis.client.PubSub):\n",
" while True:\n",
" message = await channel.get_message(ignore_subscribe_messages=True)\n",
" message = await channel.get_message(ignore_subscribe_messages=True, timeout=None)\n",
" if message is not None:\n",
" print(f\"(Reader) Message Received: {message}\")\n",
" if message[\"data\"].decode() == STOPWORD:\n",
Expand Down Expand Up @@ -264,7 +264,7 @@
"\n",
"async def reader(channel: redis.client.PubSub):\n",
" while True:\n",
" message = await channel.get_message(ignore_subscribe_messages=True)\n",
" message = await channel.get_message(ignore_subscribe_messages=True, timeout=None)\n",
" if message is not None:\n",
" print(f\"(Reader) Message Received: {message}\")\n",
" if message[\"data\"].decode() == STOPWORD:\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/pipeline_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The responses of the three commands are stored in a list. In the above example, the two first boolean indicates that the `set` commands were successfull and the last element of the list is the result of the `get(\"a\")` comand."
"The responses of the three commands are stored in a list. In the above example, the two first boolean indicates that the `set` commands were successful and the last element of the list is the result of the `get(\"a\")` comand."
]
},
{
Expand Down
36 changes: 36 additions & 0 deletions docs/examples/ssl_connection_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,42 @@
"ssl_connection.ping()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Connecting to a Redis instance via SSL, while specifying a minimum TLS version"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import redis\n",
"import ssl\n",
"\n",
"ssl_conn = redis.Redis(\n",
" host=\"localhost\",\n",
" port=6666,\n",
" ssl=True,\n",
" ssl_min_version=ssl.TLSVersion.TLSv1_3,\n",
")\n",
"ssl_conn.ping()"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
33 changes: 19 additions & 14 deletions docs/lua_scripting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,24 @@ Cluster Mode

Cluster mode has limited support for lua scripting.

The following commands are supported, with caveats: - ``EVAL`` and
``EVALSHA``: The command is sent to the relevant node, depending on the
keys (i.e., in ``EVAL "<script>" num_keys key_1 ... key_n ...``). The
keys *must* all be on the same node. If the script requires 0 keys, *the
command is sent to a random (primary) node*. - ``SCRIPT EXISTS``: The
command is sent to all primaries. The result is a list of booleans
corresponding to the input SHA hashes. Each boolean is an AND of “does
the script exist on each node?”. In other words, each boolean is True
iff the script exists on all nodes. - ``SCRIPT FLUSH``: The command is
sent to all primaries. The result is a bool AND over all nodes’
responses. - ``SCRIPT LOAD``: The command is sent to all primaries. The
result is the SHA1 digest.

The following commands are not supported: - ``EVAL_RO`` - ``EVALSHA_RO``
The following commands are supported, with caveats:

- ``EVAL`` and ``EVALSHA``: The command is sent to the relevant node,
depending on the keys (i.e., in ``EVAL "<script>" num_keys key_1 ...
key_n ...``). The keys *must* all be on the same node. If the script
requires 0 keys, *the command is sent to a random (primary) node*.
- ``SCRIPT EXISTS``: The command is sent to all primaries. The result
is a list of booleans corresponding to the input SHA hashes. Each
boolean is an AND of “does the script exist on each node?”. In other
words, each boolean is True iff the script exists on all nodes.
- ``SCRIPT FLUSH``: The command is sent to all primaries. The result
is a bool AND over all nodes’ responses.
- ``SCRIPT LOAD``: The command is sent to all primaries. The result
is the SHA1 digest.

The following commands are not supported:

- ``EVAL_RO``
- ``EVALSHA_RO``

Using scripting within pipelines in cluster mode is **not supported**.
2 changes: 1 addition & 1 deletion redis/_parsers/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def float_or_none(response):
return float(response)


def bool_ok(response):
def bool_ok(response, **options):
return str_if_bytes(response) == "OK"


Expand Down
10 changes: 8 additions & 2 deletions redis/_parsers/hiredis.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,16 @@ async def read_response(
if not self._connected:
raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR) from None

response = self._reader.gets()
if disable_decoding:
response = self._reader.gets(False)
else:
response = self._reader.gets()
while response is False:
await self.read_from_socket()
response = self._reader.gets()
if disable_decoding:
response = self._reader.gets(False)
else:
response = self._reader.gets()

# if the response is a ConnectionError or the response is a list and
# the first item is a ConnectionError, raise it as something bad
Expand Down
Loading
Loading