Evgeny Shvarov · Feb 9, 2021 3m read

Deploying InterSystems IRIS Embedded Python Solutions with ZPM Package Manager

Hi developers!

Recently we announced the preview of Embedded Python technology in InterSystems IRIS.

Check the Sneak Peak video by @Bob Kuszewski.

Embedded python gives the option to load and run python code in the InterSystems IRIS server. You can either use library modules from Python pip, like numpy, pandas, etc, or you can write your own python modules in the form of standalone py files.

So once you are happy with the development phase of the IRIS Embedded Python solution there is another very important question of how the solution could be deployed.

One of the options you can consider is using the ZPM Package manager which is described in this article.

I want to introduce you a template repository that introduces a deployable ZPM module and shows how to build such a module.

The example is very simple and it contains one, that demonstrates the usage of pandas and NumPy python libs and the test.cls objectscript class that makes calls to it.

The solution could be installed with ZPM as:

zpm "install iris-python-template"

NB: Make sure the IRIS you install the module contains an Embedded Python preview code. E.g. you can use the image: 


With commands:

docker run --rm --name my-iris -d --publish 9091:1972 --publish 9092:52773 intersystemsdc/iris-ml-community:2020.3.0.302.0-zpm
docker exec -it my-iris iris session IRIS

USER>zpm "install iris-python-template"

[iris-python-template] Reload START


[iris-python-template] Activate SUCCESS


The module installs python file and titanic.csv sample file along with test.cls to the system. 

E.g. exposes meanage() function which accepts the csv file path and calculates the mean value using numpy and pandas llibraries.

test.cls objectscript class loads the python module with the following line code:

set tt=##class(%SYS.Python).Import("sample")

then provides the path to csv file and collects the result of the function.

Here is how you can test the installed module:

USER>d ##class(dc.python.test).Today()


USER>d ##class(dc.python.test).TitanicMeanAge()

mean age=29.69911764705882


OK! Next, is how to deploy Embedded Python modules?

You can add the following line to module.xml:

<FileCopy Name="python/" Target="${mgrdir}python/"/>

the line copies all python files from the python folder of the repository to the python folder inside /mgr folder of IRIS installation.

This lets the python modules then be imported from ObjectScript via ##class(%SYS.Python).Import() method.

Also if you want the data files to be packed into the ZPM module check another FileCopy line in the module that imports the data folder from the repository along with titanic.csv into the package:

<FileCopy Name="data/" Target="${mgrdir}data/"/>

this is it!

Feel free to use the template as a foundation for your projects with Embedded Python for IRIS!

Any questions and comments are appreciated!

2 0 5 103


Hi Evgeny!

I tried embedded Python in my multi model contest app but used an ugly approach to deploy Python code. I didn't realize that ZPM could do this for me... Nice tip!

Thanks, Jose!

Yes, indeed ZPM option of delivering files to a target IRIS installation looks elegant and robust. Maybe it could be used not only for Embedded python but e.g. for jar-files delivery and data. @YURI MARX GOMES, what do you think?

A suggestion is allows ZPM to copy from a HTTP URL like a github address.