kernable-sdk 0.1.0__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.
- kernable_sdk-0.1.0/LICENSE +21 -0
- kernable_sdk-0.1.0/PKG-INFO +82 -0
- kernable_sdk-0.1.0/README.md +56 -0
- kernable_sdk-0.1.0/kernable/__init__.py +3923 -0
- kernable_sdk-0.1.0/kernable/__main__.py +7 -0
- kernable_sdk-0.1.0/kernable/cli.py +106 -0
- kernable_sdk-0.1.0/kernable/messages.py +199 -0
- kernable_sdk-0.1.0/kernable/processes.py +349 -0
- kernable_sdk-0.1.0/kernable/signing.py +221 -0
- kernable_sdk-0.1.0/kernable/store.py +149 -0
- kernable_sdk-0.1.0/kernable/v1/kernable_pb2.py +222 -0
- kernable_sdk-0.1.0/kernable/v1/kernable_pb2_grpc.py +1627 -0
- kernable_sdk-0.1.0/kernable_sdk.egg-info/PKG-INFO +82 -0
- kernable_sdk-0.1.0/kernable_sdk.egg-info/SOURCES.txt +29 -0
- kernable_sdk-0.1.0/kernable_sdk.egg-info/dependency_links.txt +1 -0
- kernable_sdk-0.1.0/kernable_sdk.egg-info/entry_points.txt +2 -0
- kernable_sdk-0.1.0/kernable_sdk.egg-info/requires.txt +3 -0
- kernable_sdk-0.1.0/kernable_sdk.egg-info/top_level.txt +1 -0
- kernable_sdk-0.1.0/pyproject.toml +40 -0
- kernable_sdk-0.1.0/setup.cfg +4 -0
- kernable_sdk-0.1.0/tests/test_addresses.py +97 -0
- kernable_sdk-0.1.0/tests/test_app.py +130 -0
- kernable_sdk-0.1.0/tests/test_deployments.py +224 -0
- kernable_sdk-0.1.0/tests/test_hostile.py +86 -0
- kernable_sdk-0.1.0/tests/test_instances.py +101 -0
- kernable_sdk-0.1.0/tests/test_keys.py +215 -0
- kernable_sdk-0.1.0/tests/test_parking.py +159 -0
- kernable_sdk-0.1.0/tests/test_partitions.py +151 -0
- kernable_sdk-0.1.0/tests/test_processes.py +101 -0
- kernable_sdk-0.1.0/tests/test_scheduled.py +96 -0
- kernable_sdk-0.1.0/tests/test_sdk.py +1391 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 kernable (proprietor: Artur Susdorf)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kernable-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: kernable SDK for Python: event-sourced business logic in Python on the kernable kernel
|
|
5
|
+
Author: kernable
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://kernable.com
|
|
8
|
+
Project-URL: Documentation, https://kernable.com/docs/
|
|
9
|
+
Project-URL: Repository, https://github.com/kernable/kernable
|
|
10
|
+
Project-URL: Issues, https://github.com/kernable/kernable/issues
|
|
11
|
+
Keywords: event-sourcing,cqrs,grpc,kernable,sdk
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: MacOS
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Topic :: Database
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: grpcio>=1.85
|
|
23
|
+
Requires-Dist: protobuf<8,>=7.35.1
|
|
24
|
+
Requires-Dist: cryptography>=43
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# kernable-sdk
|
|
28
|
+
|
|
29
|
+
Event sourcing and CQRS with a Rust kernel and business logic in any language. This is the
|
|
30
|
+
Python SDK: aggregates, read models, reactors, middleware and business processes in Python, run by
|
|
31
|
+
the [kernable](https://github.com/kernable/kernable) kernel. The TypeScript, Python and Rust SDKs
|
|
32
|
+
share one API.
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
pip install kernable-sdk # Python 3.10 or newer; import it as `kernable`
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Start a kernel (macOS and Linux):
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
curl -fsSL https://kernable.com/install.sh | sh
|
|
42
|
+
kernable start --dev # a kernel on 127.0.0.1:7233, its UI on :7234, keys in this directory
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
A worker that decides on a cart's commands:
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from kernable import Kernable, Rejected, domain
|
|
49
|
+
|
|
50
|
+
cart = domain("shop").aggregate("cart", {"items": 0})
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@cart.apply("ItemAdded")
|
|
54
|
+
def _(state, data):
|
|
55
|
+
state["items"] += data["qty"]
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@cart.command("AddItem")
|
|
59
|
+
def _(state, data):
|
|
60
|
+
if data["qty"] < 1:
|
|
61
|
+
raise Rejected("At least one")
|
|
62
|
+
return [{"type": "ItemAdded", "data": data}]
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
Kernable(key="app.key").worker(cart).run()
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The [getting-started guide](https://kernable.com/docs/tutorial/getting-started) goes on from
|
|
69
|
+
here: a read model, a query that reads its own writes, the same in the other languages. Then
|
|
70
|
+
[build a shop](https://kernable.com/docs/tutorial/shop/) in ten parts, and the
|
|
71
|
+
[Python reference](https://kernable.com/docs/reference/sdk-python).
|
|
72
|
+
|
|
73
|
+
`kernable-sdk add kit` copies the kits (tenancy, accounts, identities, groups, invitations and
|
|
74
|
+
authorization) into your project as code you own: see [Kits](https://kernable.com/docs/kits/).
|
|
75
|
+
|
|
76
|
+
kernable is before 1.0: the protocol and the APIs may still change between 0.x releases. MIT
|
|
77
|
+
license.
|
|
78
|
+
|
|
79
|
+
## Developing this SDK
|
|
80
|
+
|
|
81
|
+
From the repository root, `make py` makes the venv and generates the gRPC stubs in
|
|
82
|
+
`kernable/v1/` (not checked in); `make test` and `make check-sdks` run the tests.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# kernable-sdk
|
|
2
|
+
|
|
3
|
+
Event sourcing and CQRS with a Rust kernel and business logic in any language. This is the
|
|
4
|
+
Python SDK: aggregates, read models, reactors, middleware and business processes in Python, run by
|
|
5
|
+
the [kernable](https://github.com/kernable/kernable) kernel. The TypeScript, Python and Rust SDKs
|
|
6
|
+
share one API.
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
pip install kernable-sdk # Python 3.10 or newer; import it as `kernable`
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Start a kernel (macOS and Linux):
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
curl -fsSL https://kernable.com/install.sh | sh
|
|
16
|
+
kernable start --dev # a kernel on 127.0.0.1:7233, its UI on :7234, keys in this directory
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
A worker that decides on a cart's commands:
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from kernable import Kernable, Rejected, domain
|
|
23
|
+
|
|
24
|
+
cart = domain("shop").aggregate("cart", {"items": 0})
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@cart.apply("ItemAdded")
|
|
28
|
+
def _(state, data):
|
|
29
|
+
state["items"] += data["qty"]
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@cart.command("AddItem")
|
|
33
|
+
def _(state, data):
|
|
34
|
+
if data["qty"] < 1:
|
|
35
|
+
raise Rejected("At least one")
|
|
36
|
+
return [{"type": "ItemAdded", "data": data}]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
Kernable(key="app.key").worker(cart).run()
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The [getting-started guide](https://kernable.com/docs/tutorial/getting-started) goes on from
|
|
43
|
+
here: a read model, a query that reads its own writes, the same in the other languages. Then
|
|
44
|
+
[build a shop](https://kernable.com/docs/tutorial/shop/) in ten parts, and the
|
|
45
|
+
[Python reference](https://kernable.com/docs/reference/sdk-python).
|
|
46
|
+
|
|
47
|
+
`kernable-sdk add kit` copies the kits (tenancy, accounts, identities, groups, invitations and
|
|
48
|
+
authorization) into your project as code you own: see [Kits](https://kernable.com/docs/kits/).
|
|
49
|
+
|
|
50
|
+
kernable is before 1.0: the protocol and the APIs may still change between 0.x releases. MIT
|
|
51
|
+
license.
|
|
52
|
+
|
|
53
|
+
## Developing this SDK
|
|
54
|
+
|
|
55
|
+
From the repository root, `make py` makes the venv and generates the gRPC stubs in
|
|
56
|
+
`kernable/v1/` (not checked in); `make test` and `make check-sdks` run the tests.
|