guangtianli / grpcalchemy Goto Github PK
View Code? Open in Web Editor NEWThe Python micro framework for building gPRC application.
Home Page: https://grpcalchemy.readthedocs.io
License: MIT License
The Python micro framework for building gPRC application.
Home Page: https://grpcalchemy.readthedocs.io
License: MIT License
gRPCAlchemy can't import generated proto files on Windows, see this error:
ModuleNotFoundError: No module named 'protos\hellomessage_pb2'
I think this is due to https://github.com/GuangTianLi/grpcalchemy/blob/master/grpcalchemy/utils.py#L104 and https://github.com/GuangTianLi/grpcalchemy/blob/master/grpcalchemy/server.py#L119 replacing '/' with '.', since on windows the directory separator is '\', as you can see from the error message.
Hope this helps :-)
I believe the windows issue #32 is still present in server.py
on lines 192 and 195. gRPCAlchemy can't import generated proto files on Windows, see this error:
ModuleNotFoundError: No module named 'protos\hellomessage_pb2'
It looks to me like the fix applied to utils.py
will do the trick for server.py
. I will try to PR a fix asap, but wanted to let you know in the meantime.
grpcalchemy/grpcalchemy/server.py
Line 192 in e83839e
Proposed fix, use:
if sys.platform == "win32":
FILE_SEPARATOR = "\\"
else:
FILE_SEPARATOR = "/"
This problem doesn't exist using linux. Thank you for this excellent library btw.
For my particular use-case I'd like to be able to invoke poco generation at build and packaging, not at gRPC runtime. Propose:
Basically proposing to make the call to generate_proto_file
in server.run
optional.
Happy to do the work and PR, but thought I'd raise here.
The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.
The Philosophy of API design evolves from Flask
to Django
.
Origin API:
from grpcalchemy import Server, Context
app = Server('HelloService')
@app.register
def Hello(request: HelloMessage, context: Context) -> HelloMessage:
return HelloMessage(text=f'Hello {request.text}')
if __name__ == '__main__':
app.run()
Now:
from grpcalchemy import Server, Context, grpcservice
class HelloService(Server):
@grpcservice
def Hello(self, request: HelloMessage, context: Context) -> HelloMessage:
return HelloMessage(text=f'Hello {request.text}')
if __name__ == '__main__':
app = HelloService()
app.run()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.