Skip to content

Commit ca3d808

Browse files
voodoo11embe-pw
authored and
Manul from Pathway
committed
Align signatures of pw.run and pw.run_all. (#5502)
* Align signatures and add docstring * kwonly * Add breaking entry in changelog * Update public/pathway/CHANGELOG.md Co-authored-by: Michał Bartoszkiewicz <[email protected]> --------- Co-authored-by: Michał Bartoszkiewicz <[email protected]> GitOrigin-RevId: 9a48ce60d23e62a74ad8e16eb011c5c2f01dc100
1 parent 56e2eb0 commit ca3d808

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
99
- `pw.io.http.rest_connector` can now handle different kinds of HTTP requests.
1010
- `pw.io.http.PathwayWebserver` can now enable CORS on the added endpoints.
1111

12+
### Changed
13+
- `pw.run` now takes additional parameter `runtime_typechecking` allowing to enable strict type checking at runtime.
14+
- **BREAKING**: `pw.run` and `pw.run_all` now take only keyword arguments.
15+
1216
### Fixed
1317
- Returning `pw.Duration` from UDFs or using them as constant values no longer results in errors.
1418

@@ -28,7 +32,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
2832
- `pw.io.http.rest_connector` now also accepts port as a string for backwards compatibility.
2933
- `pw.stdlib.ml.index.KNNIndex` now sorts by distance by default.
3034

31-
3235
## [0.7.8] - 2024-01-18
3336

3437
### Added

python/pathway/internals/run.py

+23
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010

1111
@check_arg_types
1212
def run(
13+
*,
1314
debug: bool = False,
1415
monitoring_level: MonitoringLevel = MonitoringLevel.AUTO,
1516
with_http_server: bool = False,
1617
default_logging: bool = True,
1718
persistence_config: PersistenceConfig | None = None,
19+
runtime_typechecking: bool | None = None,
1820
):
1921
"""Runs the computation graph.
2022
@@ -30,6 +32,7 @@ def run(
3032
it to False if you want to set your own logging handler.
3133
persistence_config: the config for persisting the state in case this
3234
persistence is required.
35+
runtime_typechecking: enables additional strict type checking at runtime
3336
"""
3437
GraphRunner(
3538
parse_graph.G,
@@ -38,22 +41,42 @@ def run(
3841
with_http_server=with_http_server,
3942
default_logging=default_logging,
4043
persistence_config=persistence_config,
44+
runtime_typechecking=runtime_typechecking,
4145
).run_outputs()
4246

4347

4448
@check_arg_types
4549
def run_all(
50+
*,
4651
debug: bool = False,
4752
monitoring_level: MonitoringLevel = MonitoringLevel.AUTO,
4853
with_http_server: bool = False,
4954
default_logging: bool = True,
55+
persistence_config: PersistenceConfig | None = None,
5056
runtime_typechecking: bool | None = None,
5157
):
58+
"""Runs the computation graph with disabled tree-shaking optimization.
59+
60+
Args:
61+
debug: enable output out of table.debug() operators
62+
monitoring_level: the verbosity of stats monitoring mechanism. One of
63+
pathway.MonitoringLevel.NONE, pathway.MonitoringLevel.IN_OUT,
64+
pathway.MonitoringLevel.ALL. If unset, pathway will choose between
65+
NONE and IN_OUT based on output interactivity.
66+
with_http_server: whether to start a http server with runtime metrics. Learn
67+
more in a `tutorial </developers/user-guide/deployment/prometheus-monitoring/>`_ .
68+
default_logging: whether to allow pathway to set its own logging handler. Set
69+
it to False if you want to set your own logging handler.
70+
persistence_config: the config for persisting the state in case this
71+
persistence is required.
72+
runtime_typechecking: enables additional strict type checking at runtime
73+
"""
5274
GraphRunner(
5375
parse_graph.G,
5476
debug=debug,
5577
monitoring_level=monitoring_level,
5678
with_http_server=with_http_server,
5779
default_logging=default_logging,
80+
persistence_config=persistence_config,
5881
runtime_typechecking=runtime_typechecking,
5982
).run_all()

python/pathway/tests/test_common.py

+5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
import functools
6+
import inspect
67
import os
78
import pathlib
89
import re
@@ -6077,3 +6078,7 @@ def test_reducers_ix(reducer, expected, expected_type):
60776078
)
60786079

60796080
assert_table_equality_wo_index(result, expected)
6081+
6082+
6083+
def test_pw_run_signature():
6084+
assert inspect.signature(pw.run) == inspect.signature(pw.run_all)

0 commit comments

Comments
 (0)