Skip to content

Commit 471f860

Browse files
authored
Fixing doc builds (redis#2869)
1 parent 8e5d5ce commit 471f860

File tree

8 files changed

+133
-36
lines changed

8 files changed

+133
-36
lines changed

.github/workflows/docs.yaml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Docs CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- '[0-9].[0-9]'
8+
pull_request:
9+
branches:
10+
- master
11+
- '[0-9].[0-9]'
12+
schedule:
13+
- cron: '0 1 * * *' # nightly build
14+
15+
concurrency:
16+
group: ${{ github.event.pull_request.number || github.ref }}
17+
cancel-in-progress: true
18+
19+
permissions:
20+
contents: read # to fetch code (actions/checkout)
21+
22+
jobs:
23+
24+
build-docs:
25+
name: Build docs
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v3
29+
- uses: actions/setup-python@v4
30+
with:
31+
python-version: 3.9
32+
cache: 'pip'
33+
- name: install deps
34+
run: |
35+
sudo apt-get update -yqq
36+
sudo apt-get install -yqq pandoc make
37+
- name: run code linters
38+
run: |
39+
pip install -r requirements.txt -r dev_requirements.txt -r docs/requirements.txt
40+
invoke build-docs
41+
42+
- name: upload docs
43+
uses: actions/upload-artifact@v3
44+
with:
45+
name: redis-py-docs
46+
path: |
47+
docs/_build/html

docs/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060

6161
# General information about the project.
6262
project = "redis-py"
63-
copyright = "2022, Redis Inc"
63+
copyright = "2023, Redis Inc"
6464

6565
# The version info for the project you're documenting, acts as replacement for
6666
# |version| and |release|, also used in various other places throughout the
@@ -287,4 +287,4 @@
287287
epub_title = "redis-py"
288288
epub_author = "Redis Inc"
289289
epub_publisher = "Redis Inc"
290-
epub_copyright = "2022, Redis Inc"
290+
epub_copyright = "2023, Redis Inc"

docs/examples/redis-stream-example.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@
313313
"cell_type": "markdown",
314314
"metadata": {},
315315
"source": [
316-
"# stream groups\n",
316+
"# Stream groups\n",
317317
"With the groups is possible track, for many consumers, and at the Redis side, which message have been already consumed.\n",
318318
"## add some data to streams\n",
319319
"Creating 2 streams with 10 messages each."

docs/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ sphinx_gallery
55
ipython
66
sphinx-autodoc-typehints
77
furo
8+
pandoc

redis/asyncio/client.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,13 @@ def from_url(
134134
135135
There are several ways to specify a database number. The first value
136136
found will be used:
137-
1. A ``db`` querystring option, e.g. redis://localhost?db=0
138-
2. If using the redis:// or rediss:// schemes, the path argument
137+
138+
1. A ``db`` querystring option, e.g. redis://localhost?db=0
139+
140+
2. If using the redis:// or rediss:// schemes, the path argument
139141
of the url, e.g. redis://localhost/0
140-
3. A ``db`` keyword argument to this function.
142+
143+
3. A ``db`` keyword argument to this function.
141144
142145
If none of these options are specified, the default db=0 is used.
143146

redis/asyncio/connection.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -948,10 +948,13 @@ def from_url(cls: Type[_CP], url: str, **kwargs) -> _CP:
948948
949949
There are several ways to specify a database number. The first value
950950
found will be used:
951-
1. A ``db`` querystring option, e.g. redis://localhost?db=0
952-
2. If using the redis:// or rediss:// schemes, the path argument
951+
952+
1. A ``db`` querystring option, e.g. redis://localhost?db=0
953+
954+
2. If using the redis:// or rediss:// schemes, the path argument
953955
of the url, e.g. redis://localhost/0
954-
3. A ``db`` keyword argument to this function.
956+
957+
3. A ``db`` keyword argument to this function.
955958
956959
If none of these options are specified, the default db=0 is used.
957960

redis/commands/core.py

+69-26
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ def client_list(
517517
"""
518518
Returns a list of currently connected clients.
519519
If type of client specified, only that type will be returned.
520+
520521
:param _type: optional. one of the client types (normal, master,
521522
replica, pubsub)
522523
:param client_id: optional. a list of client ids
@@ -559,16 +560,17 @@ def client_reply(
559560
) -> ResponseT:
560561
"""
561562
Enable and disable redis server replies.
563+
562564
``reply`` Must be ON OFF or SKIP,
563-
ON - The default most with server replies to commands
564-
OFF - Disable server responses to commands
565-
SKIP - Skip the response of the immediately following command.
565+
ON - The default most with server replies to commands
566+
OFF - Disable server responses to commands
567+
SKIP - Skip the response of the immediately following command.
566568
567569
Note: When setting OFF or SKIP replies, you will need a client object
568570
with a timeout specified in seconds, and will need to catch the
569571
TimeoutError.
570-
The test_client_reply unit test illustrates this, and
571-
conftest.py has a client with a timeout.
572+
The test_client_reply unit test illustrates this, and
573+
conftest.py has a client with a timeout.
572574
573575
See https://redis.io/commands/client-reply
574576
"""
@@ -724,19 +726,21 @@ def client_unblock(
724726

725727
def client_pause(self, timeout: int, all: bool = True, **kwargs) -> ResponseT:
726728
"""
727-
Suspend all the Redis clients for the specified amount of time
728-
:param timeout: milliseconds to pause clients
729+
Suspend all the Redis clients for the specified amount of time.
730+
729731
730732
For more information see https://redis.io/commands/client-pause
733+
734+
:param timeout: milliseconds to pause clients
731735
:param all: If true (default) all client commands are blocked.
732-
otherwise, clients are only blocked if they attempt to execute
733-
a write command.
734-
For the WRITE mode, some commands have special behavior:
735-
EVAL/EVALSHA: Will block client for all scripts.
736-
PUBLISH: Will block client.
737-
PFCOUNT: Will block client.
738-
WAIT: Acknowledgments will be delayed, so this command will
739-
appear blocked.
736+
otherwise, clients are only blocked if they attempt to execute
737+
a write command.
738+
For the WRITE mode, some commands have special behavior:
739+
EVAL/EVALSHA: Will block client for all scripts.
740+
PUBLISH: Will block client.
741+
PFCOUNT: Will block client.
742+
WAIT: Acknowledgments will be delayed, so this command will
743+
appear blocked.
740744
"""
741745
args = ["CLIENT PAUSE", str(timeout)]
742746
if not isinstance(timeout, int):
@@ -1215,9 +1219,11 @@ def quit(self, **kwargs) -> ResponseT:
12151219
def replicaof(self, *args, **kwargs) -> ResponseT:
12161220
"""
12171221
Update the replication settings of a redis replica, on the fly.
1222+
12181223
Examples of valid arguments include:
1219-
NO ONE (set no replication)
1220-
host port (set to the host and port of a redis server)
1224+
1225+
NO ONE (set no replication)
1226+
host port (set to the host and port of a redis server)
12211227
12221228
For more information see https://redis.io/commands/replicaof
12231229
"""
@@ -3603,27 +3609,37 @@ def xclaim(
36033609
) -> ResponseT:
36043610
"""
36053611
Changes the ownership of a pending message.
3612+
36063613
name: name of the stream.
3614+
36073615
groupname: name of the consumer group.
3616+
36083617
consumername: name of a consumer that claims the message.
3618+
36093619
min_idle_time: filter messages that were idle less than this amount of
36103620
milliseconds
3621+
36113622
message_ids: non-empty list or tuple of message IDs to claim
3623+
36123624
idle: optional. Set the idle time (last time it was delivered) of the
3613-
message in ms
3625+
message in ms
3626+
36143627
time: optional integer. This is the same as idle but instead of a
3615-
relative amount of milliseconds, it sets the idle time to a specific
3616-
Unix time (in milliseconds).
3628+
relative amount of milliseconds, it sets the idle time to a specific
3629+
Unix time (in milliseconds).
3630+
36173631
retrycount: optional integer. set the retry counter to the specified
3618-
value. This counter is incremented every time a message is delivered
3619-
again.
3632+
value. This counter is incremented every time a message is delivered
3633+
again.
3634+
36203635
force: optional boolean, false by default. Creates the pending message
3621-
entry in the PEL even if certain specified IDs are not already in the
3622-
PEL assigned to a different client.
3636+
entry in the PEL even if certain specified IDs are not already in the
3637+
PEL assigned to a different client.
3638+
36233639
justid: optional boolean, false by default. Return just an array of IDs
3624-
of messages successfully claimed, without returning the actual message
3640+
of messages successfully claimed, without returning the actual message
36253641
3626-
For more information see https://redis.io/commands/xclaim
3642+
For more information see https://redis.io/commands/xclaim
36273643
"""
36283644
if not isinstance(min_idle_time, int) or min_idle_time < 0:
36293645
raise DataError("XCLAIM min_idle_time must be a non negative integer")
@@ -3875,11 +3891,15 @@ def xrange(
38753891
) -> ResponseT:
38763892
"""
38773893
Read stream values within an interval.
3894+
38783895
name: name of the stream.
3896+
38793897
start: first stream ID. defaults to '-',
38803898
meaning the earliest available.
3899+
38813900
finish: last stream ID. defaults to '+',
38823901
meaning the latest available.
3902+
38833903
count: if set, only return this many items, beginning with the
38843904
earliest available.
38853905
@@ -3902,10 +3922,13 @@ def xread(
39023922
) -> ResponseT:
39033923
"""
39043924
Block and monitor multiple streams for new data.
3925+
39053926
streams: a dict of stream names to stream IDs, where
39063927
IDs indicate the last ID already seen.
3928+
39073929
count: if set, only return this many items, beginning with the
39083930
earliest available.
3931+
39093932
block: number of milliseconds to wait, if nothing already present.
39103933
39113934
For more information see https://redis.io/commands/xread
@@ -3940,12 +3963,17 @@ def xreadgroup(
39403963
) -> ResponseT:
39413964
"""
39423965
Read from a stream via a consumer group.
3966+
39433967
groupname: name of the consumer group.
3968+
39443969
consumername: name of the requesting consumer.
3970+
39453971
streams: a dict of stream names to stream IDs, where
39463972
IDs indicate the last ID already seen.
3973+
39473974
count: if set, only return this many items, beginning with the
39483975
earliest available.
3976+
39493977
block: number of milliseconds to wait, if nothing already present.
39503978
noack: do not add messages to the PEL
39513979
@@ -3980,11 +4008,15 @@ def xrevrange(
39804008
) -> ResponseT:
39814009
"""
39824010
Read stream values within an interval, in reverse order.
4011+
39834012
name: name of the stream
4013+
39844014
start: first stream ID. defaults to '+',
39854015
meaning the latest available.
4016+
39864017
finish: last stream ID. defaults to '-',
39874018
meaning the earliest available.
4019+
39884020
count: if set, only return this many items, beginning with the
39894021
latest available.
39904022
@@ -5301,8 +5333,10 @@ def script_flush(
53015333
self, sync_type: Union[Literal["SYNC"], Literal["ASYNC"]] = None
53025334
) -> ResponseT:
53035335
"""Flush all scripts from the script cache.
5336+
53045337
``sync_type`` is by default SYNC (synchronous) but it can also be
53055338
ASYNC.
5339+
53065340
For more information see https://redis.io/commands/script-flush
53075341
"""
53085342

@@ -5615,11 +5649,14 @@ def geosearch(
56155649
area specified by a given shape. This command extends the
56165650
GEORADIUS command, so in addition to searching within circular
56175651
areas, it supports searching within rectangular areas.
5652+
56185653
This command should be used in place of the deprecated
56195654
GEORADIUS and GEORADIUSBYMEMBER commands.
5655+
56205656
``member`` Use the position of the given existing
56215657
member in the sorted set. Can't be given with ``longitude``
56225658
and ``latitude``.
5659+
56235660
``longitude`` and ``latitude`` Use the position given by
56245661
this coordinates. Can't be given with ``member``
56255662
``radius`` Similar to GEORADIUS, search inside circular
@@ -5628,17 +5665,23 @@ def geosearch(
56285665
``height`` and ``width`` Search inside an axis-aligned
56295666
rectangle, determined by the given height and width.
56305667
Can't be given with ``radius``
5668+
56315669
``unit`` must be one of the following : m, km, mi, ft.
56325670
`m` for meters (the default value), `km` for kilometers,
56335671
`mi` for miles and `ft` for feet.
5672+
56345673
``sort`` indicates to return the places in a sorted way,
56355674
ASC for nearest to furthest and DESC for furthest to nearest.
5675+
56365676
``count`` limit the results to the first count matching items.
5677+
56375678
``any`` is set to True, the command will return as soon as
56385679
enough matches are found. Can't be provided without ``count``
5680+
56395681
``withdist`` indicates to return the distances of each place.
56405682
``withcoord`` indicates to return the latitude and longitude of
56415683
each place.
5684+
56425685
``withhash`` indicates to return the geohash string of each place.
56435686
56445687
For more information see https://redis.io/commands/geosearch

tasks.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def devenv(c):
2121
def build_docs(c):
2222
"""Generates the sphinx documentation."""
2323
run("pip install -r docs/requirements.txt")
24-
run("make html")
24+
run("make -C docs html")
2525

2626

2727
@task

0 commit comments

Comments
 (0)