mirage / ocaml-rpc

Light library to deal with RPCs in OCaml
ISC License
95 stars 30 forks source link

pythongen: make code more pythonic #96

Closed mseri closed 6 years ago

mseri commented 6 years ago

There is still an outstanding issue: pythongen imports xapi and storage from xapi-storage. I am going to fix it as well, but it's good to start reviewing the code

mseri commented 6 years ago

The last commit fixes the import thing.

@gaborigloi with this change, in xapi-storage you will have to use

of_interfaces ~helpers:"from xapi import *" interfaces

The example stubs are still xapi and xapi.storage dependent, I am not yet sure how to fix them. Probably they need to be provided by the packages using the library. Not sure yet

gaborigloi commented 6 years ago

Could we add an annotation to e.failure() to make pylint work?

mseri commented 6 years ago

pylint will not work anyway as it does not like the long int syntax and lines longer than 80 characters

mseri commented 6 years ago

I did run pycodestyle on it. With the latest commit the only complaint it has is `E501 line longer than 80 characters"

mseri commented 6 years ago

I was able to run pylint on a buildenv, now the generated python passes pylint as well

mseri commented 6 years ago

And now we don't even need the pylint annotation

gaborigloi commented 6 years ago

We had an issue with the generated code where it was saying that "1423432 does not have type int64". We tried passing both with and without "L".

mseri commented 6 years ago

Can you run another test with the latest changes. I've done some more cleanup and uniformed the module with the main Rpc

gaborigloi commented 6 years ago

The quicktests passed again :)

mseri commented 6 years ago

Let's merge. We can make further cleanups in subsequent PRs if needed