New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python client stub generator #176
Conversation
Hi! Thank you for this contribution. I do like your approach with the external library. I was just wondering if there isn't an already existing python json-rpc implementation that is kind of more standard? For example this: https://pypi.python.org/pypi/json-rpc |
Hi! I checked out quite a few different python json-rpc libraries when I was developing this PR. I definitely didn't want to reinvent the wheel, but I never really found one that was quite what I wanted. Most of the libraries were tightly coupled to their transport implementations, and those that weren't had other things I didn't like. https://pypi.python.org/pypi/json-rpc is good, but it seemed like there wasn't a clean way to implement an object-oriented client with it. My favorite library was https://github.com/gerold-penz/python-jsonrpc, but it doesn't support python 3, and the maintainer has no interest in anyone adding python 3 support. Tinyrpc also doesn't have python 3 support, and isn't actively developed. https://jsonrpcclient.readthedocs.io looks like it could work. Ultimately, I just decided that it'd be easiest to make my own library that had an architecture that easily integrated with your stubgen. If you'd like, I can continue looking at other libraries, though, and see if I can contribute to them to add the functionality I need. Thanks for taking the time to look at my PR! |
I see, great that evaluated some frameworks. It is a pitty that they are so badly decoupled. I would be open to merge the PR as is, if you could do a quick evaluation on https://jsonrpcclient.readthedocs.io and decide that is has major drawbacks over your current solution. Could you do that? Thank you very much for your efforts. |
Sure, I can do that. I'll check it out and let you know what I find.
…On Wed, Nov 30, 2016, 05:57 Peter Spiess-Knafl ***@***.***> wrote:
I see, great that evaluated some frameworks. It is a pitty that they are
so badly decoupled.
I would be open to merge the PR as is, if you could do a quick evaluation
on https://jsonrpcclient.readthedocs.io and decide that is has major
drawbacks over your current solution.
Could you do that? Thank you very much for your efforts.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#176 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/APfdurHxyzPN2IPYZtlN5dqYpZHA2qjBks5rDYDggaJpZM4Kn1Sv>
.
|
By itself, I'm able to make jsonrpcclient work with your server, but I couldn't manage to get it to integrate inside another class that I could autogen. It's architecture is basically such that each transport mechanism (http, etc.) has it's own client (there's an http_client, zeromq_client, etc.); rather than having a general client that "has a" transport, each transport subclasses the general client. I think I prefer the libjson-rpc-cpp's architecture, which my library copied. For what it's worth, the majority of what I want to do could be done with jsonrpcclient without doing any stub generation, but I kind of like having a unified spec/contract that can be used for a python client and a cpp server. |
Thanks for going the extra mile. I will merge your PR within the next days. |
I've added support for generating python client stubs.
Rather than littering this repo with python files or using the stubgenerator to make a monolithic python file with all of the required classes, I decided to make an independent python client library located at:
https://github.com/tvannoy/jsonrpc_pyclient
https://pypi.python.org/pypi/jsonrpc-pyclient/1.0.1
To use the generated python client stub, one needs to install the above library with "pip install jsonrpc_pyclient". The python library currently supports http and tcp sockets.
I wasn't quite sure how to document the need for the external library, so I mentioned it in the generated python file and in doxygen for the PythonClientStubGenerator.
I'm open to suggestions.