PyPb integration

Description:

By leveraging PowerBuilder’s native support for calling .NET assemblies, PyPb provides an object-centric wrapper around Python.NET, enabling PowerBuilder applications to interact directly with Python code and libraries.

Problem Solved:

It allows PowerBuilder developers to consume popular Python libraries (such as pandas, numpy, OpenCV, and openpyxl) within PowerScript without requiring external Web APIs or complex command-line inter-process communication.

Key Objects:

  • n_cst_pypbcontext: Initializes the Python runtime and manages module imports.

  • n_cst_pypbmodule: Represents a Python module; used for instantiating classes and invoking module-level functions.

  • n_cst_pypbobject: Represents a Python object instance; used to invoke methods, get/set properties, or convert data to PowerBuilder types.

  • n_cst_invocationrequest: Configures complex function calls, including those requiring positional arguments and keyword arguments (kwargs).

Supported Invocation Methods:

  • Direct Invocation: For calling functions or instantiating classes without arguments.

  • Invocation Request: For calls requiring specific arguments or the use of default/optional parameters.

  • Dynamic Proxy: Direct calls through the "idn_host" member that match Python signatures and return dotnetobjects (requires manual wrapping).

Interface Summary:

The library provides a PowerScript interface via methods such as of_import(), of_instantiate(), of_invoke(), of_get(), of_set(), and of_executestatement(). Errors from the Python runtime, including stack traces and messages, are automatically captured into an internal structure for debugging.

For documentation, demos, and source code, please refer to: https://github.com/Appeon/PyPb.