borgee-plugin-sdk 0.1.2__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.
- borgee_plugin_sdk-0.1.2/LICENSE +21 -0
- borgee_plugin_sdk-0.1.2/PKG-INFO +72 -0
- borgee_plugin_sdk-0.1.2/README.md +46 -0
- borgee_plugin_sdk-0.1.2/pyproject.toml +58 -0
- borgee_plugin_sdk-0.1.2/setup.cfg +4 -0
- borgee_plugin_sdk-0.1.2/src/borgee_plugin_sdk/__init__.py +83 -0
- borgee_plugin_sdk-0.1.2/src/borgee_plugin_sdk/_connection.py +1680 -0
- borgee_plugin_sdk-0.1.2/src/borgee_plugin_sdk/_wire/__init__.py +5 -0
- borgee_plugin_sdk-0.1.2/src/borgee_plugin_sdk/_wire/frames_generated.py +272 -0
- borgee_plugin_sdk-0.1.2/src/borgee_plugin_sdk/client.py +400 -0
- borgee_plugin_sdk-0.1.2/src/borgee_plugin_sdk/cursor.py +220 -0
- borgee_plugin_sdk-0.1.2/src/borgee_plugin_sdk/errors.py +61 -0
- borgee_plugin_sdk-0.1.2/src/borgee_plugin_sdk/models.py +326 -0
- borgee_plugin_sdk-0.1.2/src/borgee_plugin_sdk/py.typed +1 -0
- borgee_plugin_sdk-0.1.2/src/borgee_plugin_sdk/testing/__init__.py +16 -0
- borgee_plugin_sdk-0.1.2/src/borgee_plugin_sdk/testing/fake_transport.py +125 -0
- borgee_plugin_sdk-0.1.2/src/borgee_plugin_sdk.egg-info/PKG-INFO +72 -0
- borgee_plugin_sdk-0.1.2/src/borgee_plugin_sdk.egg-info/SOURCES.txt +26 -0
- borgee_plugin_sdk-0.1.2/src/borgee_plugin_sdk.egg-info/dependency_links.txt +1 -0
- borgee_plugin_sdk-0.1.2/src/borgee_plugin_sdk.egg-info/requires.txt +11 -0
- borgee_plugin_sdk-0.1.2/src/borgee_plugin_sdk.egg-info/top_level.txt +1 -0
- borgee_plugin_sdk-0.1.2/tests/test_connection_unit.py +413 -0
- borgee_plugin_sdk-0.1.2/tests/test_cursor_store.py +207 -0
- borgee_plugin_sdk-0.1.2/tests/test_models_and_client.py +132 -0
- borgee_plugin_sdk-0.1.2/tests/test_task_crud.py +239 -0
- borgee_plugin_sdk-0.1.2/tests/test_verify_installed_sdk.py +63 -0
- borgee_plugin_sdk-0.1.2/tests/test_websocket_integration.py +1442 -0
- borgee_plugin_sdk-0.1.2/tests/test_wire_contract.py +37 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Borgee contributors
|
|
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,72 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: borgee-plugin-sdk
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Async Python SDK for Borgee plugin runtimes
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Classifier: Development Status :: 3 - Alpha
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
11
|
+
Classifier: Typing :: Typed
|
|
12
|
+
Requires-Python: <3.14,>=3.11
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: websockets==15.0.1
|
|
16
|
+
Provides-Extra: test
|
|
17
|
+
Requires-Dist: build==1.2.2.post1; extra == "test"
|
|
18
|
+
Requires-Dist: mypy==1.17.0; extra == "test"
|
|
19
|
+
Requires-Dist: PyYAML==6.0.2; extra == "test"
|
|
20
|
+
Requires-Dist: pytest==9.0.3; extra == "test"
|
|
21
|
+
Requires-Dist: pytest-asyncio==1.3.0; extra == "test"
|
|
22
|
+
Requires-Dist: pytest-timeout==2.4.0; extra == "test"
|
|
23
|
+
Requires-Dist: ruff==0.12.4; extra == "test"
|
|
24
|
+
Requires-Dist: twine==6.1.0; extra == "test"
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# Borgee Plugin SDK for Python
|
|
28
|
+
|
|
29
|
+
`borgee-plugin-sdk` connects a Python runtime to Borgee over the Borgee Plugin
|
|
30
|
+
Protocol (BPP). It supports Python 3.11 through 3.13 and pins
|
|
31
|
+
`websockets==15.0.1` because the connection hardening depends on that exact
|
|
32
|
+
client implementation.
|
|
33
|
+
|
|
34
|
+
Build a wheel from this directory or install the source checkout for evaluation. The repository also provides a manual workflow for publishing to TestPyPI and PyPI.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
python -m pip install .
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
import asyncio
|
|
42
|
+
|
|
43
|
+
from borgee_plugin_sdk import BorgeePluginOptions, ReplayMode, create_borgee_plugin
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
async def main() -> None:
|
|
47
|
+
client = create_borgee_plugin(
|
|
48
|
+
BorgeePluginOptions(
|
|
49
|
+
base_url="https://chat.example.com",
|
|
50
|
+
api_key="bgr_example",
|
|
51
|
+
replay_mode=ReplayMode.LATEST_N,
|
|
52
|
+
)
|
|
53
|
+
)
|
|
54
|
+
async with client:
|
|
55
|
+
async for delivery in client.deliveries():
|
|
56
|
+
print(delivery.event)
|
|
57
|
+
await delivery.checkpoint()
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
asyncio.run(main())
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Every inbound message or replay summary is a `Delivery`. The iterator has one
|
|
64
|
+
consumer, and it will not advance until the consumer calls `checkpoint()` or
|
|
65
|
+
`fail()`. Actions fail while the connection is resuming; replay consumption
|
|
66
|
+
continues until the client becomes online.
|
|
67
|
+
|
|
68
|
+
For local development, insecure transport is restricted to loopback origins and
|
|
69
|
+
requires `allow_insecure_loopback=True`. API keys are sent only in the WebSocket
|
|
70
|
+
`Authorization` header. Redirects are rejected.
|
|
71
|
+
|
|
72
|
+
This package is licensed under the MIT License.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Borgee Plugin SDK for Python
|
|
2
|
+
|
|
3
|
+
`borgee-plugin-sdk` connects a Python runtime to Borgee over the Borgee Plugin
|
|
4
|
+
Protocol (BPP). It supports Python 3.11 through 3.13 and pins
|
|
5
|
+
`websockets==15.0.1` because the connection hardening depends on that exact
|
|
6
|
+
client implementation.
|
|
7
|
+
|
|
8
|
+
Build a wheel from this directory or install the source checkout for evaluation. The repository also provides a manual workflow for publishing to TestPyPI and PyPI.
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
python -m pip install .
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
import asyncio
|
|
16
|
+
|
|
17
|
+
from borgee_plugin_sdk import BorgeePluginOptions, ReplayMode, create_borgee_plugin
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
async def main() -> None:
|
|
21
|
+
client = create_borgee_plugin(
|
|
22
|
+
BorgeePluginOptions(
|
|
23
|
+
base_url="https://chat.example.com",
|
|
24
|
+
api_key="bgr_example",
|
|
25
|
+
replay_mode=ReplayMode.LATEST_N,
|
|
26
|
+
)
|
|
27
|
+
)
|
|
28
|
+
async with client:
|
|
29
|
+
async for delivery in client.deliveries():
|
|
30
|
+
print(delivery.event)
|
|
31
|
+
await delivery.checkpoint()
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
asyncio.run(main())
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Every inbound message or replay summary is a `Delivery`. The iterator has one
|
|
38
|
+
consumer, and it will not advance until the consumer calls `checkpoint()` or
|
|
39
|
+
`fail()`. Actions fail while the connection is resuming; replay consumption
|
|
40
|
+
continues until the client becomes online.
|
|
41
|
+
|
|
42
|
+
For local development, insecure transport is restricted to loopback origins and
|
|
43
|
+
requires `allow_insecure_loopback=True`. API keys are sent only in the WebSocket
|
|
44
|
+
`Authorization` header. Redirects are rejected.
|
|
45
|
+
|
|
46
|
+
This package is licensed under the MIT License.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0,<83", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "borgee-plugin-sdk"
|
|
7
|
+
version = "0.1.2"
|
|
8
|
+
description = "Async Python SDK for Borgee plugin runtimes"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.11,<3.14"
|
|
13
|
+
dependencies = ["websockets==15.0.1"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
|
+
"Typing :: Typed",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[project.optional-dependencies]
|
|
24
|
+
test = [
|
|
25
|
+
"build==1.2.2.post1",
|
|
26
|
+
"mypy==1.17.0",
|
|
27
|
+
"PyYAML==6.0.2",
|
|
28
|
+
"pytest==9.0.3",
|
|
29
|
+
"pytest-asyncio==1.3.0",
|
|
30
|
+
"pytest-timeout==2.4.0",
|
|
31
|
+
"ruff==0.12.4",
|
|
32
|
+
"twine==6.1.0",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[tool.setuptools]
|
|
36
|
+
package-dir = {"" = "src"}
|
|
37
|
+
|
|
38
|
+
[tool.setuptools.packages.find]
|
|
39
|
+
where = ["src"]
|
|
40
|
+
|
|
41
|
+
[tool.pytest.ini_options]
|
|
42
|
+
addopts = "--strict-markers --timeout=30 --timeout-method=signal"
|
|
43
|
+
asyncio_mode = "auto"
|
|
44
|
+
testpaths = ["tests"]
|
|
45
|
+
markers = ["e2e: cross-process tests that build and start the real Go server"]
|
|
46
|
+
|
|
47
|
+
[tool.ruff]
|
|
48
|
+
target-version = "py311"
|
|
49
|
+
line-length = 110
|
|
50
|
+
|
|
51
|
+
[tool.ruff.lint]
|
|
52
|
+
select = ["E", "F", "I", "UP", "B", "ASYNC", "RUF"]
|
|
53
|
+
|
|
54
|
+
[tool.mypy]
|
|
55
|
+
python_version = "3.11"
|
|
56
|
+
strict = true
|
|
57
|
+
warn_unreachable = true
|
|
58
|
+
packages = ["borgee_plugin_sdk"]
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"""Public API for the Borgee Python plugin SDK."""
|
|
2
|
+
|
|
3
|
+
from ._connection import Delivery
|
|
4
|
+
from .client import BorgeePluginClient, BorgeePluginOptions, create_borgee_plugin
|
|
5
|
+
from .cursor import CursorStore, FileCursorStore, MemoryCursorStore
|
|
6
|
+
from .errors import (
|
|
7
|
+
BorgeeError,
|
|
8
|
+
CursorStoreError,
|
|
9
|
+
NotOnlineError,
|
|
10
|
+
PermissionDeniedError,
|
|
11
|
+
PreResumeError,
|
|
12
|
+
ProtocolCapacityError,
|
|
13
|
+
ProtocolError,
|
|
14
|
+
ResumeAckError,
|
|
15
|
+
StaleDeliveryError,
|
|
16
|
+
)
|
|
17
|
+
from .models import (
|
|
18
|
+
MISSING,
|
|
19
|
+
ConfigApplyContext,
|
|
20
|
+
ConfigApplyResult,
|
|
21
|
+
ConfigApplyStatus,
|
|
22
|
+
ConfigUpdate,
|
|
23
|
+
ConnectionState,
|
|
24
|
+
ConnectionStatus,
|
|
25
|
+
CreatedDM,
|
|
26
|
+
FaultReason,
|
|
27
|
+
InboundKind,
|
|
28
|
+
InboundMessageEvent,
|
|
29
|
+
InboundReaction,
|
|
30
|
+
Message,
|
|
31
|
+
ReplayMode,
|
|
32
|
+
ReplaySummaryEvent,
|
|
33
|
+
ResponseFrame,
|
|
34
|
+
SentMessage,
|
|
35
|
+
Task,
|
|
36
|
+
TaskOutcome,
|
|
37
|
+
User,
|
|
38
|
+
UserRole,
|
|
39
|
+
task_from_wire,
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
__version__ = "0.1.2"
|
|
43
|
+
|
|
44
|
+
__all__ = [
|
|
45
|
+
"MISSING",
|
|
46
|
+
"BorgeeError",
|
|
47
|
+
"BorgeePluginClient",
|
|
48
|
+
"BorgeePluginOptions",
|
|
49
|
+
"ConfigApplyContext",
|
|
50
|
+
"ConfigApplyResult",
|
|
51
|
+
"ConfigApplyStatus",
|
|
52
|
+
"ConfigUpdate",
|
|
53
|
+
"ConnectionState",
|
|
54
|
+
"ConnectionStatus",
|
|
55
|
+
"CreatedDM",
|
|
56
|
+
"CursorStore",
|
|
57
|
+
"CursorStoreError",
|
|
58
|
+
"Delivery",
|
|
59
|
+
"FaultReason",
|
|
60
|
+
"FileCursorStore",
|
|
61
|
+
"InboundKind",
|
|
62
|
+
"InboundMessageEvent",
|
|
63
|
+
"InboundReaction",
|
|
64
|
+
"MemoryCursorStore",
|
|
65
|
+
"Message",
|
|
66
|
+
"NotOnlineError",
|
|
67
|
+
"PermissionDeniedError",
|
|
68
|
+
"PreResumeError",
|
|
69
|
+
"ProtocolCapacityError",
|
|
70
|
+
"ProtocolError",
|
|
71
|
+
"ReplayMode",
|
|
72
|
+
"ReplaySummaryEvent",
|
|
73
|
+
"ResponseFrame",
|
|
74
|
+
"ResumeAckError",
|
|
75
|
+
"SentMessage",
|
|
76
|
+
"StaleDeliveryError",
|
|
77
|
+
"Task",
|
|
78
|
+
"TaskOutcome",
|
|
79
|
+
"User",
|
|
80
|
+
"UserRole",
|
|
81
|
+
"create_borgee_plugin",
|
|
82
|
+
"task_from_wire",
|
|
83
|
+
]
|