.NET assembly enhancement -- calling Python through PyPb (beta feature)

Description:

PyPb extends the PowerBuilder .NET assembly capability by enabling direct access to Python modules without requiring developers to learn any .NET knowledge or write any .NET code.

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.

Beta feature

PyPb is currently released as a Beta feature. We welcome feedback and issue reports through the standard support process.

Problem Solved:

PyPb enables PowerBuilder developers to consume popular Python libraries (such as pandas, numpy, OpenCV, and openpyxl) within PowerScript without relying on 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 more information about documentation, demos, and source code, please visit https://github.com/Appeon/PyPb.