intersystems-community / PythonGateway

Execute Python code from InterSystems Data Platforms
https://openexchange.intersystems.com/index.html#!/package/PythonGateway
MIT License
13 stars 16 forks source link

Proxy gateway #41

Closed eduard93 closed 5 years ago

eduard93 commented 5 years ago

Import selected modules/classes/functions and generate ObjectScript classes and methods to call python.

Complete proxy gateway would be great to have but I'm not sure how much time it would take to implement. I'll research at least the scope of the project. Issues:

eduard93 commented 5 years ago
import random
import inspect
classes = inspect.getmembers(random, inspect.isclass)
tree = inspect.getclasstree([cls[1] for cls in classes], 1)
tree

https://docs.python.org/3/library/inspect.html#inspect.getclasstree

eduard93 commented 5 years ago

https://www.python-course.eu/python3_class_and_instance_attributes.php

eduard93 commented 5 years ago

Currently failing:

Maybe try to parse signature if explicit arguments fail? Or provide args?

eduard93 commented 5 years ago

Options:

eduard93 commented 5 years ago

Need better method/classmethod detection

eduard93 commented 5 years ago

Problems so far:

eduard93 commented 5 years ago

Can datatype redefine getter?

eduard93 commented 5 years ago
s str2=##class(py.builtins.str).%New(,"str2","'dvd'")
s bytes=str2.encode() <-fail
s sc = ##class(isc.py.Main).ImportModule("zlib")
write ##class(py.zlib).crc32(bytes)

write ##class(py.zlib).crc32("b'dvd'")

write ##class(py.zlib).crc32("b'dvd'")
2200289759
PYTHON>w $ZCRC("dvd",7)
eduard93 commented 5 years ago

Closed.

Open releated issues on individual basis.