peercolab-engine 0.1.1__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.
- peercolab_engine-0.1.1/.github/workflows/publish.yml +47 -0
- peercolab_engine-0.1.1/.gitignore +17 -0
- peercolab_engine-0.1.1/LICENSE +11 -0
- peercolab_engine-0.1.1/PKG-INFO +58 -0
- peercolab_engine-0.1.1/README.md +27 -0
- peercolab_engine-0.1.1/pyproject.toml +34 -0
- peercolab_engine-0.1.1/src/peercolab_engine/__init__.py +138 -0
- peercolab_engine-0.1.1/src/peercolab_engine/engine.py +2525 -0
- peercolab_engine-0.1.1/tests/conftest.py +66 -0
- peercolab_engine-0.1.1/tests/test_client_server_serialization.py +426 -0
- peercolab_engine-0.1.1/tests/test_context_cache.py +99 -0
- peercolab_engine-0.1.1/tests/test_integration.py +252 -0
- peercolab_engine-0.1.1/tests/test_logger.py +107 -0
- peercolab_engine-0.1.1/tests/test_metavalues.py +195 -0
- peercolab_engine-0.1.1/tests/test_operations.py +136 -0
- peercolab_engine-0.1.1/tests/test_outbound.py +108 -0
- peercolab_engine-0.1.1/tests/test_real_world_usage.py +801 -0
- peercolab_engine-0.1.1/tests/test_result.py +334 -0
- peercolab_engine-0.1.1/tests/test_result_passthrough_async.py +73 -0
- peercolab_engine-0.1.1/tests/test_transport_client.py +293 -0
- peercolab_engine-0.1.1/tests/test_transport_context.py +106 -0
- peercolab_engine-0.1.1/tests/test_transport_dispatcher.py +325 -0
- peercolab_engine-0.1.1/tests/test_transport_error.py +114 -0
- peercolab_engine-0.1.1/tests/test_transport_request.py +100 -0
- peercolab_engine-0.1.1/tests/test_transport_session.py +201 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*.*.*' # e.g. v1.2.3
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
environment: release
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
id-token: write # required for OIDC trusted publishing
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Setup Python
|
|
21
|
+
uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: '3.12'
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install --upgrade pip
|
|
28
|
+
pip install ".[dev]"
|
|
29
|
+
pip install build
|
|
30
|
+
|
|
31
|
+
- name: Verify version matches tag
|
|
32
|
+
run: |
|
|
33
|
+
TAG_VERSION="${GITHUB_REF_NAME#v}"
|
|
34
|
+
PKG_VERSION=$(python -c "import importlib.metadata; print(importlib.metadata.version('peercolab-engine'))")
|
|
35
|
+
if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
|
|
36
|
+
echo "pyproject.toml version $PKG_VERSION != tag $TAG_VERSION"
|
|
37
|
+
exit 1
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
- name: Test
|
|
41
|
+
run: pytest
|
|
42
|
+
|
|
43
|
+
- name: Build
|
|
44
|
+
run: python -m build
|
|
45
|
+
|
|
46
|
+
- name: Publish to PyPI
|
|
47
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"Commons Clause" License Condition v1.0
|
|
2
|
+
|
|
3
|
+
The Software is provided to you by the Licensor under the License, as defined below, subject to the following condition.
|
|
4
|
+
|
|
5
|
+
Without limiting other conditions in the License, the grant of rights under the License will not include, and the License does not grant to you, the right to Sell the Software.
|
|
6
|
+
|
|
7
|
+
For purposes of the foregoing, "Sell" means practicing any or all of the rights granted to you under the License to provide to third parties, for a fee or other consideration (including without limitation fees for hosting or consulting/ support services related to the Software), a product or service whose value derives, entirely or substantially, from the functionality of the Software. Any license notice or attribution required by the License must also include this Commons Clause License Condition notice.
|
|
8
|
+
|
|
9
|
+
Software: PeerColab Engine
|
|
10
|
+
License: Apache 2.0
|
|
11
|
+
Licensor: New Horizon Invest AS
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: peercolab-engine
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Transport abstraction library for operation dispatching with interceptors
|
|
5
|
+
Author: New Horizon Invest AS
|
|
6
|
+
License: "Commons Clause" License Condition v1.0
|
|
7
|
+
|
|
8
|
+
The Software is provided to you by the Licensor under the License, as defined below, subject to the following condition.
|
|
9
|
+
|
|
10
|
+
Without limiting other conditions in the License, the grant of rights under the License will not include, and the License does not grant to you, the right to Sell the Software.
|
|
11
|
+
|
|
12
|
+
For purposes of the foregoing, "Sell" means practicing any or all of the rights granted to you under the License to provide to third parties, for a fee or other consideration (including without limitation fees for hosting or consulting/ support services related to the Software), a product or service whose value derives, entirely or substantially, from the functionality of the Software. Any license notice or attribution required by the License must also include this Commons Clause License Condition notice.
|
|
13
|
+
|
|
14
|
+
Software: PeerColab Engine
|
|
15
|
+
License: Apache 2.0
|
|
16
|
+
Licensor: New Horizon Invest AS
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Typing :: Typed
|
|
26
|
+
Requires-Python: >=3.8
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
# PeerColab Engine - Python
|
|
33
|
+
|
|
34
|
+
Transport abstraction library for operation dispatching with interceptors.
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install peercolab-engine
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from peercolab_engine import Transport, RequestOperation, Result
|
|
46
|
+
|
|
47
|
+
class GetUser(RequestOperation[dict, dict]):
|
|
48
|
+
def __init__(self):
|
|
49
|
+
super().__init__("users.get", "GET")
|
|
50
|
+
|
|
51
|
+
get_user = GetUser()
|
|
52
|
+
|
|
53
|
+
session = (
|
|
54
|
+
Transport.session("my-service")
|
|
55
|
+
.intercept(get_user.handle(my_handler))
|
|
56
|
+
.build()
|
|
57
|
+
)
|
|
58
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# PeerColab Engine - Python
|
|
2
|
+
|
|
3
|
+
Transport abstraction library for operation dispatching with interceptors.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install peercolab-engine
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from peercolab_engine import Transport, RequestOperation, Result
|
|
15
|
+
|
|
16
|
+
class GetUser(RequestOperation[dict, dict]):
|
|
17
|
+
def __init__(self):
|
|
18
|
+
super().__init__("users.get", "GET")
|
|
19
|
+
|
|
20
|
+
get_user = GetUser()
|
|
21
|
+
|
|
22
|
+
session = (
|
|
23
|
+
Transport.session("my-service")
|
|
24
|
+
.intercept(get_user.handle(my_handler))
|
|
25
|
+
.build()
|
|
26
|
+
)
|
|
27
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "peercolab-engine"
|
|
7
|
+
version = "0.1.1"
|
|
8
|
+
description = "Transport abstraction library for operation dispatching with interceptors"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {file = "LICENSE"}
|
|
11
|
+
requires-python = ">=3.8"
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "New Horizon Invest AS"},
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.8",
|
|
18
|
+
"Programming Language :: Python :: 3.9",
|
|
19
|
+
"Programming Language :: Python :: 3.10",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
"Typing :: Typed",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[project.optional-dependencies]
|
|
27
|
+
dev = [
|
|
28
|
+
"pytest>=7.0",
|
|
29
|
+
"pytest-asyncio>=0.21",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[tool.pytest.ini_options]
|
|
33
|
+
asyncio_mode = "auto"
|
|
34
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from .engine import (
|
|
4
|
+
# UUID
|
|
5
|
+
UUID,
|
|
6
|
+
generate_uuid,
|
|
7
|
+
generateUUID,
|
|
8
|
+
# Verbs
|
|
9
|
+
OPERATION_VERBS,
|
|
10
|
+
OperationVerb,
|
|
11
|
+
# Core types
|
|
12
|
+
Attribute,
|
|
13
|
+
OutOfContextOperationPathParameter,
|
|
14
|
+
OutOfContextOperation,
|
|
15
|
+
# Identity
|
|
16
|
+
Identifier,
|
|
17
|
+
ICharacters,
|
|
18
|
+
Characters,
|
|
19
|
+
CharacterMetaValues,
|
|
20
|
+
# Settings
|
|
21
|
+
TransportOperationCharacter,
|
|
22
|
+
TransportOperationCharacterSetup,
|
|
23
|
+
TransportOperationSettings,
|
|
24
|
+
# Serialization
|
|
25
|
+
TransportSerializer,
|
|
26
|
+
DefaultTransportSerializer,
|
|
27
|
+
GlobalSerializer,
|
|
28
|
+
# Logging
|
|
29
|
+
LogLevel,
|
|
30
|
+
LogMessage,
|
|
31
|
+
TransportSessionLogger,
|
|
32
|
+
DefaultLogger,
|
|
33
|
+
Logger,
|
|
34
|
+
# Caching
|
|
35
|
+
ContextCache,
|
|
36
|
+
InMemoryContextCache,
|
|
37
|
+
# Errors
|
|
38
|
+
TransportErrorDetails,
|
|
39
|
+
TransportError,
|
|
40
|
+
# Metadata
|
|
41
|
+
Metavalue,
|
|
42
|
+
Metavalues,
|
|
43
|
+
# Result
|
|
44
|
+
Result,
|
|
45
|
+
ResultPassthroughAsync,
|
|
46
|
+
# Operations
|
|
47
|
+
TransportOperation,
|
|
48
|
+
OperationHandler,
|
|
49
|
+
RequestOperationHandler,
|
|
50
|
+
MessageOperationHandler,
|
|
51
|
+
OperationRequest,
|
|
52
|
+
RequestOperationRequest,
|
|
53
|
+
MessageOperationRequest,
|
|
54
|
+
RequestOperation,
|
|
55
|
+
MessageOperation,
|
|
56
|
+
# Transport core
|
|
57
|
+
OperationInformation,
|
|
58
|
+
CallInformation,
|
|
59
|
+
TransportContext,
|
|
60
|
+
TransportRequest,
|
|
61
|
+
# Interceptor types
|
|
62
|
+
RequestInterceptor,
|
|
63
|
+
MessageInterceptor,
|
|
64
|
+
RequestInspector,
|
|
65
|
+
ResponseInspector,
|
|
66
|
+
# Dispatcher
|
|
67
|
+
TransportDispatcher,
|
|
68
|
+
# Session/Client
|
|
69
|
+
TransportSessionConfiguration,
|
|
70
|
+
TransportSession,
|
|
71
|
+
TransportClient,
|
|
72
|
+
# Builders
|
|
73
|
+
TransportSessionBuilder,
|
|
74
|
+
TransportAbstractionBuilder,
|
|
75
|
+
OutboundSessionBuilder,
|
|
76
|
+
OutboundClientFactory,
|
|
77
|
+
Transport,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
__all__ = [
|
|
81
|
+
"UUID",
|
|
82
|
+
"generate_uuid",
|
|
83
|
+
"generateUUID",
|
|
84
|
+
"OPERATION_VERBS",
|
|
85
|
+
"OperationVerb",
|
|
86
|
+
"Attribute",
|
|
87
|
+
"OutOfContextOperationPathParameter",
|
|
88
|
+
"OutOfContextOperation",
|
|
89
|
+
"Identifier",
|
|
90
|
+
"ICharacters",
|
|
91
|
+
"Characters",
|
|
92
|
+
"CharacterMetaValues",
|
|
93
|
+
"TransportOperationCharacter",
|
|
94
|
+
"TransportOperationCharacterSetup",
|
|
95
|
+
"TransportOperationSettings",
|
|
96
|
+
"TransportSerializer",
|
|
97
|
+
"DefaultTransportSerializer",
|
|
98
|
+
"GlobalSerializer",
|
|
99
|
+
"LogLevel",
|
|
100
|
+
"LogMessage",
|
|
101
|
+
"TransportSessionLogger",
|
|
102
|
+
"DefaultLogger",
|
|
103
|
+
"Logger",
|
|
104
|
+
"ContextCache",
|
|
105
|
+
"InMemoryContextCache",
|
|
106
|
+
"TransportErrorDetails",
|
|
107
|
+
"TransportError",
|
|
108
|
+
"Metavalue",
|
|
109
|
+
"Metavalues",
|
|
110
|
+
"Result",
|
|
111
|
+
"ResultPassthroughAsync",
|
|
112
|
+
"TransportOperation",
|
|
113
|
+
"OperationHandler",
|
|
114
|
+
"RequestOperationHandler",
|
|
115
|
+
"MessageOperationHandler",
|
|
116
|
+
"OperationRequest",
|
|
117
|
+
"RequestOperationRequest",
|
|
118
|
+
"MessageOperationRequest",
|
|
119
|
+
"RequestOperation",
|
|
120
|
+
"MessageOperation",
|
|
121
|
+
"OperationInformation",
|
|
122
|
+
"CallInformation",
|
|
123
|
+
"TransportContext",
|
|
124
|
+
"TransportRequest",
|
|
125
|
+
"RequestInterceptor",
|
|
126
|
+
"MessageInterceptor",
|
|
127
|
+
"RequestInspector",
|
|
128
|
+
"ResponseInspector",
|
|
129
|
+
"TransportDispatcher",
|
|
130
|
+
"TransportSessionConfiguration",
|
|
131
|
+
"TransportSession",
|
|
132
|
+
"TransportClient",
|
|
133
|
+
"TransportSessionBuilder",
|
|
134
|
+
"TransportAbstractionBuilder",
|
|
135
|
+
"OutboundSessionBuilder",
|
|
136
|
+
"OutboundClientFactory",
|
|
137
|
+
"Transport",
|
|
138
|
+
]
|