oto
oto copied to clipboard
Add python client generation to /example
1. Add python client to /example
2. [WIP] Generate python classes from def.Objects Requires:
- (Probably) Adding a Python mapping for (*Parser).parseFieldType ✅
- Creating classes for def.Objects ✅
- Create Constructor from object.Fields ✅
- Adding type hints via field.type 🚧
- ???
This statement seems pretty generic. I'm throwing in int for now, but should we look at breaking this into a few different cases (int, double, float)?
// (*Parser).parseFieldType()
...
case "int", "int16", "int32", "int64",
"uint", "uint16", "uint32", "uint64",
"float32", "float64":
ftype.JSType = "number"
ftype.SwiftType = "Double"
ftype.PythonType = "int"
}
We may need to name the generated file differently for python, as you can't import python files with periods in the name.
for example, I cannot import the following
from .client.gen import GreetRequest
but I can import
from .clientgen import GreetRequest.
This is likely because it's parsing for .py.
Docstring generation is coming along. It's pretty verbose, but it does make the cliengen more discoverable.
I'm still not super happy with the ide help here, it's just not super pretty.
@sethcenterbar What was the status on this in the end? Did you get it working?
Hey @matryer, I think it was working. I'm pretty sure I was looking for feedback here. Honestly, I'd have to open this back up and poke around. If you're happy with the basic implementation, I'll take some time this week to finish it up.
We may need to name the generated file differently for python, as you can't import python files with periods in the name.
for example, I cannot import the following
from .client.gen import GreetRequest
but I can import
from .clientgen import GreetRequest.
This is likely because it's parsing for .py.