divi 0.0.1.dev0__py3-none-any.whl → 0.0.1.dev7__py3-none-any.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.
- divi/__init__.py +6 -3
- divi/bin/core +0 -0
- divi/core/__init__.py +5 -0
- divi/core/finish.py +15 -0
- divi/core/init.py +80 -0
- divi/core/run.py +35 -0
- divi/proto/core/v1/core.proto +13 -0
- divi/proto/core/v1/core_pb2.py +39 -0
- divi/proto/core/v1/core_pb2.pyi +6 -0
- divi/proto/core/v1/core_pb2_grpc.py +101 -0
- divi/proto/core/v1/health_check_request.proto +7 -0
- divi/proto/core/v1/health_check_request_pb2.py +37 -0
- divi/proto/core/v1/health_check_request_pb2.pyi +11 -0
- divi/proto/core/v1/health_check_request_pb2_grpc.py +24 -0
- divi/proto/core/v1/health_check_response.proto +10 -0
- divi/proto/core/v1/health_check_response_pb2.py +37 -0
- divi/proto/core/v1/health_check_response_pb2.pyi +13 -0
- divi/proto/core/v1/health_check_response_pb2_grpc.py +24 -0
- divi/utils.py +14 -0
- divi-0.0.1.dev7.dist-info/METADATA +33 -0
- divi-0.0.1.dev7.dist-info/RECORD +23 -0
- divi-0.0.1.dev7.dist-info/licenses/LICENSE +21 -0
- divi/hello.py +0 -6
- divi-0.0.1.dev0.dist-info/METADATA +0 -19
- divi-0.0.1.dev0.dist-info/RECORD +0 -5
- {divi-0.0.1.dev0.dist-info → divi-0.0.1.dev7.dist-info}/WHEEL +0 -0
divi/__init__.py
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
from
|
1
|
+
from typing import Optional
|
2
|
+
from .core import Run, init, finish
|
3
|
+
from . import proto
|
2
4
|
|
3
5
|
name: str = "divi"
|
6
|
+
run: Optional[Run] = None
|
4
7
|
|
5
|
-
__version__ = "0.0.1.
|
6
|
-
__all__ = ["
|
8
|
+
__version__ = "0.0.1.dev7"
|
9
|
+
__all__ = ["init", "finish", "proto"]
|
divi/bin/core
ADDED
Binary file
|
divi/core/__init__.py
ADDED
divi/core/finish.py
ADDED
divi/core/init.py
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
import grpc
|
2
|
+
import time
|
3
|
+
import socket
|
4
|
+
import atexit
|
5
|
+
import subprocess
|
6
|
+
|
7
|
+
from typing import Union
|
8
|
+
|
9
|
+
import divi
|
10
|
+
|
11
|
+
from divi.core.run import Run
|
12
|
+
from divi.utils import get_server_path
|
13
|
+
|
14
|
+
|
15
|
+
def init(
|
16
|
+
host: Union[str, None] = None, port: Union[str, None] = None
|
17
|
+
) -> Union[Run, None]:
|
18
|
+
divi.run = Run(host, port)
|
19
|
+
_start_server()
|
20
|
+
|
21
|
+
|
22
|
+
def _start_server():
|
23
|
+
"""Start the backend server."""
|
24
|
+
# get the run object
|
25
|
+
run = divi.run
|
26
|
+
if run is None:
|
27
|
+
return
|
28
|
+
|
29
|
+
# start the server
|
30
|
+
bin_path = get_server_path()
|
31
|
+
command = [bin_path]
|
32
|
+
run.process = subprocess.Popen(command)
|
33
|
+
|
34
|
+
# Wait for the port to be open
|
35
|
+
if not _wait_for_port(run.host, run.port, 10):
|
36
|
+
run.process.terminate()
|
37
|
+
raise RuntimeError("Service failed to start: port not open")
|
38
|
+
|
39
|
+
# Check if the gRPC channel is ready
|
40
|
+
channel = grpc.insecure_channel(run.target)
|
41
|
+
try:
|
42
|
+
grpc.channel_ready_future(channel).result(timeout=10)
|
43
|
+
except grpc.FutureTimeoutError:
|
44
|
+
run.process.terminate()
|
45
|
+
raise RuntimeError("gRPC channel not ready")
|
46
|
+
finally:
|
47
|
+
channel.close()
|
48
|
+
|
49
|
+
# Health check
|
50
|
+
status = run.check_health()
|
51
|
+
if not status:
|
52
|
+
run.process.terminate()
|
53
|
+
raise RuntimeError("Service failed health check")
|
54
|
+
|
55
|
+
run.hooks.append(run.process.terminate)
|
56
|
+
atexit.register(run.process.terminate)
|
57
|
+
|
58
|
+
|
59
|
+
def _wait_for_port(host, port, timeout_seconds):
|
60
|
+
"""Wait until the specified port is open."""
|
61
|
+
start_time = time.time()
|
62
|
+
while time.time() - start_time < timeout_seconds:
|
63
|
+
if _is_port_open(host, port):
|
64
|
+
return True
|
65
|
+
time.sleep(0.1)
|
66
|
+
return False
|
67
|
+
|
68
|
+
|
69
|
+
def _is_port_open(host, port):
|
70
|
+
"""Check if the given host and port are open."""
|
71
|
+
try:
|
72
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
73
|
+
result = sock.connect_ex((host, port))
|
74
|
+
if result == 0:
|
75
|
+
return True
|
76
|
+
else:
|
77
|
+
return False
|
78
|
+
except Exception as e:
|
79
|
+
print(f"Error checking port: {e}")
|
80
|
+
return False
|
divi/core/run.py
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
import grpc
|
2
|
+
|
3
|
+
from subprocess import Popen
|
4
|
+
from typing import List, Optional, Callable
|
5
|
+
|
6
|
+
import divi
|
7
|
+
|
8
|
+
from divi.proto.core.v1.core_pb2_grpc import CoreStub
|
9
|
+
from divi.proto.core.v1.health_check_request_pb2 import HealthCheckRequest
|
10
|
+
from divi.proto.core.v1.health_check_response_pb2 import HealthCheckResponse
|
11
|
+
|
12
|
+
|
13
|
+
class Run:
|
14
|
+
"""Core Runtime"""
|
15
|
+
|
16
|
+
def __init__(self, host, port) -> None:
|
17
|
+
self.host: str = host if host else "localhost"
|
18
|
+
self.port: int = port if port else 50051
|
19
|
+
self.process: Optional[Popen] = None
|
20
|
+
self.hooks: List[Callable[[], None]] = []
|
21
|
+
|
22
|
+
@property
|
23
|
+
def target(self) -> str:
|
24
|
+
"""Return the target string."""
|
25
|
+
return f"{self.host}:{self.port}"
|
26
|
+
|
27
|
+
def check_health(self) -> bool:
|
28
|
+
"""Check the health of the service."""
|
29
|
+
with grpc.insecure_channel(self.target) as channel:
|
30
|
+
stub = CoreStub(channel)
|
31
|
+
response: HealthCheckResponse = stub.Check(
|
32
|
+
HealthCheckRequest(version=divi.__version__)
|
33
|
+
)
|
34
|
+
print(f"Health check: {response.message}")
|
35
|
+
return response.status
|
@@ -0,0 +1,13 @@
|
|
1
|
+
syntax = "proto3";
|
2
|
+
|
3
|
+
package core.v1;
|
4
|
+
|
5
|
+
import "divi/proto/core/v1/health_check_request.proto";
|
6
|
+
import "divi/proto/core/v1/health_check_response.proto";
|
7
|
+
|
8
|
+
option go_package = "github.com/KaikaikaiFang/divine-agent/core/proto";
|
9
|
+
|
10
|
+
// Health is a service that implements health check.
|
11
|
+
service Core {
|
12
|
+
rpc Check(HealthCheckRequest) returns (HealthCheckResponse) {}
|
13
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
4
|
+
# source: divi/proto/core/v1/core.proto
|
5
|
+
# Protobuf Python Version: 5.29.0
|
6
|
+
"""Generated protocol buffer code."""
|
7
|
+
from google.protobuf import descriptor as _descriptor
|
8
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
10
|
+
from google.protobuf import symbol_database as _symbol_database
|
11
|
+
from google.protobuf.internal import builder as _builder
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
14
|
+
5,
|
15
|
+
29,
|
16
|
+
0,
|
17
|
+
'',
|
18
|
+
'divi/proto/core/v1/core.proto'
|
19
|
+
)
|
20
|
+
# @@protoc_insertion_point(imports)
|
21
|
+
|
22
|
+
_sym_db = _symbol_database.Default()
|
23
|
+
|
24
|
+
|
25
|
+
from divi.proto.core.v1 import health_check_request_pb2 as divi_dot_proto_dot_core_dot_v1_dot_health__check__request__pb2
|
26
|
+
from divi.proto.core.v1 import health_check_response_pb2 as divi_dot_proto_dot_core_dot_v1_dot_health__check__response__pb2
|
27
|
+
|
28
|
+
|
29
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1d\x64ivi/proto/core/v1/core.proto\x12\x07\x63ore.v1\x1a-divi/proto/core/v1/health_check_request.proto\x1a.divi/proto/core/v1/health_check_response.proto2L\n\x04\x43ore\x12\x44\n\x05\x43heck\x12\x1b.core.v1.HealthCheckRequest\x1a\x1c.core.v1.HealthCheckResponse\"\x00\x42\x32Z0github.com/KaikaikaiFang/divine-agent/core/protob\x06proto3')
|
30
|
+
|
31
|
+
_globals = globals()
|
32
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
33
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'divi.proto.core.v1.core_pb2', _globals)
|
34
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
35
|
+
_globals['DESCRIPTOR']._loaded_options = None
|
36
|
+
_globals['DESCRIPTOR']._serialized_options = b'Z0github.com/KaikaikaiFang/divine-agent/core/proto'
|
37
|
+
_globals['_CORE']._serialized_start=137
|
38
|
+
_globals['_CORE']._serialized_end=213
|
39
|
+
# @@protoc_insertion_point(module_scope)
|
@@ -0,0 +1,6 @@
|
|
1
|
+
from divi.proto.core.v1 import health_check_request_pb2 as _health_check_request_pb2
|
2
|
+
from divi.proto.core.v1 import health_check_response_pb2 as _health_check_response_pb2
|
3
|
+
from google.protobuf import descriptor as _descriptor
|
4
|
+
from typing import ClassVar as _ClassVar
|
5
|
+
|
6
|
+
DESCRIPTOR: _descriptor.FileDescriptor
|
@@ -0,0 +1,101 @@
|
|
1
|
+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
2
|
+
"""Client and server classes corresponding to protobuf-defined services."""
|
3
|
+
import grpc
|
4
|
+
import warnings
|
5
|
+
|
6
|
+
from divi.proto.core.v1 import health_check_request_pb2 as divi_dot_proto_dot_core_dot_v1_dot_health__check__request__pb2
|
7
|
+
from divi.proto.core.v1 import health_check_response_pb2 as divi_dot_proto_dot_core_dot_v1_dot_health__check__response__pb2
|
8
|
+
|
9
|
+
GRPC_GENERATED_VERSION = '1.69.0'
|
10
|
+
GRPC_VERSION = grpc.__version__
|
11
|
+
_version_not_supported = False
|
12
|
+
|
13
|
+
try:
|
14
|
+
from grpc._utilities import first_version_is_lower
|
15
|
+
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
16
|
+
except ImportError:
|
17
|
+
_version_not_supported = True
|
18
|
+
|
19
|
+
if _version_not_supported:
|
20
|
+
raise RuntimeError(
|
21
|
+
f'The grpc package installed is at version {GRPC_VERSION},'
|
22
|
+
+ f' but the generated code in divi/proto/core/v1/core_pb2_grpc.py depends on'
|
23
|
+
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
24
|
+
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
25
|
+
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
26
|
+
)
|
27
|
+
|
28
|
+
|
29
|
+
class CoreStub(object):
|
30
|
+
"""Health is a service that implements health check.
|
31
|
+
"""
|
32
|
+
|
33
|
+
def __init__(self, channel):
|
34
|
+
"""Constructor.
|
35
|
+
|
36
|
+
Args:
|
37
|
+
channel: A grpc.Channel.
|
38
|
+
"""
|
39
|
+
self.Check = channel.unary_unary(
|
40
|
+
'/core.v1.Core/Check',
|
41
|
+
request_serializer=divi_dot_proto_dot_core_dot_v1_dot_health__check__request__pb2.HealthCheckRequest.SerializeToString,
|
42
|
+
response_deserializer=divi_dot_proto_dot_core_dot_v1_dot_health__check__response__pb2.HealthCheckResponse.FromString,
|
43
|
+
_registered_method=True)
|
44
|
+
|
45
|
+
|
46
|
+
class CoreServicer(object):
|
47
|
+
"""Health is a service that implements health check.
|
48
|
+
"""
|
49
|
+
|
50
|
+
def Check(self, request, context):
|
51
|
+
"""Missing associated documentation comment in .proto file."""
|
52
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
53
|
+
context.set_details('Method not implemented!')
|
54
|
+
raise NotImplementedError('Method not implemented!')
|
55
|
+
|
56
|
+
|
57
|
+
def add_CoreServicer_to_server(servicer, server):
|
58
|
+
rpc_method_handlers = {
|
59
|
+
'Check': grpc.unary_unary_rpc_method_handler(
|
60
|
+
servicer.Check,
|
61
|
+
request_deserializer=divi_dot_proto_dot_core_dot_v1_dot_health__check__request__pb2.HealthCheckRequest.FromString,
|
62
|
+
response_serializer=divi_dot_proto_dot_core_dot_v1_dot_health__check__response__pb2.HealthCheckResponse.SerializeToString,
|
63
|
+
),
|
64
|
+
}
|
65
|
+
generic_handler = grpc.method_handlers_generic_handler(
|
66
|
+
'core.v1.Core', rpc_method_handlers)
|
67
|
+
server.add_generic_rpc_handlers((generic_handler,))
|
68
|
+
server.add_registered_method_handlers('core.v1.Core', rpc_method_handlers)
|
69
|
+
|
70
|
+
|
71
|
+
# This class is part of an EXPERIMENTAL API.
|
72
|
+
class Core(object):
|
73
|
+
"""Health is a service that implements health check.
|
74
|
+
"""
|
75
|
+
|
76
|
+
@staticmethod
|
77
|
+
def Check(request,
|
78
|
+
target,
|
79
|
+
options=(),
|
80
|
+
channel_credentials=None,
|
81
|
+
call_credentials=None,
|
82
|
+
insecure=False,
|
83
|
+
compression=None,
|
84
|
+
wait_for_ready=None,
|
85
|
+
timeout=None,
|
86
|
+
metadata=None):
|
87
|
+
return grpc.experimental.unary_unary(
|
88
|
+
request,
|
89
|
+
target,
|
90
|
+
'/core.v1.Core/Check',
|
91
|
+
divi_dot_proto_dot_core_dot_v1_dot_health__check__request__pb2.HealthCheckRequest.SerializeToString,
|
92
|
+
divi_dot_proto_dot_core_dot_v1_dot_health__check__response__pb2.HealthCheckResponse.FromString,
|
93
|
+
options,
|
94
|
+
channel_credentials,
|
95
|
+
insecure,
|
96
|
+
call_credentials,
|
97
|
+
compression,
|
98
|
+
wait_for_ready,
|
99
|
+
timeout,
|
100
|
+
metadata,
|
101
|
+
_registered_method=True)
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
4
|
+
# source: divi/proto/core/v1/health_check_request.proto
|
5
|
+
# Protobuf Python Version: 5.29.0
|
6
|
+
"""Generated protocol buffer code."""
|
7
|
+
from google.protobuf import descriptor as _descriptor
|
8
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
10
|
+
from google.protobuf import symbol_database as _symbol_database
|
11
|
+
from google.protobuf.internal import builder as _builder
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
14
|
+
5,
|
15
|
+
29,
|
16
|
+
0,
|
17
|
+
'',
|
18
|
+
'divi/proto/core/v1/health_check_request.proto'
|
19
|
+
)
|
20
|
+
# @@protoc_insertion_point(imports)
|
21
|
+
|
22
|
+
_sym_db = _symbol_database.Default()
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n-divi/proto/core/v1/health_check_request.proto\x12\x07\x63ore.v1\"%\n\x12HealthCheckRequest\x12\x0f\n\x07version\x18\x01 \x01(\tB2Z0github.com/KaikaikaiFang/divine-agent/core/protob\x06proto3')
|
28
|
+
|
29
|
+
_globals = globals()
|
30
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
31
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'divi.proto.core.v1.health_check_request_pb2', _globals)
|
32
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
33
|
+
_globals['DESCRIPTOR']._loaded_options = None
|
34
|
+
_globals['DESCRIPTOR']._serialized_options = b'Z0github.com/KaikaikaiFang/divine-agent/core/proto'
|
35
|
+
_globals['_HEALTHCHECKREQUEST']._serialized_start=58
|
36
|
+
_globals['_HEALTHCHECKREQUEST']._serialized_end=95
|
37
|
+
# @@protoc_insertion_point(module_scope)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
from google.protobuf import descriptor as _descriptor
|
2
|
+
from google.protobuf import message as _message
|
3
|
+
from typing import ClassVar as _ClassVar, Optional as _Optional
|
4
|
+
|
5
|
+
DESCRIPTOR: _descriptor.FileDescriptor
|
6
|
+
|
7
|
+
class HealthCheckRequest(_message.Message):
|
8
|
+
__slots__ = ("version",)
|
9
|
+
VERSION_FIELD_NUMBER: _ClassVar[int]
|
10
|
+
version: str
|
11
|
+
def __init__(self, version: _Optional[str] = ...) -> None: ...
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
2
|
+
"""Client and server classes corresponding to protobuf-defined services."""
|
3
|
+
import grpc
|
4
|
+
import warnings
|
5
|
+
|
6
|
+
|
7
|
+
GRPC_GENERATED_VERSION = '1.69.0'
|
8
|
+
GRPC_VERSION = grpc.__version__
|
9
|
+
_version_not_supported = False
|
10
|
+
|
11
|
+
try:
|
12
|
+
from grpc._utilities import first_version_is_lower
|
13
|
+
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
14
|
+
except ImportError:
|
15
|
+
_version_not_supported = True
|
16
|
+
|
17
|
+
if _version_not_supported:
|
18
|
+
raise RuntimeError(
|
19
|
+
f'The grpc package installed is at version {GRPC_VERSION},'
|
20
|
+
+ f' but the generated code in divi/proto/core/v1/health_check_request_pb2_grpc.py depends on'
|
21
|
+
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
22
|
+
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
23
|
+
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
24
|
+
)
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
4
|
+
# source: divi/proto/core/v1/health_check_response.proto
|
5
|
+
# Protobuf Python Version: 5.29.0
|
6
|
+
"""Generated protocol buffer code."""
|
7
|
+
from google.protobuf import descriptor as _descriptor
|
8
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
10
|
+
from google.protobuf import symbol_database as _symbol_database
|
11
|
+
from google.protobuf.internal import builder as _builder
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
14
|
+
5,
|
15
|
+
29,
|
16
|
+
0,
|
17
|
+
'',
|
18
|
+
'divi/proto/core/v1/health_check_response.proto'
|
19
|
+
)
|
20
|
+
# @@protoc_insertion_point(imports)
|
21
|
+
|
22
|
+
_sym_db = _symbol_database.Default()
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n.divi/proto/core/v1/health_check_response.proto\x12\x07\x63ore.v1\"6\n\x13HealthCheckResponse\x12\x0e\n\x06status\x18\x01 \x01(\x08\x12\x0f\n\x07message\x18\x02 \x01(\tB2Z0github.com/KaikaikaiFang/divine-agent/core/protob\x06proto3')
|
28
|
+
|
29
|
+
_globals = globals()
|
30
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
31
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'divi.proto.core.v1.health_check_response_pb2', _globals)
|
32
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
33
|
+
_globals['DESCRIPTOR']._loaded_options = None
|
34
|
+
_globals['DESCRIPTOR']._serialized_options = b'Z0github.com/KaikaikaiFang/divine-agent/core/proto'
|
35
|
+
_globals['_HEALTHCHECKRESPONSE']._serialized_start=59
|
36
|
+
_globals['_HEALTHCHECKRESPONSE']._serialized_end=113
|
37
|
+
# @@protoc_insertion_point(module_scope)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
from google.protobuf import descriptor as _descriptor
|
2
|
+
from google.protobuf import message as _message
|
3
|
+
from typing import ClassVar as _ClassVar, Optional as _Optional
|
4
|
+
|
5
|
+
DESCRIPTOR: _descriptor.FileDescriptor
|
6
|
+
|
7
|
+
class HealthCheckResponse(_message.Message):
|
8
|
+
__slots__ = ("status", "message")
|
9
|
+
STATUS_FIELD_NUMBER: _ClassVar[int]
|
10
|
+
MESSAGE_FIELD_NUMBER: _ClassVar[int]
|
11
|
+
status: bool
|
12
|
+
message: str
|
13
|
+
def __init__(self, status: bool = ..., message: _Optional[str] = ...) -> None: ...
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
2
|
+
"""Client and server classes corresponding to protobuf-defined services."""
|
3
|
+
import grpc
|
4
|
+
import warnings
|
5
|
+
|
6
|
+
|
7
|
+
GRPC_GENERATED_VERSION = '1.69.0'
|
8
|
+
GRPC_VERSION = grpc.__version__
|
9
|
+
_version_not_supported = False
|
10
|
+
|
11
|
+
try:
|
12
|
+
from grpc._utilities import first_version_is_lower
|
13
|
+
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
14
|
+
except ImportError:
|
15
|
+
_version_not_supported = True
|
16
|
+
|
17
|
+
if _version_not_supported:
|
18
|
+
raise RuntimeError(
|
19
|
+
f'The grpc package installed is at version {GRPC_VERSION},'
|
20
|
+
+ f' but the generated code in divi/proto/core/v1/health_check_response_pb2_grpc.py depends on'
|
21
|
+
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
22
|
+
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
23
|
+
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
24
|
+
)
|
divi/utils.py
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
import pathlib
|
2
|
+
|
3
|
+
|
4
|
+
def get_server_path() -> str:
|
5
|
+
"""Get the path to the server binary."""
|
6
|
+
path = pathlib.Path(__file__).parent / "bin" / "core"
|
7
|
+
if not path.exists():
|
8
|
+
raise FileNotFoundError(f"Server binary not found: {path}")
|
9
|
+
|
10
|
+
return str(path)
|
11
|
+
|
12
|
+
|
13
|
+
if __name__ == "__main__":
|
14
|
+
print(get_server_path())
|
@@ -0,0 +1,33 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: divi
|
3
|
+
Version: 0.0.1.dev7
|
4
|
+
Summary: The Agent Platform for Observability & Evaluation
|
5
|
+
License-File: LICENSE
|
6
|
+
Requires-Python: >=3.11
|
7
|
+
Requires-Dist: grpcio>=1.69.0
|
8
|
+
Requires-Dist: protobuf>=5.29.3
|
9
|
+
Description-Content-Type: text/markdown
|
10
|
+
|
11
|
+
# divine-agent
|
12
|
+
|
13
|
+
Agent Platform for Observability • Evaluation • Playground
|
14
|
+
|
15
|
+
## Structure
|
16
|
+
|
17
|
+
> Divine Agent is a monorepo project. The project is structured as follows:
|
18
|
+
|
19
|
+
```plaintext
|
20
|
+
.
|
21
|
+
├── apps
|
22
|
+
├── core
|
23
|
+
├── docs
|
24
|
+
├── packages
|
25
|
+
├── scripts
|
26
|
+
└── sdk
|
27
|
+
```
|
28
|
+
|
29
|
+
## Thanks
|
30
|
+
|
31
|
+
1. [uv](https://github.com/astral-sh/uv): An extremely fast Python package and project manager, written in Rust.
|
32
|
+
2. [hatch](https://github.com/pypa/hatch): Hatch is a modern, extensible Python project manager.
|
33
|
+
3. [github cli](https://cli.github.com/manual): GitHub CLI, or gh, is a command-line interface to GitHub for use in your terminal or your scripts.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
divi/__init__.py,sha256=YTwo-qSDfRDLVQFWhqXKC7czbDIu6lavlmlQjhl-NdU,196
|
2
|
+
divi/utils.py,sha256=HcGlohwmowcQ-isVo0UtrsOsFbJEhX_earaSv4ggIR4,324
|
3
|
+
divi/bin/core,sha256=unkwyErTAuP767bu6IYg2kc4i855JjUVBIXGLifajoU,14093980
|
4
|
+
divi/core/__init__.py,sha256=iAUb96xD4lwqipLItCc87_SVHsorydWj1dh3YTWQiig,108
|
5
|
+
divi/core/finish.py,sha256=ViF6DndmXMq-MAApN-DgGs3r5bbFQsSWbfeDT_rvsDg,225
|
6
|
+
divi/core/init.py,sha256=GlfyuT78J65juyket4On_Ot2ZE6Oybtu2tmIoFm9IEo,2048
|
7
|
+
divi/core/run.py,sha256=bgbtAw9LoIAAhx2Qkxd0AN9CsMZZR68BK1VKiKwk2GM,1106
|
8
|
+
divi/proto/core/v1/core.proto,sha256=vcuht22OEKbZ0fpLz7JTX4qd7pa5br1pjqU_v57uIQQ,360
|
9
|
+
divi/proto/core/v1/core_pb2.py,sha256=fG_f3LN_2shsx17-H_BmBM3644sHdR4Za-sVIMkZ5Sg,1899
|
10
|
+
divi/proto/core/v1/core_pb2.pyi,sha256=JI0HJe_LpOXNjIzR7rdHBhln3VUGTJAfyjUn67EPwXY,307
|
11
|
+
divi/proto/core/v1/core_pb2_grpc.py,sha256=Sla4N0SjtZPtOVDmF9G2M38dSMyomjpgdlwM7b-7CmQ,3869
|
12
|
+
divi/proto/core/v1/health_check_request.proto,sha256=SWn6NmtivAkcPLj7Dt7HeSHwdZpWqWFdC7ghsVJMcEQ,162
|
13
|
+
divi/proto/core/v1/health_check_request_pb2.py,sha256=ZOcFrzDBglDz6K1hWfGKr_PEfNp-yEOdwWxBo_qtgrc,1580
|
14
|
+
divi/proto/core/v1/health_check_request_pb2.pyi,sha256=MJGIn1BwvGApZAZH0HFaUSTIaO7gqwoxLMZEM7INqEk,405
|
15
|
+
divi/proto/core/v1/health_check_request_pb2_grpc.py,sha256=E7ah12abIGk-pFFzqAIwgjpekfQajrTlW8A9qYSG7J4,920
|
16
|
+
divi/proto/core/v1/health_check_response.proto,sha256=BWpN374NCJTIfnDoCgWIPIiokipdHPx8yOsUgu8a2sA,184
|
17
|
+
divi/proto/core/v1/health_check_response_pb2.py,sha256=BoC2HLpfotx4ac2t_9iFwDXg3yiNjUlTgP0fhGA4uDk,1626
|
18
|
+
divi/proto/core/v1/health_check_response_pb2.pyi,sha256=pcxpVQ5VkOpyfFoh4am1-4xffRuW69ON-PzqVdOz4EA,492
|
19
|
+
divi/proto/core/v1/health_check_response_pb2_grpc.py,sha256=Y5BEKSJD5-mMEBwa3ugq-0MnNzyCIKXNX06gzr6MA2o,921
|
20
|
+
divi-0.0.1.dev7.dist-info/METADATA,sha256=XFIHLFRxL6PfSwMYkE7msKQ-OZb42VFvL60U_1ETdjM,916
|
21
|
+
divi-0.0.1.dev7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
22
|
+
divi-0.0.1.dev7.dist-info/licenses/LICENSE,sha256=5OJuZ4wMMEV0DgF0tofhAlS_KLkaUsZwwwDS2U_GwQ0,1063
|
23
|
+
divi-0.0.1.dev7.dist-info/RECORD,,
|
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 Kaikai
|
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.
|
divi/hello.py
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: divi
|
3
|
-
Version: 0.0.1.dev0
|
4
|
-
Summary: The Agent Platform for Observability & Evaluation
|
5
|
-
Requires-Python: >=3.11
|
6
|
-
Description-Content-Type: text/markdown
|
7
|
-
|
8
|
-
# SDK
|
9
|
-
|
10
|
-
> Python SDK for Divine Agent
|
11
|
-
|
12
|
-
## Version
|
13
|
-
|
14
|
-
Use `hatch` to manage the version of the SDK, follow the progression in [supported segments](https://hatch.pypa.io/latest/version/#supported-segments)
|
15
|
-
|
16
|
-
## Thanks
|
17
|
-
|
18
|
-
1. [uv](https://github.com/astral-sh/uv): An extremely fast Python package and project manager, written in Rust.
|
19
|
-
2. [hatch](https://github.com/pypa/hatch): Hatch is a modern, extensible Python project manager.
|
divi-0.0.1.dev0.dist-info/RECORD
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
divi/__init__.py,sha256=q0MFp_9IarnNwKmPXqIsym2glyxwDg_KrcgOEMpxpYQ,93
|
2
|
-
divi/hello.py,sha256=wMV7kaInsn9slGGrsuRhV_b1Xd7-ey53ZOY4vyIQuAw,92
|
3
|
-
divi-0.0.1.dev0.dist-info/METADATA,sha256=ptw3iXFWm9HBgG0aQgh-rotFdVqNBxJPifCpnoUnC9o,600
|
4
|
-
divi-0.0.1.dev0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
5
|
-
divi-0.0.1.dev0.dist-info/RECORD,,
|
File without changes
|