Skip to content

Commit

Permalink
wedpr_python_gateway_sdk support install (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyjseagull authored Oct 18, 2024
1 parent 9e3172c commit 1562aa7
Show file tree
Hide file tree
Showing 28 changed files with 53 additions and 45 deletions.
2 changes: 1 addition & 1 deletion cpp/cmake/TargetSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ set(WEDPR_TRANSPORT_SDK_TARGET wedpr-transport-sdk)
# ==== the swig wrapper =====
set(WEDPR_PYTHON_TRANSPORT "wedpr_python_transport")
set(WEDPR_PYTHON_TRANSPORT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/python/generated/${WEDPR_PYTHON_TRANSPORT})
set(WEDPR_PYTHON_TRANSPORT_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/wedpr-transport/sdk-wrapper/python/bindings/libs)
set(WEDPR_PYTHON_TRANSPORT_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/wedpr-transport/sdk-wrapper/python/bindings/wedpr_python_gateway_sdk/libs)

set(WEDPR_JAVA_TRANSPORT "wedpr_java_transport_jni")
set(WEDPR_JAVA_TRANSPORT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/java/generated/${WEDPR_JAVA_TRANSPORT})
Expand Down
3 changes: 3 additions & 0 deletions cpp/wedpr-transport/sdk-wrapper/python/bindings/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include CHANGELOG.md
include *requirements.txt
include ./wedpr_python_gateway_sdk/libs/libwedpr_python_transport*
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# -*- coding: utf-8 -*-
# Note: here can't be refactored by autopep
import os
import sys
import os
root_path = os.path.abspath(os.path.dirname(__file__))
sys.path.append(os.path.join(root_path, "../.."))

sys.path.append(os.path.join(root_path, "../"))

import argparse
from transport.impl.transport import Transport
from transport.impl.transport_config import TransportConfig
from transport.impl.transport_loader import TransportLoader
import time
from wedpr_python_gateway_sdk.transport.impl.transport_loader import TransportLoader
from wedpr_python_gateway_sdk.transport.impl.transport_config import TransportConfig
from wedpr_python_gateway_sdk.transport.impl.transport import Transport
import argparse
import sys


def parse_args():
Expand Down
6 changes: 5 additions & 1 deletion cpp/wedpr-transport/sdk-wrapper/python/bindings/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def run(self):
setup_args = dict(
name='wedpr-python-gateway-sdk',
packages=find_packages(),
version="1.0.0-rc1",
version="1.0.0-rc1-20241018",
description="wedpr-python-gateway-sdk: The gateway sdk for WeDPR",
long_description_content_type="text/markdown",
author="WeDPR Development Team",
Expand All @@ -31,6 +31,10 @@ def run(self):
keywords=['Interactive', 'Interpreter', 'Shell', 'Web'],
python_requires=">=3.8",
include_package_data=True,
package_data={
# the library setting
'': ['wedpr_python_gateway_sdk/libs/libwedpr_python_transport.*'],
},
classifiers=[
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import shutil
import pkg_resources
from utils.lib_loader import LibLoader
from wedpr_python_gateway_sdk.utils.lib_loader import LibLoader


def __bootstrap__():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-

from abc import ABC, abstractmethod
from transport.api.message_api import MessageAPI
from wedpr_python_gateway_sdk.transport.api.message_api import MessageAPI


class TransportAPI(ABC):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from sys import version_info as _swig_python_version_info

# Import the low-level C/C++ module
from libs import _wedpr_python_transport
from wedpr_python_gateway_sdk.libs import _wedpr_python_transport


try:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from wedpr_python_gateway_sdk.transport.impl.message_impl import MessageImpl
from wedpr_python_gateway_sdk.transport.api.message_api import MessageAPI
from wedpr_python_gateway_sdk.transport.generated.wedpr_python_transport import Message


class MessageFactory:
@staticmethod
def build(message: Message) -> MessageAPI:
if message is None:
return None
return MessageImpl(message)
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-

from transport.api.message_api import MessageHeaderAPI
from transport.api.message_api import MessageAPI
from transport.generated.wedpr_python_transport import Message
from transport.generated.wedpr_python_transport import MessageHeader
from wedpr_python_gateway_sdk.transport.api.message_api import MessageHeaderAPI
from wedpr_python_gateway_sdk.transport.api.message_api import MessageAPI
from wedpr_python_gateway_sdk.transport.generated.wedpr_python_transport import Message
from wedpr_python_gateway_sdk.transport.generated.wedpr_python_transport import MessageHeader


class MessageHeaderImpl(MessageHeaderAPI):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from transport.generated.wedpr_python_transport import MessageOptionalHeaderBuilder
from transport.generated.wedpr_python_transport import MessageOptionalHeader
from wedpr_python_gateway_sdk.transport.generated.wedpr_python_transport import MessageOptionalHeaderBuilder
from wedpr_python_gateway_sdk.transport.generated.wedpr_python_transport import MessageOptionalHeader


class RouteInfoBuilder:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-

from transport.generated.wedpr_python_transport import TransportBuilder
from transport.generated.wedpr_python_transport import Transport
from transport.generated.wedpr_python_transport import Error
from transport.api.message_api import MessageAPI
from transport.impl.route_info_builder import RouteInfoBuilder
from transport.impl.message_factory import MessageFactory
from transport.generated.wedpr_python_transport import MessageOptionalHeader
from transport.api.transport_api import TransportAPI
from wedpr_python_gateway_sdk.transport.generated.wedpr_python_transport import TransportBuilder
from wedpr_python_gateway_sdk.transport.generated.wedpr_python_transport import Transport
from wedpr_python_gateway_sdk.transport.generated.wedpr_python_transport import Error
from wedpr_python_gateway_sdk.transport.api.message_api import MessageAPI
from wedpr_python_gateway_sdk.transport.impl.route_info_builder import RouteInfoBuilder
from wedpr_python_gateway_sdk.transport.impl.message_factory import MessageFactory
from wedpr_python_gateway_sdk.transport.generated.wedpr_python_transport import MessageOptionalHeader
from wedpr_python_gateway_sdk.transport.api.transport_api import TransportAPI

from enum import Enum
import signal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-

from transport.generated.wedpr_python_transport import FrontConfig
from transport.generated.wedpr_python_transport import TransportBuilder
from transport.generated.wedpr_python_transport import EndPoint
from transport.generated.wedpr_python_transport import GrpcConfig
from wedpr_python_gateway_sdk.transport.generated.wedpr_python_transport import FrontConfig
from wedpr_python_gateway_sdk.transport.generated.wedpr_python_transport import TransportBuilder
from wedpr_python_gateway_sdk.transport.generated.wedpr_python_transport import EndPoint
from wedpr_python_gateway_sdk.transport.generated.wedpr_python_transport import GrpcConfig


class TransportConfig:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from transport.impl.transport_config import TransportConfig
from transport.generated.wedpr_python_transport import TransportBuilder
from transport.impl.transport import Transport
from wedpr_python_gateway_sdk.transport.impl.transport_config import TransportConfig
from wedpr_python_gateway_sdk.transport.generated.wedpr_python_transport import TransportBuilder
from wedpr_python_gateway_sdk.transport.impl.transport import Transport
import signal


Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
import unittest
from wedpr_python_gateway_sdk.utils.lib_loader import LibLoader


class TestLibLoader(unittest.TestCase):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%define MODULEIMPORT
"
# Import the low-level C/C++ module
from libs import _wedpr_python_transport
from wedpr_python_gateway_sdk.libs import _wedpr_python_transport
"
%enddef

Expand Down

0 comments on commit 1562aa7

Please sign in to comment.