Giter Club home page Giter Club logo

grpcalchemy's People

Contributors

guangtianli avatar pyup-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grpcalchemy's Issues

gRPCAlchemy can't import generated proto files on Windows

  • gRPCAlchemy version: 0.5.1
  • Python version: 3.7.6
  • Operating System: Windows

Description

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 :-)

Issue #32 (gRPCAlchemy can't import generated proto files on Windows) not fully solved.

  • gRPCAlchemy version: 0.6.1
  • Python version: 3.7.6
  • Operating System: Windows

Description

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.

f"{os.path.join(self.config.PROTO_TEMPLATE_ROOT, self.config.PROTO_TEMPLATE_PATH, bp.access_file_name()).replace('/', '.')}_pb2_grpc"

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.

feature-request: Propose adding a setting to make runtime proto generation optional.

For my particular use-case I'd like to be able to invoke poco generation at build and packaging, not at gRPC runtime. Propose:

  1. Adding a setting AUTO_GENERATE_POCOS (or similar) to settings with default to True (preserving current behavior), and;
  2. providing a public API to invoke generation of pocos during the build.

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.

Initial Update

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.

Breaking API Change - Use OOP to define `grpc service`, `grpc service method` and `process function`

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()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.