Skip to content

Commit 1bbbd32

Browse files
authored
Merge branch 'master' into patch-1
2 parents d990136 + fb74aa2 commit 1bbbd32

Some content is hidden

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

54 files changed

+605
-394
lines changed

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ exclude =
1616
ignore =
1717
E126
1818
E203
19+
E231
1920
E701
2021
E704
2122
F405

.github/wordlist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,4 @@ unicode
141141
url
142142
virtualenv
143143
www
144+
yaml

.github/workflows/integration.yaml

Lines changed: 43 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ permissions:
2525

2626
env:
2727
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
28+
# this speeds up coverage with Python 3.12: https://github.com/nedbat/coveragepy/issues/1665
29+
COVERAGE_CORE: sysmon
2830
REDIS_IMAGE: redis:7.4-rc2
29-
REDIS_STACK_IMAGE: redis/redis-stack-server:7.4.0-rc2
31+
REDIS_STACK_IMAGE: redis/redis-stack-server:latest
3032

3133
jobs:
3234
dependency-audit:
@@ -54,26 +56,28 @@ jobs:
5456
pip install -r dev_requirements.txt
5557
invoke linters
5658
57-
run-tests:
59+
resp2-tests:
5860
runs-on: ubuntu-latest
5961
timeout-minutes: 60
6062
strategy:
6163
max-parallel: 15
6264
fail-fast: false
6365
matrix:
64-
python-version: ['3.8', '3.9', '3.10', '3.11', 'pypy-3.8', 'pypy-3.9']
66+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.8', 'pypy-3.9']
6567
test-type: ['standalone', 'cluster']
6668
connection-type: ['hiredis', 'plain']
6769
env:
6870
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
69-
name: Python ${{ matrix.python-version }} ${{matrix.test-type}}-${{matrix.connection-type}} tests
71+
name: RESP2 ${{ matrix.python-version }} ${{matrix.test-type}}-${{matrix.connection-type}}
7072
steps:
7173
- uses: actions/checkout@v4
74+
7275
- uses: actions/setup-python@v5
7376
with:
7477
python-version: ${{ matrix.python-version }}
7578
cache: 'pip'
76-
- name: run tests
79+
80+
- name: Run tests
7781
run: |
7882
pip install -U setuptools wheel
7983
pip install -r requirements.txt
@@ -84,52 +88,48 @@ jobs:
8488
invoke devenv
8589
sleep 10 # time to settle
8690
invoke ${{matrix.test-type}}-tests
91+
ls -1
8792
88-
- uses: actions/upload-artifact@v4
89-
if: success() || failure()
93+
- name: Upload test results and profiling data
94+
uses: actions/upload-artifact@v4
9095
with:
9196
name: pytest-results-${{matrix.test-type}}-${{matrix.connection-type}}-${{matrix.python-version}}
92-
path: '${{matrix.test-type}}*results.xml'
97+
path: |
98+
${{matrix.test-type}}*-results.xml
99+
prof/**
100+
profile_output*
101+
if-no-files-found: error
102+
retention-days: 10
93103

94104
- name: Upload codecov coverage
95105
uses: codecov/codecov-action@v4
96106
with:
97107
fail_ci_if_error: false
98108

99-
- name: View Test Results
100-
uses: dorny/test-reporter@v1
101-
if: success() || failure()
102-
continue-on-error: true
103-
with:
104-
name: Test Results ${{matrix.python-version}} ${{matrix.test-type}}-${{matrix.connection-type}}
105-
path: '*.xml'
106-
reporter: java-junit
107-
list-suites: all
108-
list-tests: all
109-
max-annotations: 10
110-
fail-on-error: 'false'
111-
112-
resp3_tests:
109+
resp3-tests:
113110
runs-on: ubuntu-latest
114111
strategy:
115112
fail-fast: false
116113
matrix:
117-
python-version: ['3.8', '3.11']
114+
python-version: ['3.8', '3.12']
118115
test-type: ['standalone', 'cluster']
119116
connection-type: ['hiredis', 'plain']
117+
event-loop: ['asyncio', 'uvloop']
120118
exclude:
121119
- test-type: 'cluster'
122120
connection-type: 'hiredis'
123121
env:
124122
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
125-
name: RESP3 [${{ matrix.python-version }} ${{matrix.test-type}}-${{matrix.connection-type}}]
123+
name: RESP3 ${{ matrix.python-version }} ${{matrix.test-type}}-${{matrix.connection-type}}-${{matrix.event-loop}}
126124
steps:
127125
- uses: actions/checkout@v4
126+
128127
- uses: actions/setup-python@v5
129128
with:
130129
python-version: ${{ matrix.python-version }}
131130
cache: 'pip'
132-
- name: run tests
131+
132+
- name: Run tests
133133
run: |
134134
pip install -U setuptools wheel
135135
pip install -r requirements.txt
@@ -139,37 +139,32 @@ jobs:
139139
fi
140140
invoke devenv
141141
sleep 10 # time to settle
142-
invoke ${{matrix.test-type}}-tests --protocol=3
143-
invoke ${{matrix.test-type}}-tests --uvloop --protocol=3
142+
if [ "${{matrix.event-loop}}" == "uvloop" ]; then
143+
invoke ${{matrix.test-type}}-tests --uvloop --protocol=3
144+
else
145+
invoke ${{matrix.test-type}}-tests --protocol=3
146+
fi
144147
145-
- uses: actions/upload-artifact@v4
146-
if: success() || failure()
148+
- name: Upload test results and profiling data
149+
uses: actions/upload-artifact@v4
147150
with:
148-
name: pytest-results-${{matrix.test-type}}-${{matrix.connection-type}}-${{matrix.python-version}}-resp3
149-
path: '${{matrix.test-type}}*results.xml'
151+
name: pytest-results-${{matrix.test-type}}-${{matrix.connection-type}}-${{matrix.python-version}}-${{matrix.event-loop}}-resp3
152+
path: |
153+
${{matrix.test-type}}*-results.xml
154+
prof/**
155+
profile_output*
156+
if-no-files-found: error
157+
retention-days: 10
150158

151159
- name: Upload codecov coverage
152160
uses: codecov/codecov-action@v4
153161
with:
154162
fail_ci_if_error: false
155163

156-
- name: View Test Results
157-
uses: dorny/test-reporter@v1
158-
if: success() || failure()
159-
continue-on-error: true
160-
with:
161-
name: Test Results ${{matrix.python-version}} ${{matrix.test-type}}-${{matrix.connection-type}}-resp3
162-
path: '*.xml'
163-
reporter: java-junit
164-
list-suites: all
165-
list-tests: all
166-
max-annotations: 10
167-
fail-on-error: 'false'
168-
169-
build_and_test_package:
164+
build-and-test-package:
170165
name: Validate building and installing the package
171166
runs-on: ubuntu-latest
172-
needs: [run-tests]
167+
needs: [resp2-tests, resp3-tests]
173168
strategy:
174169
fail-fast: false
175170
matrix:
@@ -183,13 +178,13 @@ jobs:
183178
run: |
184179
bash .github/workflows/install_and_test.sh ${{ matrix.extension }}
185180
186-
install_package_from_commit:
181+
install-package-from-commit:
187182
name: Install package from commit hash
188183
runs-on: ubuntu-latest
189184
strategy:
190185
fail-fast: false
191186
matrix:
192-
python-version: ['3.8', '3.9', '3.10', '3.11', 'pypy-3.8', 'pypy-3.9']
187+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.8', 'pypy-3.9']
193188
steps:
194189
- uses: actions/checkout@v4
195190
- uses: actions/setup-python@v5

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ coverage.xml
1616
.venv*
1717
*.xml
1818
.coverage*
19+
prof
20+
profile_output*
1921
docker/stunnel/keys

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@
6565
* Make `ClusterCommandsProtocol` an actual Protocol
6666
* Add `sum` to DUPLICATE_POLICY documentation of `TS.CREATE`, `TS.ADD` and `TS.ALTER`
6767
* Prevent async ClusterPipeline instances from becoming "false-y" in case of empty command stack (#3061)
68+
* Close Unix sockets if the connection attempt fails. This prevents `ResourceWarning`s. (#3314)
69+
* Close SSL sockets if the connection attempt fails, or if validations fail. (#3317)
6870

6971
* 4.1.3 (Feb 8, 2022)
7072
* Fix flushdb and flushall (#1926)

dev_requirements.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
black==24.3.0
22
cachetools
33
click==8.0.4
4-
flake8-isort==6.0.0
5-
flake8==5.0.4
4+
flake8-isort
5+
flake8
66
flynt~=0.69.0
7-
invoke==1.7.3
8-
mock==4.0.3
7+
invoke==2.2.0
8+
mock
99
packaging>=20.4
1010
pytest
1111
pytest-asyncio
1212
pytest-cov
13+
pytest-profiling
1314
pytest-timeout
1415
ujson>=4.2.0
15-
urllib3<2
1616
uvloop
1717
vulture>=2.3.0
1818
wheel>=0.30.0
19+
numpy>=1.24.0

docs/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@
128128
# further. For a list of options available for each theme, see the
129129
# documentation.
130130
html_theme_options = {
131-
"display_version": True,
132131
"footer_icons": [
133132
{
134133
"name": "GitHub",

docs/connections.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ ClusterNode
5555
Async Client
5656
************
5757

58-
See complete example: `here <examples/asyncio_examples.html>`_
58+
See complete example: `here <examples/asyncio_examples.html>`__
5959

6060
This client is used for communicating with Redis, asynchronously.
6161

@@ -88,7 +88,7 @@ ClusterPipeline (Async)
8888
Connection
8989
**********
9090

91-
See complete example: `here <examples/connection_examples.html>`_
91+
See complete example: `here <examples/connection_examples.html>`__
9292

9393
Connection
9494
==========
@@ -104,7 +104,7 @@ Connection (Async)
104104
Connection Pools
105105
****************
106106

107-
See complete example: `here <examples/connection_examples.html>`_
107+
See complete example: `here <examples/connection_examples.html>`__
108108

109109
ConnectionPool
110110
==============

docs/examples/search_vector_similarity_examples.ipynb

Lines changed: 3 additions & 2 deletions
Large diffs are not rendered by default.

docs/opentelemetry.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Integrating OpenTelemetry
44
What is OpenTelemetry?
55
----------------------
66

7-
`OpenTelemetry <https://opentelemetry.io>`_ is an open-source observability framework for traces, metrics, and logs. It is a merger of OpenCensus and OpenTracing projects hosted by Cloud Native Computing Foundation.
7+
`OpenTelemetry <https://opentelemetry.io>`__ is an open-source observability framework for traces, metrics, and logs. It is a merger of OpenCensus and OpenTracing projects hosted by Cloud Native Computing Foundation.
88

99
OpenTelemetry allows developers to collect and export telemetry data in a vendor agnostic way. With OpenTelemetry, you can instrument your application once and then add or change vendors without changing the instrumentation, for example, here is a list of `popular DataDog competitors <https://uptrace.dev/get/compare/datadog-competitors.html>`_ that support OpenTelemetry.
1010

@@ -61,7 +61,7 @@ Once the code is patched, you can use redis-py as usually:
6161
OpenTelemetry API
6262
-----------------
6363

64-
`OpenTelemetry <https://uptrace.dev/opentelemetry/>`_ API is a programming interface that you can use to instrument code and collect telemetry data such as traces, metrics, and logs.
64+
`OpenTelemetry API <https://uptrace.dev/opentelemetry/>`__ is a programming interface that you can use to instrument code and collect telemetry data such as traces, metrics, and logs.
6565

6666
You can use OpenTelemetry API to measure important operations:
6767

@@ -125,7 +125,7 @@ Alerting and notifications
125125

126126
Uptrace also allows you to monitor `OpenTelemetry metrics <https://uptrace.dev/opentelemetry/metrics.html>`_ using alerting rules. For example, the following monitor uses the group by node expression to create an alert whenever an individual Redis shard is down:
127127

128-
.. code-block:: python
128+
.. code-block:: yaml
129129
130130
monitors:
131131
- name: Redis shard is down
@@ -142,7 +142,7 @@ Uptrace also allows you to monitor `OpenTelemetry metrics <https://uptrace.dev/o
142142
143143
You can also create queries with more complex expressions. For example, the following rule creates an alert when the keyspace hit rate is lower than 75%:
144144

145-
.. code-block:: python
145+
.. code-block:: yaml
146146
147147
monitors:
148148
- name: Redis read hit rate < 75%

0 commit comments

Comments
 (0)