The documentation from version 39.5.17 of PLANTA project can be found in the new PLANTA Online Help.

Python Integration

General

Information
  • There are two Python interpreters integrated in the PLANTA software:
    • IronPython v2.7.2
    • CPython v3.2.4

Details

Note

  • Parts of the following documentation are only available in English.

See also: Python API Reference (on the Server Side), HQL API (on the Server Side), Python Value Range (on the Server Side), Python Debugging (on the Server Side), IronPython API (on the Client Side), Directory Structure of Clients and Server

Technical Details

Information

  • Within the PLANTA Server, a CPython interpreter (v3.2.4) is running.
  • Since all sessions of a server share the same interpreter, all global objects are shared between all sessions as well.
    • If you add, e.g., a new attribute to a Python module, this attribute is retrievable in other sessions as well. If a status is to be saved in the active session only, you should use ppms.get_session_dict().

ppms Module

Information

  • The part of the PLANTA Server written in C makes particular functions available in a function library.
    • This function library is located in the server directory under /dlls/ by default and named _ppms.so or _ppms.dll depending on the operation system.
  • In the ppms directory, there is the
    • ppms_py file, This file is automatically generated with the help of SWIG and makes the C function available.
    • ppms.py file that combines both modules and contains the actual interface to PLANTA. Here, PLANTA is expanded by functions that are written in Python only.

Injections

Information
  • At several positions in the system, a Python code can be stored, which is then executed by the program.
  • Upon execution, a Python module object is created from the source text. As a result, other attributes are possibly inserted.
  • At every position in the system, the ppms module is made available automatically. If there is a code in the Value range field, the inspect module is imported additionally.

Python Path

From S 39.5.18

Information
  • By default, the PYTHONPATH environment variable is set for the server by the respective start scripts.
  • NEW After the server has started the Python interpreter, the startup.py, which further adjusts the path, is imported.
  • NEW The standard order configured by PLANTA reads as follows:
    • py/distribution
    • dlls
    • dlls/python34.zip
    • lib
    • py
    • py/pysrc
    • py/distribution/site-packages
    • py/api/ppms/wrapper/system
    • py/api/ppms/wrapper
    • py/api/ppms/customizing/venus
    • py/api/ppms/server

Up to S 39.5.18

Information
  • By default, the PYTHONPATH environment variable is set for the server by the respective start scripts.
  • The standard order configured by PLANTA is as follows:
    • py
    • py/pysrc
    • py/system
    • py/system/python32
    • dlls
    • py/customer
    • py/planta_ch
    • py/planta_de
    • migration/planta_de
    • migration/planta_ch
    • migration/customer

Import Wrapper

From S 39.5.18

In the /api/ppms/wrapper/ directory, there are the following subdirectories:
/planta_de/ NEW Contains the new import wrapper. The real files are located at /customizing/ and /server/.
/planta_ch/ Contains the Python files of PLANTA Switzerland
/customer/ Contains the customer specifique Python files as well as files that change or expand the standard functionalities.
  • If new individual files are created in the customer directory, the session must be restarted in order to generate the wrapper files under system.
/system/ Contains the old import wrapper. The files in the subdirectories of this directory
  • show the structure of the other directories.
  • import the code from planta_de, planta_ch and customer in this sequence. So if a function is defined under planta_de, it can be overwritten in the respective file in the customer directory.
=pysrc= Contains the files for the Python debugger

From S 39.5.15

In the /api/ppms/wrapper/ directory, there are the following subdirectories:
/planta_de/ Contains the standard Python files as provided with the standard
/planta_ch/ Contains the Python files of PLANTA Switzerland
/customer/ Contains the customized Python files as well as files that change or expand the standard functionalities.
  • If new individual files are created in the customer directory, NEW the session must be restarted in order to generate the wrapper files under system.
/system/ Contains the old import wrapper. The files in the subdirectories of this directory
  • show the structure of the other directories.
  • import the code from planta_de, planta_ch and customer in this sequence. So if a function is defined under planta_de, it can be overwritten in the respective file in the customer directory.
pysrc Contains the files for the Python debugger

Up to S 39.5.15

In the Python directory, there are the following subdirectories:
/planta_de/ Contains the standard Python files as provided with the standard
/planta_ch/ Contains the Python files of PLANTA Switzerland
/customer/ Contains the customized Python files as well as files that change or expand the standard functionalities.
  • If new individual files are created in the customer directory, the CreateFolderPacket migration packet must be run in order to generate the wrapper files under system.
/system/ Contains the new import wrappers. The files in the subdirectories of this directory
  • show the structure of the other directories.
  • import the code from planta_de, planta_ch and customer in this sequence. So if a function is defined under planta_de, it can be overwritten in the respective file in the customer directory.
pysrc Contains the files for the Python debugger

Client Server RPC

Client Server Interaction in Python is enabled via the Client Server RPC Interface.
  • For this purpose, Client and Server can offer services via which clearly defined operations for mutual execution are published.
  • For safety-conscious service implementation, the RPC interface permits a safe access to functionality and resources.
  • The functionality is made available transparently here. A function call of a published function returns return values in the same way as is done for local function calls.
  • For longer todo items for which the return is irrelevant or only needed at a later point, you also have the option to make an asynchronic function call.

         PLANTA project









 
  • Suche in Topic-Namen

  • Suche in Topic-Inhalten
This site is powered by the TWiki collaboration platform Powered by Perl