forked from tinode/chat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
packaging of python grpc seems to work now
- Loading branch information
Showing
8 changed files
with
60 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# grpc-tools generates python 2 file which does not work with | ||
# python3 packaging system. This is a fix. | ||
|
||
model_pb2_grpc = "../py_grpc/tinode_grpc/model_pb2_grpc.py" | ||
|
||
with open(model_pb2_grpc, "r") as fh: | ||
content = fh.read().replace("import model_pb2 as model__pb2", | ||
"from . import model_pb2 as model__pb2") | ||
|
||
with open(model_pb2_grpc,"w") as fh: | ||
fh.write(content) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
The code in this folder is licensed under Apache 2.0 | ||
http://www.apache.org/licenses/LICENSE-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Generated Protocol Buffer and gRPC files for [Tinode](https://github.com/tinode) | ||
|
||
Generated Python code for [gRPC](https://grpc.io/) client and plugins. | ||
|
||
gRPC clients must implement rpc service `Node`, plugins must implement `Plugin`. | ||
|
||
For a sample implementation of a command line client see [tn-cli](../tn-cli/). | ||
For a partial plugin implementation see [chatbot](../chatbot/). | ||
|
||
## Installing | ||
|
||
Install the package by executing | ||
``` | ||
pip install tinode_grpc | ||
``` | ||
|
||
|
||
## Generating files | ||
|
||
Don't modify included files directly. If you want to make changes, you have to install protobuffers tool chain and gRPC the generate the Python bindings from [`pbx/model.proto`](../pbx/model.proto) (your path to `model.proto` may be different): | ||
``` | ||
python -m grpc_tools.protoc -I../pbx --python_out=. --grpc_python_out=. ../pbx/model.proto | ||
``` | ||
The generated `model_pb2_grpc.py` imports `model_pb2.py` as a module instead of a package which is incompatible with python3 packaging system. Use `../pbx/py_fix.py` to apply a fix. This is only needed if you want to repackage the generated files. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
from .model_pb2 import * | ||
from .model_pb2_grpc import * | ||
from . import model_pb2 as pb | ||
from . import model_pb2_grpc as pbx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters