Skip to content

Commit

Permalink
API Docs fixes (#5414)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* pw.Table

---------

Co-authored-by: Olivier Ruas <[email protected]>
GitOrigin-RevId: eb0510aca837fdc9b1de299b3cf676995c3206ee
  • Loading branch information
2 people authored and Manul from Pathway committed Jan 16, 2024
1 parent d4d58f0 commit 6c94762
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 20 deletions.
54 changes: 54 additions & 0 deletions python/pathway/asynchronous.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright © 2024 Pathway
"""
Helper methods and classes used along with :py:func:`~pathway.udf_async` and :py:func:`~pathway.AsyncTransformer`.
Typical use:
>>> import pathway as pw
>>> import asyncio
>>> @pw.udf_async(retry_strategy=pw.asynchronous.FixedDelayRetryStrategy(max_retries=5))
... async def concat(left: str, right: str) -> str:
... await asyncio.sleep(0.1)
... return left+right
>>> t1 = pw.debug.table_from_markdown('''
... age owner pet
... 10 Alice dog
... 9 Bob dog
... 8 Alice cat
... 7 Bob dog''')
>>> t2 = t1.select(col = concat(t1.owner, t1.pet))
>>> pw.debug.compute_and_print(t2, include_id=False)
col
Alicecat
Alicedog
Bobdog
Bobdog
"""

from pathway.internals.asynchronous import (
AsyncRetryStrategy,
CacheStrategy,
DefaultCache,
ExponentialBackoffRetryStrategy,
FixedDelayRetryStrategy,
NoRetryStrategy,
async_options,
coerce_async,
with_cache_strategy,
with_capacity,
with_retry_strategy,
)

__all__ = [
"with_capacity",
"with_retry_strategy",
"with_cache_strategy",
"async_options",
"coerce_async",
"AsyncRetryStrategy",
"NoRetryStrategy",
"ExponentialBackoffRetryStrategy",
"FixedDelayRetryStrategy",
"CacheStrategy",
"DefaultCache",
]
17 changes: 16 additions & 1 deletion python/pathway/debug/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Copyright © 2024 Pathway

"""Methods and classes for debugging Pathway computation.
Typical use:
>>> import pathway as pw
>>> t1 = pw.debug.table_from_markdown('''
... pet
... Dog
... Cat
... ''')
>>> t2 = t1.select(animal=t1.pet, desc="fluffy")
>>> pw.debug.compute_and_print(t2, include_id=False)
animal | desc
Cat | fluffy
Dog | fluffy
"""
from __future__ import annotations

import functools
Expand Down
3 changes: 3 additions & 0 deletions python/pathway/demo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

"""Pathway demo module
This module allows you to create custom data streams from scratch or by utilizing a CSV file.
This feature empowers you to effectively test and debug your Pathway implementation using realtime data.
Typical use:
>>> class InputSchema(pw.Schema):
Expand Down
15 changes: 0 additions & 15 deletions python/pathway/internals/asynchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,18 +260,3 @@ def _get_cache(self, func):
if "PATHWAY_PERSISTENT_STORAGE" not in os.environ:
return None
return super()._get_cache(func)


__all__ = [
"with_capacity",
"with_retry_strategy",
"with_cache_strategy",
"async_options",
"coerce_async",
"AsyncRetryStrategy",
"NoRetryStrategy",
"ExponentialBackoffRetryStrategy",
"FixedDelayRetryStrategy",
"CacheStrategy",
"DefaultCache",
]
20 changes: 20 additions & 0 deletions python/pathway/reducers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
# Copyright © 2024 Pathway
"""Reducers are used in `reduce` to compute the aggregated results obtained by a `groupby`.
Typical use:
>>> import pathway as pw
>>> t = pw.debug.table_from_markdown('''
... colA | colB
... valA | -1
... valA | 1
... valA | 2
... valB | 4
... valB | 4
... valB | 7
... ''')
>>> result = t.groupby(t.colA).reduce(sum=pw.reducers.sum(t.colB))
>>> pw.debug.compute_and_print(result, include_id=False)
sum
2
15
"""

from pathway.internals.custom_reducers import (
stateful_many,
Expand Down
12 changes: 10 additions & 2 deletions python/pathway/stdlib/graphs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@

from __future__ import annotations

from . import bellman_ford, pagerank
from . import bellman_ford, louvain_communities, pagerank
from .common import Edge, Vertex
from .graph import Graph, WeightedGraph

__all__ = ["bellman_ford", "pagerank", "Edge", "Graph", "Vertex", "WeightedGraph"]
__all__ = [
"bellman_ford",
"pagerank",
"Edge",
"Graph",
"Vertex",
"WeightedGraph",
"louvain_communities",
]
2 changes: 1 addition & 1 deletion python/pathway/tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2082,7 +2082,7 @@ def test_apply_async_disk_cache(tmp_path: pathlib.Path):
cache_dir = tmp_path / "test_cache"
counter = mock.Mock()

@pw.asynchronous.async_options(cache_strategy=pw.asynchronous.DiskCache())
@pw.asynchronous.async_options(cache_strategy=pw.internals.asynchronous.DiskCache())
def inc(x: int) -> int:
counter()
return x + 1
Expand Down
2 changes: 1 addition & 1 deletion python/pathway/tests/test_udf.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_udf_async_options(tmp_path: pathlib.Path):

counter = mock.Mock()

@pw.udf_async(cache_strategy=pw.asynchronous.DiskCache())
@pw.udf_async(cache_strategy=pw.internals.asynchronous.DiskCache())
async def inc(x: int) -> int:
counter()
return x + 5
Expand Down
2 changes: 2 additions & 0 deletions python/pathway/universes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright © 2024 Pathway
"""Methods and classes for testing and declaring relations between keysets (universes).
Typical use:
>>> import pathway as pw
>>> import pytest
>>> t1 = pw.debug.table_from_markdown(
Expand Down

0 comments on commit 6c94762

Please sign in to comment.