Skip to content

Commit 6c94762

Browse files
izulinolruas
authored andcommitted
API Docs fixes (#5414)
* cleanup of rst * renaming files * pw.demo docstring * debug docstring * universes * reexporting universes * missing file * reducers * moving files * moving index * rename * . * . * removing unnecessary pages * moving files * . * all the submodules * cleanup * rename sql article * flake8 * broken links * broken links * Update public/website3/content/2.developers/6.tutorials/.json_type/article.py * Update public/website3/content/2.developers/6.tutorials/.json_type/article.py * Update public/website3/content/2.developers/7.showcases/.vectorstore_pipeline/article.py * missing links * broken links * broken links * Update public/website3/content/2.developers/6.tutorials/.json_type/article.py * Update public/website3/content/2.developers/6.tutorials/.json_type/article.py * non-broken index * noprint * redirects * Update public/pathway/python/pathway/asynchronous.py * Update public/pathway/python/pathway/asynchronous.py * Update public/pathway/python/pathway/debug/__init__.py Co-authored-by: Olivier Ruas <olivier@pathway.com> * pw.Table --------- Co-authored-by: Olivier Ruas <olivier@pathway.com> GitOrigin-RevId: eb0510aca837fdc9b1de299b3cf676995c3206ee
1 parent d4d58f0 commit 6c94762

File tree

9 files changed

+107
-20
lines changed

9 files changed

+107
-20
lines changed

python/pathway/asynchronous.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Copyright © 2024 Pathway
2+
"""
3+
Helper methods and classes used along with :py:func:`~pathway.udf_async` and :py:func:`~pathway.AsyncTransformer`.
4+
5+
Typical use:
6+
7+
>>> import pathway as pw
8+
>>> import asyncio
9+
>>> @pw.udf_async(retry_strategy=pw.asynchronous.FixedDelayRetryStrategy(max_retries=5))
10+
... async def concat(left: str, right: str) -> str:
11+
... await asyncio.sleep(0.1)
12+
... return left+right
13+
>>> t1 = pw.debug.table_from_markdown('''
14+
... age owner pet
15+
... 10 Alice dog
16+
... 9 Bob dog
17+
... 8 Alice cat
18+
... 7 Bob dog''')
19+
>>> t2 = t1.select(col = concat(t1.owner, t1.pet))
20+
>>> pw.debug.compute_and_print(t2, include_id=False)
21+
col
22+
Alicecat
23+
Alicedog
24+
Bobdog
25+
Bobdog
26+
"""
27+
28+
from pathway.internals.asynchronous import (
29+
AsyncRetryStrategy,
30+
CacheStrategy,
31+
DefaultCache,
32+
ExponentialBackoffRetryStrategy,
33+
FixedDelayRetryStrategy,
34+
NoRetryStrategy,
35+
async_options,
36+
coerce_async,
37+
with_cache_strategy,
38+
with_capacity,
39+
with_retry_strategy,
40+
)
41+
42+
__all__ = [
43+
"with_capacity",
44+
"with_retry_strategy",
45+
"with_cache_strategy",
46+
"async_options",
47+
"coerce_async",
48+
"AsyncRetryStrategy",
49+
"NoRetryStrategy",
50+
"ExponentialBackoffRetryStrategy",
51+
"FixedDelayRetryStrategy",
52+
"CacheStrategy",
53+
"DefaultCache",
54+
]

python/pathway/debug/__init__.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Copyright © 2024 Pathway
2-
2+
"""Methods and classes for debugging Pathway computation.
3+
4+
Typical use:
5+
6+
>>> import pathway as pw
7+
>>> t1 = pw.debug.table_from_markdown('''
8+
... pet
9+
... Dog
10+
... Cat
11+
... ''')
12+
>>> t2 = t1.select(animal=t1.pet, desc="fluffy")
13+
>>> pw.debug.compute_and_print(t2, include_id=False)
14+
animal | desc
15+
Cat | fluffy
16+
Dog | fluffy
17+
"""
318
from __future__ import annotations
419

520
import functools

python/pathway/demo/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
"""Pathway demo module
44
5+
This module allows you to create custom data streams from scratch or by utilizing a CSV file.
6+
This feature empowers you to effectively test and debug your Pathway implementation using realtime data.
7+
58
Typical use:
69
710
>>> class InputSchema(pw.Schema):

python/pathway/internals/asynchronous.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -260,18 +260,3 @@ def _get_cache(self, func):
260260
if "PATHWAY_PERSISTENT_STORAGE" not in os.environ:
261261
return None
262262
return super()._get_cache(func)
263-
264-
265-
__all__ = [
266-
"with_capacity",
267-
"with_retry_strategy",
268-
"with_cache_strategy",
269-
"async_options",
270-
"coerce_async",
271-
"AsyncRetryStrategy",
272-
"NoRetryStrategy",
273-
"ExponentialBackoffRetryStrategy",
274-
"FixedDelayRetryStrategy",
275-
"CacheStrategy",
276-
"DefaultCache",
277-
]

python/pathway/reducers.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
11
# Copyright © 2024 Pathway
2+
"""Reducers are used in `reduce` to compute the aggregated results obtained by a `groupby`.
3+
4+
Typical use:
5+
6+
>>> import pathway as pw
7+
>>> t = pw.debug.table_from_markdown('''
8+
... colA | colB
9+
... valA | -1
10+
... valA | 1
11+
... valA | 2
12+
... valB | 4
13+
... valB | 4
14+
... valB | 7
15+
... ''')
16+
>>> result = t.groupby(t.colA).reduce(sum=pw.reducers.sum(t.colB))
17+
>>> pw.debug.compute_and_print(result, include_id=False)
18+
sum
19+
2
20+
15
21+
"""
222

323
from pathway.internals.custom_reducers import (
424
stateful_many,

python/pathway/stdlib/graphs/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@
22

33
from __future__ import annotations
44

5-
from . import bellman_ford, pagerank
5+
from . import bellman_ford, louvain_communities, pagerank
66
from .common import Edge, Vertex
77
from .graph import Graph, WeightedGraph
88

9-
__all__ = ["bellman_ford", "pagerank", "Edge", "Graph", "Vertex", "WeightedGraph"]
9+
__all__ = [
10+
"bellman_ford",
11+
"pagerank",
12+
"Edge",
13+
"Graph",
14+
"Vertex",
15+
"WeightedGraph",
16+
"louvain_communities",
17+
]

python/pathway/tests/test_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2082,7 +2082,7 @@ def test_apply_async_disk_cache(tmp_path: pathlib.Path):
20822082
cache_dir = tmp_path / "test_cache"
20832083
counter = mock.Mock()
20842084

2085-
@pw.asynchronous.async_options(cache_strategy=pw.asynchronous.DiskCache())
2085+
@pw.asynchronous.async_options(cache_strategy=pw.internals.asynchronous.DiskCache())
20862086
def inc(x: int) -> int:
20872087
counter()
20882088
return x + 1

python/pathway/tests/test_udf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_udf_async_options(tmp_path: pathlib.Path):
7979

8080
counter = mock.Mock()
8181

82-
@pw.udf_async(cache_strategy=pw.asynchronous.DiskCache())
82+
@pw.udf_async(cache_strategy=pw.internals.asynchronous.DiskCache())
8383
async def inc(x: int) -> int:
8484
counter()
8585
return x + 5

python/pathway/universes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Copyright © 2024 Pathway
22
"""Methods and classes for testing and declaring relations between keysets (universes).
3+
34
Typical use:
5+
46
>>> import pathway as pw
57
>>> import pytest
68
>>> t1 = pw.debug.table_from_markdown(

0 commit comments

Comments
 (0)