-
Notifications
You must be signed in to change notification settings - Fork 54
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
Client library generation #192
Conversation
Do we want SDK to be totally independent from snet-cli? Why we cannot use the same directories? In any case, If we want to add the possibility to use different directories then I propose the following: I could rewrite MPEChannelCommand and MPEClientCommand command in such a way that you will be able to easily reuse them in SDK. I only need to add the possibility to use arbitrary directory for the channel (not only |
I propose to make a list of function which we need for SDK. I will add the possibility to run them with arbitrary channel directory.
|
@astroseger a base sdk needs to be independent from the CLI codebase because the sdk might not be in python. However, some functions that we need for the cli are the same as what we need for a base Python sdk: what I would do is publish those utility methods as separate packages that we can take as dependencies in both snet-cli and snet-sdk-python. |
It is exactly what I'm talking about. But I propose to not rewrite these function and then publish them as separate function, but directly use functions which already exist. For example, as I've said, Otherwise you will need to re-implement half of the code in MPEChannelCommand and MPEClientCommand (as you did in SDKCommand.generate_client_library).... |
@vforvalerio87
To have possibility to use them from python-SDK? If we don't do it, we will have two version of the code which do the same thing and we will force to struggle in the future to unify it.... (similar to |
The issue is, the sdk will be a completely different package in a different repo. That's why I was suggesting that if we want to share code between sdk and cli, some functions should go in a common package that is shared between the two repos. The |
I don't see the reason of this decision. Why don't you want to reuse the code of snet-cli? I don't see why you want to reimplement everything. For example.
Please send me a list of function which you need. I will say which functions (and how) you should call... Why do you want to re-implement these functions??? |
I'm not saying I want to reimplement everything, I'm saying that a user of the platform should not need to incorporate the whole CLI inside his software just to use a few functions |
and what about incorporating web3.py? web3.py is much bigger than snet-cli. |
I agree with @vforvalerio87 point that package hierarchy:
or
is more reasonable than
And it doesn't necessary mean re-implementing all from the scratch, it means moving code into separate package/repo. |
I will make PR on @vforvalerio87 branch with proposition how to avoid code duplication (it will do exactly the same :) )... |
There is a potential problem with different Ethereum networks or with different Registry/MultiPartyEscrow on the same networks (even some vague possibilities to attack). Maybe we could add "<registry_address>_<mpe_address>" in the path...
|
by the way. As part of #201 I will change directories inside snet-cli in the similar manner. So I will keep channels separately for each service in directories:
So SDK and snet-cli will have the similar structure of directories.. |
Merged in your PR, added a small change (generating client library relative to current working directory instead of relative to cli installation path) Please take a look at singnet/snet-sdk-python#5 which is the SDK, essentially. I'm also adding @raamb and @ferrouswheel to the discussion for feedback. Presently, I would merge this in and merge the snet-sdk-python PR in; then we should open a separate issue on what to do with the sdk/cli code duplication issue, which comes down to three possible solutions in my opinion:
|
@vforvalerio87 There is a potential problem that you keep compiled files in What will happen if you have different service with the same name in different networks or simply in different versions of Registry? I insist that you need to store compiled files in: |
…rectory updating PyYAML version to fix compatibility with Python 3.7
df04c06
to
f9f2f9f
Compare
Done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you've added only registry address to the path, which is totally fine if you don't store any channels related information in these paths.....
We don't, these are just the compiled client libraries which the user should move/copy over to where his client application is |
@vforvalerio87 should I merge your PR? (but It seems you are also could do it...) |
I can but didn't want to force anything... looks good to merge to me! |
Generate python client libraries to target directory from cli by specifying organization id and service id
Updated grpicio-tools, and pyyaml for Python 3.7 compatibility
Libraries are to be used with snet-python-sdk (PR incoming) to accommodate for import paths in compiled .py grpc files and intercept client calls to add mpe metadata