cognite-kuiper 0.18.1__cp313-cp313-macosx_11_0_arm64.whl
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.
- cognite_kuiper-0.18.1.dist-info/METADATA +69 -0
- cognite_kuiper-0.18.1.dist-info/RECORD +7 -0
- cognite_kuiper-0.18.1.dist-info/WHEEL +4 -0
- kuiper/__init__.py +17 -0
- kuiper/kuiper.cpython-313-darwin.so +0 -0
- kuiper/kuiper.pyi +15 -0
- kuiper/py.typed +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cognite-kuiper
|
|
3
|
+
Version: 0.18.1
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Programming Language :: Rust
|
|
6
|
+
Classifier: Programming Language :: Python
|
|
7
|
+
Requires-Dist: pytest ; extra == 'test'
|
|
8
|
+
Provides-Extra: test
|
|
9
|
+
Summary: A JSON to JSON transform and templating language from Cognite
|
|
10
|
+
Keywords: JSON,transformation
|
|
11
|
+
Author-email: Mathias Lohne <mathias.lohne@cognite.com>
|
|
12
|
+
Maintainer-email: Mathias Lohne <mathias.lohne@cognite.com>
|
|
13
|
+
License: Apache-2.0
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
16
|
+
Project-URL: homepage, https://cognite.com
|
|
17
|
+
Project-URL: repository, https://github.com/cognitedata/kuiper
|
|
18
|
+
|
|
19
|
+
# Python bindings for Kuiper
|
|
20
|
+
|
|
21
|
+
Python bindings for Kuiper so you can compile and run transformations from a
|
|
22
|
+
Python runtime.
|
|
23
|
+
|
|
24
|
+
``` python
|
|
25
|
+
from kuiper import compile_expression
|
|
26
|
+
|
|
27
|
+
expression = compile_expression('{"theAnswer": input.numericValue + 27}', ["input"])
|
|
28
|
+
value = expression.run('{"numericValue": 15}')
|
|
29
|
+
print(value)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The `compile_expression` function might raise a `KuiperCompileError`, and
|
|
33
|
+
otherwise returns a `KuiperExpression` object. The `KuiperExpression.run(...)`
|
|
34
|
+
method might raise a `KuiperRuntimeError`. Both of these exceptions are
|
|
35
|
+
subclasses of the `KuiperError` base class.
|
|
36
|
+
|
|
37
|
+
## Development
|
|
38
|
+
|
|
39
|
+
We use [PyO3](https://pyo3.rs) to create the bindings.
|
|
40
|
+
|
|
41
|
+
This project uses [maturin](https://www.maturin.rs/) to manage dependencies and
|
|
42
|
+
such, instead of poetry. To set up your local development environment, first
|
|
43
|
+
make sure maturin is installed:
|
|
44
|
+
|
|
45
|
+
``` commanline
|
|
46
|
+
pip install -U maturin
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Then, you can enter or exit a virtual environment with the `kuiper` package
|
|
50
|
+
installed by sourcing the `enter.sh` or `exit.sh` scripts:
|
|
51
|
+
|
|
52
|
+
``` commandline
|
|
53
|
+
source enter.sh
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
``` commandline
|
|
57
|
+
source exit.sh
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Whenever you change the code, you need to rebuild. Instead of using `cargo`
|
|
61
|
+
directly, use `maturin`:
|
|
62
|
+
|
|
63
|
+
``` commandline
|
|
64
|
+
maturin develop
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
This will build and install the python package into the current environment,
|
|
68
|
+
which is the virtual environment created by the `enter.sh` script.
|
|
69
|
+
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
cognite_kuiper-0.18.1.dist-info/METADATA,sha256=FWHKABGXiBXqlLn_yDFMr2f_7ihbZM52e9VKR6kg194,2075
|
|
2
|
+
cognite_kuiper-0.18.1.dist-info/WHEEL,sha256=V0PyzvBcSARU334gfbMpVsvFu6xR7hFdhQVohqdzf7E,105
|
|
3
|
+
kuiper/__init__.py,sha256=AAn8YXHCMW4EL5okpVW71cwmTYg608hpp7FJDUnafo0,611
|
|
4
|
+
kuiper/kuiper.cpython-313-darwin.so,sha256=XumFgQH_jCkYTqKbsH4NEamQghYqcznNdJaL0S69D7c,3782480
|
|
5
|
+
kuiper/kuiper.pyi,sha256=RW6RQDiC8LnaHs5DDRg-bUYIhuUm8O0Q-fZyW4nGz_4,453
|
|
6
|
+
kuiper/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
cognite_kuiper-0.18.1.dist-info/RECORD,,
|
kuiper/__init__.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Kuiper is a JSON to JSON transform and templating language from Cognite.
|
|
3
|
+
|
|
4
|
+
.. code-block:: python
|
|
5
|
+
|
|
6
|
+
from kuiper import compile_expression
|
|
7
|
+
|
|
8
|
+
expression = compile_expression('{"theAnswer": input.numericValue + 27}', ["input"])
|
|
9
|
+
value = expression.run('{"numericValue": 15}')
|
|
10
|
+
print(value)
|
|
11
|
+
|
|
12
|
+
The ``compile_expression`` function might raise a ``KuiperCompileError``, and otherwise returns a ``KuiperExpression``
|
|
13
|
+
object. The ``KuiperExpression.run(...)`` method might raise a ``KuiperRuntimeError``. Both of these exceptions are
|
|
14
|
+
subclasses of the ``KuiperError`` base class.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from .kuiper import *
|
|
Binary file
|
kuiper/kuiper.pyi
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class KuiperError(BaseException):
|
|
2
|
+
start: int | None
|
|
3
|
+
end: int | None
|
|
4
|
+
...
|
|
5
|
+
|
|
6
|
+
class KuiperCompileError(KuiperError): ...
|
|
7
|
+
class KuiperRuntimeError(KuiperError): ...
|
|
8
|
+
|
|
9
|
+
class KuiperExpression:
|
|
10
|
+
def run(self, input: str) -> str: ...
|
|
11
|
+
def run_multiple_inputs(self, inputs: list[str]) -> str: ...
|
|
12
|
+
|
|
13
|
+
def compile_expression(
|
|
14
|
+
expression: str, inputs: list[str], optimizer_operation_limit=100000, max_macro_expansions=20
|
|
15
|
+
) -> KuiperExpression: ...
|
kuiper/py.typed
ADDED
|
File without changes
|