-
Notifications
You must be signed in to change notification settings - Fork 123
Description
In response to my question here, I have filed an issue with an example case.
Refs #180
Test project:
gopytest.zip
Building using python-2.7, with
gopy pkg -name='gopytest' -output=./dist gopytest/pyapi
The project contains an "api" package, and then a "pyapi" package meant to export a Request
capability over the api, to python.
from gopytest import pyapi
req = pyapi.Request()
req.Count=2
ret = req.FetchPeople()
print(ret)
# pyapi.Slice_Ptr_api_Person([6, 7])
I find that instead of getting back a list of Person
instance, I would get a list of handles.
Person
class is actually not discovered from the import of "api" and exported, so I had to do a type alias in "pyapi" to end up seeing a python Person
class. Then I was able to manually map the handles to instances by constructing Person(handle=i)
.
Now if I try building both packages:
gopy pkg -name='gopytest' -output=./dist gopytest/pyapi gopytest/api
while it does generate all the types and two python modules, the api and pyapi modules have circular import dependencies and can't be used properly. "api" module will contain functions that want to call into "pyapi" which has not been imported. And if it were imported manually its a breaking circular import.
(from pr-180)
I'm pretty sure most of my current real-world use cases are slices of interface types and those all seem to be working properly without any bare handles being exposed.
Based on this suggestion, I tried adding a return type of a slice of interfaces, but it also ended up just creating a python list of handles.