Skip to content

Commit

Permalink
remove deprecated stuff (#8010)
Browse files Browse the repository at this point in the history
Co-authored-by: Przemysław Uznański <[email protected]>
GitOrigin-RevId: 4a7d0ed61bb3ea86083c1f1b55b62cd9b476a56b
  • Loading branch information
2 people authored and Manul from Pathway committed Jan 16, 2025
1 parent b9c6322 commit df99875
Show file tree
Hide file tree
Showing 24 changed files with 27 additions and 1,035 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### Fixed
- `generate_class` method in `Schema` now correctly renders columns of `UnionType` and `None` types.

### Removed
- **BREAKING**: Removed deprecated methods `pw.Table.unsafe_promise_same_universe_as`, `pw.Table.unsafe_promise_universes_are_pairwise_disjoint`, `pw.Table.unsafe_promise_universe_is_subset_of`, `pw.Table.left_join`, `pw.Table.right_join`, `pw.Table.outer_join`, `pw.stdlib.utils.AsyncTransformer.result`.
- **BREAKING**: Removed deprecated column `_pw_shard` in the result of `windowby`.
- **BREAKING**: Removed deprecated functions `pw.debug.parse_to_table`, `pw.udf_async`, `pw.reducers.npsum`, `pw.reducers.int_sum`, `pw.stdlib.utils.col.flatten_column`.
- **BREAKING**: Removed deprecated module `pw.asynchronous`.
- **BREAKING**: Removed deprecated access to functions from `pw.io` in `pw`.
- **BREAKING**: Removed deprecated classes `pw.UDFSync`, `pw.UDFAsync`.

## [0.16.4] - 2025-01-09

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ if __name__ == "__main__":
session_finish=pw.reducers.max(table.access_time),
count=pw.reducers.count(),
)
pw.csv.write(sessions, "sessions.csv")
pw.io.csv.write(sessions, "sessions.csv")
pw.run(monitoring_level=pw.MonitoringLevel.NONE)
```

Expand Down
2 changes: 1 addition & 1 deletion docs/2.developers/7.templates/.option-greeks/article.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ def compute_rho(F: float, K: float, T: float, sigma: float, d1: float, d2: float
#
# As an example, you might want to send the results to a CSV file, using Pathway CSV output connector:

pw.csv.write(table_greeks, "./options-greeks.csv")
pw.io.csv.write(table_greeks, "./options-greeks.csv")

# Now, all you need it to run the computation:

Expand Down
4 changes: 2 additions & 2 deletions examples/notebooks/tutorials/option-greeks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,7 @@
"metadata": {},
"outputs": [],
"source": [
"pw.csv.write(table_greeks, \"./options-greeks.csv\")"
"pw.io.csv.write(table_greeks, \"./options-greeks.csv\")"
]
},
{
Expand Down Expand Up @@ -1275,4 +1275,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
62 changes: 1 addition & 61 deletions python/pathway/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import pathway.reducers as reducers
import pathway.universes as universes
from pathway import asynchronous, debug, demo, io, udfs
from pathway import debug, demo, io, udfs
from pathway.internals import (
UDF,
ColumnExpression,
Expand All @@ -29,8 +29,6 @@
Table,
TableLike,
TableSlice,
UDFAsync,
UDFSync,
__version__,
apply,
apply_async,
Expand Down Expand Up @@ -69,7 +67,6 @@
table_transformer,
this,
udf,
udf_async,
unwrap,
wrap_py_object,
)
Expand Down Expand Up @@ -102,10 +99,7 @@
"ml",
"apply",
"udf",
"udf_async",
"UDF",
"UDFAsync",
"UDFSync",
"apply_async",
"apply_with_type",
"declare_type",
Expand Down Expand Up @@ -186,60 +180,6 @@
"load_yaml",
]


def __getattr__(name: str):
from warnings import warn

old_io_names = [
"csv",
"debezium",
"elasticsearch",
"http",
"jsonlines",
"kafka",
"logstash",
"null",
"plaintext",
"postgres",
"python",
"redpanda",
"subscribe",
"s3_csv",
]

legacy_names = [
"ALL",
"FILES",
"FOLDERS",
"File",
"Folder",
"PathError",
"PathObject",
"SomethingElse",
"new",
]

if name in old_io_names:
old_name = f"{__name__}.{name}"
new_name = f"{__name__}.io.{name}"
warn(
f"{old_name!r} has been moved to {new_name!r}",
DeprecationWarning,
stacklevel=2,
)
return getattr(io, name)

error = f"module {__name__!r} has no attribute {name!r}"
warning = None

if name in legacy_names:
warning = "For help with legacy packages, reach out to the team at pathway.com."
error += "\n" + warning
warn(warning, stacklevel=2)

raise AttributeError(error)


Table.asof_join = temporal.asof_join
Table.asof_join_left = temporal.asof_join_left
Table.asof_join_right = temporal.asof_join_right
Expand Down
44 changes: 0 additions & 44 deletions python/pathway/asynchronous.py

This file was deleted.

10 changes: 0 additions & 10 deletions python/pathway/debug/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,16 +454,6 @@ def table_from_markdown(
)


def parse_to_table(*args, **kwargs) -> Table:
warn(
"pw.debug.parse_to_table is deprecated, use pw.debug.table_from_markdown instead",
DeprecationWarning,
stacklevel=2,
)
kwargs["_stacklevel"] = 2
return table_from_markdown(*args, **kwargs)


@check_arg_types
def table_from_parquet(
path: str | PathLike,
Expand Down
5 changes: 1 addition & 4 deletions python/pathway/internals/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
from pathway.internals.table_like import TableLike
from pathway.internals.table_slice import TableSlice
from pathway.internals.thisclass import left, right, this
from pathway.internals.udfs import UDF, UDFAsync, UDFSync, udf, udf_async
from pathway.internals.udfs import UDF, udf
from pathway.internals.version import __version__
from pathway.internals.yaml_loader import load_yaml

Expand All @@ -81,10 +81,7 @@
"reducers",
"apply",
"udf",
"udf_async",
"UDF",
"UDFAsync",
"UDFSync",
"apply_async",
"apply_with_type",
"attribute",
Expand Down
35 changes: 0 additions & 35 deletions python/pathway/internals/arg_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from __future__ import annotations

from functools import wraps
from warnings import warn

import pathway.internals.expression as expr
from pathway.internals.join_mode import JoinMode
Expand Down Expand Up @@ -70,40 +69,6 @@ def windowby_handler(
}


def shard_deprecation(self, *args, shard=None, instance=None, **kwargs):
if shard is not None:
if instance is None:
instance = shard
warn(
"The `shard` argument is deprecated. Please use `instance` instead.",
DeprecationWarning,
stacklevel=6,
)
else:
raise ValueError(
"The arguments `shard` and `instance` cannot be set at the same moment.\n"
+ "Please use `instance` only, as `shard` is deprecated."
)
return (self, *args), {"instance": instance, **kwargs}


def offset_deprecation(*args, offset=None, origin=None, **kwargs):
if offset is not None:
if origin is None:
origin = offset
warn(
"The `offset` argument is deprecated. Please use `origin` instead.",
DeprecationWarning,
stacklevel=7,
)
else:
raise ValueError(
"The arguments `offset` and `instance` cannot be set at the same moment.\n"
+ "Please use `origin` only, as `origin` is deprecated."
)
return args, {"origin": origin, **kwargs}


def join_kwargs_handler(*, allow_how: bool, allow_id: bool):
def handler(self, other, *on, **kwargs):
processed_kwargs = {}
Expand Down
69 changes: 3 additions & 66 deletions python/pathway/internals/deprecation_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,9 @@

class DeprecationMetaclass(type):
def __getattr__(cls, name):
from pathway.internals.table import Joinable, Table, TableLike

def _unsafe_promise_universe_is_subset_of(self, *others):
for other in others:
TableLike.promise_universe_is_subset_of(self, other)
return self
from pathway.internals.table import Table

RENAMES = {
"unsafe_promise_same_universe_as": (
Table,
"with_universe_of",
Table.with_universe_of,
),
"unsafe_promise_universes_are_pairwise_disjoint": (
TableLike,
"promise_are_pairwise_disjoint",
TableLike.promise_universes_are_disjoint,
),
"unsafe_promise_universe_is_subset_of": (
TableLike,
"promise_universe_is_subset_of",
_unsafe_promise_universe_is_subset_of,
),
"left_join": (Joinable, "join_left", Joinable.join_left),
"right_join": (Joinable, "join_right", Joinable.join_right),
"outer_join": (Joinable, "join_outer", Joinable.join_outer),
"update_columns": (Table, "with_columns", Table.with_columns),
}
if name in RENAMES:
Expand All @@ -48,9 +25,7 @@ def _unsafe_promise_universe_is_subset_of(self, *others):

class DeprecationSuperclass(metaclass=DeprecationMetaclass):
def _column_deprecation_rename(self, name):
from pathway.internals.table import Table

RENAMES = {"_pw_shard": (Table, "_pw_instance")}
RENAMES: dict[str, tuple[type, str]] = {}
if name in RENAMES:
base_cls, new_name = RENAMES[name]
if isinstance(self, base_cls):
Expand All @@ -66,50 +41,12 @@ def _column_deprecation_rename(self, name):
return name

def __getattr__(self, name):
from pathway.internals.table import Joinable, Table, TableLike

def _unsafe_promise_same_universe_as(other):
return self.with_universe_of(other)

def _unsafe_promise_universes_are_pairwise_disjoint(*others):
return self.promise_universes_are_disjoint(*others)

def _unsafe_promise_universe_is_subset_of(*others):
for other in others:
self.promise_universe_is_subset_of(other)
return self

def _left_join(other, *args, **kwargs):
return self.join_left(other, *args, **kwargs)

def _right_join(other, *args, **kwargs):
return self.join_right(other, *args, **kwargs)

def _outer_join(other, *args, **kwargs):
return self.join_outer(other, *args, **kwargs)
from pathway.internals.table import Table

def _update_columns(*args, **kwargs):
return Table.with_columns(self, *args, **kwargs)

RENAMES = {
"unsafe_promise_same_universe_as": (
Table,
"with_universe_of",
_unsafe_promise_same_universe_as,
),
"unsafe_promise_universes_are_pairwise_disjoint": (
TableLike,
"promise_are_pairwise_disjoint",
_unsafe_promise_universes_are_pairwise_disjoint,
),
"unsafe_promise_universe_is_subset_of": (
TableLike,
"promise_universe_is_subset_of",
_unsafe_promise_universe_is_subset_of,
),
"left_join": (Joinable, "join_left", _left_join),
"right_join": (Joinable, "join_right", _right_join),
"outer_join": (Joinable, "join_outer", _outer_join),
"update_columns": (Table, "with_columns", _update_columns),
}
if name in RENAMES:
Expand Down
Loading

0 comments on commit df99875

Please sign in to comment.