feat: add embeddedpy-bridge as a ZPM dependency#14
feat: add embeddedpy-bridge as a ZPM dependency#14AshokThangavel wants to merge 1 commit intointersystems-community:masterfrom
Conversation
|
@AshokThangavel thanks for the PR! |
|
Hi @evshvarov I implemented this logic today, so no other repositories currently using expect the actual implementation repository/application. These wrapper classes make it easy to integrate the embedded Python logic when handling python Idiomatic IterationIn standard Embedded Python, looping through a list or dictionary requires manual handling of the Python The "simplified" Way: Set iter = pyList.%GetIterator()
While iter.%GetNext(.key, .val) {
// Secure, clean, and familiar syntax
}
Simplified Type Creation & ConversionCreating Python types or converting data typically requires repeated imports of Python libraries like Before (Verbose): Set dict = ##class(%SYS.Python).Import("builtins").dict()
Set pyObj = ##class(%SYS.Python).Import("json").loads(dynObj.%ToJSON())After (Concise): Set dict = $$$pyDict
Set pyObj = $$$pyJSON(dynObj)By hiding the manual imports and type-casting inside these macros, the code becomes much easier to maintain, read, and use by developers. Thank you! |
Description:
This PR integrates the embeddedpy-bridge library as a core dependency. This addition significantly improves the Developer Experience when working with Embedded Python inside ObjectScript by providing high-level wrappers and a more intuitive syntax.
Key Changes:
Dependency Management: Added embeddedpy-bridge to module.xml.
$$$pyDict: Instantly creates a Python-wrapped Dictionary. No need to manage proxies manually.$$$pyList: Instantly creates a Python-wrapped List (Note: Ensure your macro is mapped to pyList for consistency).$$$pyJSON(obj): Converts a native IRIS Dynamic Object directly into a Python object.and it includes features such as create and iterate the python dictionary and list in iris syntax
Why this is beneficial:
Readability: Reduces boilerplate code by ~30% in typical Python-heavy ObjectScript classes.
Standardization: Provides a common "bridge" pattern that is easier for beginners to learn than raw proxy manipulation.
Community Post: https://community.intersystems.com/post/embeddedpy-bridge-toolkit-embedded-python