mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +00:00
Move bbgo_pb2 files and add them to packages
This commit is contained in:
parent
8e601a5cde
commit
12758aaeb2
8
Makefile
8
Makefile
|
@ -17,8 +17,6 @@ OSX_APP_GUI ?= webview
|
||||||
|
|
||||||
FRONTEND_EXPORT_DIR = frontend/out
|
FRONTEND_EXPORT_DIR = frontend/out
|
||||||
|
|
||||||
PYTHON_PACKAGE_DIR = $(PWD)/python/bbgo
|
|
||||||
|
|
||||||
all: bbgo-linux bbgo-darwin
|
all: bbgo-linux bbgo-darwin
|
||||||
|
|
||||||
$(BIN_DIR):
|
$(BIN_DIR):
|
||||||
|
@ -257,11 +255,9 @@ install-grpc-tools:
|
||||||
# replace `import bbgo_pb2` by `from . import bbgo_pb2` to use relative import
|
# replace `import bbgo_pb2` by `from . import bbgo_pb2` to use relative import
|
||||||
grpc-py:
|
grpc-py:
|
||||||
python -m grpc_tools.protoc -I$(PWD)/pkg/pb \
|
python -m grpc_tools.protoc -I$(PWD)/pkg/pb \
|
||||||
--python_out=$(PYTHON_PACKAGE_DIR) \
|
--python_out=$(PWD)/python \
|
||||||
--grpc_python_out=$(PYTHON_PACKAGE_DIR) \
|
--grpc_python_out=$(PWD)/python \
|
||||||
$(PWD)/pkg/pb/bbgo.proto
|
$(PWD)/pkg/pb/bbgo.proto
|
||||||
cat $(PYTHON_PACKAGE_DIR)/bbgo_pb2_grpc.py | sed -e 's/import\ bbgo_pb2/from\ .\ import\ bbgo_pb2/g' > tmp.py
|
|
||||||
mv tmp.py $(PYTHON_PACKAGE_DIR)/bbgo_pb2_grpc.py
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(BUILD_DIR) $(DIST_DIR) $(FRONTEND_EXPORT_DIR) $(GRPC_GO_DEPS) pkg/pb/*.pb.go
|
rm -rf $(BUILD_DIR) $(DIST_DIR) $(FRONTEND_EXPORT_DIR) $(GRPC_GO_DEPS) pkg/pb/*.pb.go
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from . import bbgo_pb2
|
import bbgo_pb2
|
||||||
from . import bbgo_pb2_grpc
|
import bbgo_pb2_grpc
|
||||||
|
|
||||||
|
|
||||||
class UserDataService(object):
|
class UserDataService(object):
|
||||||
|
|
|
@ -2,11 +2,10 @@ import asyncio
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
import bbgo_pb2
|
||||||
|
import bbgo_pb2_grpc
|
||||||
import grpc
|
import grpc
|
||||||
|
|
||||||
from . import bbgo_pb2
|
|
||||||
from . import bbgo_pb2_grpc
|
|
||||||
|
|
||||||
|
|
||||||
class Stream(object):
|
class Stream(object):
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"""Client and server classes corresponding to protobuf-defined services."""
|
"""Client and server classes corresponding to protobuf-defined services."""
|
||||||
import grpc
|
import grpc
|
||||||
|
|
||||||
from . import bbgo_pb2 as bbgo__pb2
|
import bbgo_pb2 as bbgo__pb2
|
||||||
|
|
||||||
|
|
||||||
class MarketDataServiceStub(object):
|
class MarketDataServiceStub(object):
|
|
@ -3,6 +3,11 @@ name = "bbgo"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = ""
|
description = ""
|
||||||
authors = ["なるみ <weaper@gmail.com>"]
|
authors = ["なるみ <weaper@gmail.com>"]
|
||||||
|
packages = [
|
||||||
|
{ include = "bbgo" },
|
||||||
|
{ include = "bbgo_pb2.py" },
|
||||||
|
{ include = "bbgo_pb2_grpc.py" },
|
||||||
|
]
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.8"
|
python = "^3.8"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from bbgo import bbgo_pb2
|
import bbgo_pb2
|
||||||
from bbgo import bbgo_pb2_grpc
|
import bbgo_pb2_grpc
|
||||||
|
|
||||||
|
|
||||||
class TestTradingServicer(bbgo_pb2_grpc.TradingServiceServicer):
|
class TestTradingServicer(bbgo_pb2_grpc.TradingServiceServicer):
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
from concurrent import futures
|
from concurrent import futures
|
||||||
|
|
||||||
|
import bbgo_pb2
|
||||||
|
import bbgo_pb2_grpc
|
||||||
import grpc
|
import grpc
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from bbgo import MarketService, TradingService
|
from bbgo import MarketService
|
||||||
from bbgo import bbgo_pb2
|
from bbgo import TradingService
|
||||||
from bbgo import bbgo_pb2_grpc
|
|
||||||
from tests.servicer import TestTradingServicer
|
from tests.servicer import TestTradingServicer
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user