OpenAccess Integration
Enabling Python Support For Your Library
In order to access Python functionality in your library, you need to notify ADS.
This is done by setting PYTHON_ENABLED=TRUE in your libary’s eesof_lib.cfg file.
With PYTHON_ENABLED=TRUE, ADS will attempt to initialize your library when it is
first opened.
Library Initialization
Your PYTHON_ENABLED library may contain an optional __init__.py designating the library
as a Python module. Within __init__, ADS will attempt to execute an initialization routine
when the library is loaded. Subsequently, it will attempt to execute a shutdown routine when
the library is unloaded.
ADS will attempt to call the well-known functions from your library’s __init__.py:
# Optionally defined initialization routine for your library, called when your library is loaded
def setup_library(library: de.Library) -> None:
# perform any setup needed here
...
# Optionally defined shutdown routine for your library, called when your library is unloaded
def shutdown_library(library: de.Library) -> None:
# perform any cleanup here
...
Cell Initialization
Your PYTHON_ENABLED library may contain cells that require custom initialization. This can be
done by providing an optional __init__.py in your cell’s directory. ADS will attempt
to execute an initialization routine when your cell is first accessed.
ADS will attempt to call the well-known function from your cell’s __init__.py:
# Optionally defined initialization routine for your cell, called when your cell is first accessed
def setup_cell(cell: de.Cell) -> None:
# perform any setup needed here
...
ADS will attempt to create an item definition for your cell, if it exists. In order to do so,
you must define your item definition within your cell using the well-known file name itemdef.py.
Inside itemdef.py, you must define the well-known method create_itemdef. Upon accessing
your cell, ADS will attempt to create the item definition.
For PYTHON_ENABLED libraries, ADS will first attempt to create the item definition executing
create_itemdef in the cell’s itemdef.py. If that method is not available, ADS will attempt
to create the item definition by loading an AEL implementation in itemdef.ael.
View Initialization
Your PYTHON_ENABLED library may contain views, such as a PCell, that require custom
initialization. This can be done by providing an optional __init__.py in your view’s directory.
ADS will attempt to execute an initialization routine when your view is first accessed.
ADS will attempt to call the well-known function from your view’s __init__.py:
def setup_view(view: de.View) -> None:
# perform any setup needed here
...