foundry-dev-tools-transforms 2.1.9__tar.gz → 2.1.10__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: foundry-dev-tools-transforms
3
- Version: 2.1.9
3
+ Version: 2.1.10
4
4
  Summary: Seamlessly run your Palantir Foundry Repository transforms code on your local machine.
5
5
  Author-Email: Nicolas Renkamp <nicolas.renkamp@merckgroup.com>, Jonas Wunderlich <jonas.wunderlich@merckgroup.com>
6
6
  License: Apache-2.0
@@ -34,7 +34,7 @@ dependencies = [
34
34
  "fs",
35
35
  ]
36
36
  dynamic = []
37
- version = "2.1.9"
37
+ version = "2.1.10"
38
38
 
39
39
  [project.license]
40
40
  text = "Apache-2.0"
@@ -0,0 +1 @@
1
+ __version__ = '2.1.10'
@@ -16,6 +16,10 @@ from transforms.api._transform import Transform
16
16
  if TYPE_CHECKING:
17
17
  from collections.abc import Callable
18
18
 
19
+ import pandas as pd
20
+ import polars as pl
21
+ import pyspark.sql
22
+
19
23
 
20
24
  def lightweight(
21
25
  _maybe_transform: Transform | None = None,
@@ -113,7 +117,7 @@ def lightweight(
113
117
  return _lightweight if _maybe_transform is None else _lightweight(_maybe_transform)
114
118
 
115
119
 
116
- def transform_polars(output: Output, **inputs) -> Callable[[Callable], Transform]:
120
+ def transform_polars(output: Output, **inputs: Input) -> Callable[[Callable[..., pl.DataFrame]], Transform]:
117
121
  """Register the wrapped compute function as a Polars transform.
118
122
 
119
123
  Note:
@@ -143,7 +147,7 @@ def transform_polars(output: Output, **inputs) -> Callable[[Callable], Transform
143
147
  **inputs (Input): kwargs comprised of named :class:`Input` specs.
144
148
  """
145
149
 
146
- def _transform_polars(compute_function: Callable) -> Transform:
150
+ def _transform_polars(compute_function: Callable[..., pl.DataFrame]) -> Transform:
147
151
  return Transform(
148
152
  compute_function,
149
153
  outputs={"output": output},
@@ -154,7 +158,7 @@ def transform_polars(output: Output, **inputs) -> Callable[[Callable], Transform
154
158
  return _transform_polars
155
159
 
156
160
 
157
- def transform_df(output: Output, **inputs) -> Callable[[Callable], Transform]:
161
+ def transform_df(output: Output, **inputs: Input) -> Callable[[Callable[..., pyspark.sql.DataFrame]], Transform]:
158
162
  """Register the wrapped compute function as a dataframe transform.
159
163
 
160
164
  The ``transform_df`` decorator is used to construct a :class:`Transform` object from
@@ -180,13 +184,13 @@ def transform_df(output: Output, **inputs) -> Callable[[Callable], Transform]:
180
184
  **inputs (Input): kwargs comprised of named :class:`Input` specs.
181
185
  """
182
186
 
183
- def _transform_df(compute_func: Callable) -> Transform:
187
+ def _transform_df(compute_func: Callable[..., pyspark.sql.DataFrame]) -> Transform:
184
188
  return Transform(compute_func, {"output": output}, inputs=inputs, decorator="spark")
185
189
 
186
190
  return _transform_df
187
191
 
188
192
 
189
- def transform_pandas(output: Output, **inputs) -> Callable[[Callable], Transform]:
193
+ def transform_pandas(output: Output, **inputs: Input) -> Callable[[Callable[..., pd.DataFrame]], Transform]:
190
194
  """Register the wrapped compute function as a Pandas transform.
191
195
 
192
196
  The ``transform_pandas`` decorator is used to construct a :class:`Transform` object from
@@ -211,13 +215,13 @@ def transform_pandas(output: Output, **inputs) -> Callable[[Callable], Transform
211
215
  **inputs (Input): kwargs comprised of named :class:`Input` specs.
212
216
  """
213
217
 
214
- def _transform_pandas(compute_func: Callable) -> Transform:
218
+ def _transform_pandas(compute_func: Callable[..., pd.DataFrame]) -> Transform:
215
219
  return Transform(compute_func, {"output": output}, inputs=inputs, decorator="pandas")
216
220
 
217
221
  return _transform_pandas
218
222
 
219
223
 
220
- def transform(**kwargs) -> Callable[[Callable], Transform]:
224
+ def transform(**kwargs: Input | Output) -> Callable[[Callable[..., None]], Transform]:
221
225
  """Wrap up a compute function as a Transform object.
222
226
 
223
227
  >>> from transforms.api import transform, Input, Output
@@ -239,7 +243,7 @@ def transform(**kwargs) -> Callable[[Callable], Transform]:
239
243
  The compute function is responsible for writing data to its outputs.
240
244
  """
241
245
 
242
- def _transform(compute_func: Callable) -> Transform:
246
+ def _transform(compute_func: Callable[..., None]) -> Transform:
243
247
  return Transform(
244
248
  compute_func,
245
249
  outputs={k: v for k, v in kwargs.items() if isinstance(v, Output)},
@@ -1 +0,0 @@
1
- __version__ = '2.1.9'