Article
· Oct 27, 2022 2m read

Simplify Python Packages with zpip, an irispython pip wrapper

   _________ ___ ____  
  |__  /  _ \_ _|  _ \ 
    / /| |_) | || |_) |
   / /_|  __/| ||  __/ 
  /____|_|  |___|_|    

Starting in version 2021.1, InterSystems IRIS began shipping with a python runtime in the engine's kernel. However, there was no way to install packages from within the instance. The main draw of python is its enormous package ecosystem. With that in mind, I introduce my side project zpip, a pip wrapper that is callable from the iris terminal.

What is zpip?

zpip is a a wrapper for python pip that enables developers to quickly add packages to an instance through the InterSystems IRIS terminal.

Features

  • python pip wrapper for InterSystems IRIS
  • Install/Uninstall python packages
  • Installation adds zpip keyword to the language

Installing zpip

%SYS> zpm "install zpip"

TODO list

  • [ ] Callable API with statuses returned

Using zpip

All pip commands* are supported, however, any interactive command will require you to use the non-interactive version of the command. For example, to uninstall a package you'll need to use the -y in the command to confirm the process.

Install python packages with zpip

// Install multiple packages
// beautiful soup and requests libraries
%SYS> zpip "install requests bs4"

... in action:

%SYS>zpip "install emoji"

Processing /home/irisowner/.cache/pip/wheels/ae/80/43/3b56e58669d65ea9ebf38b9574074ca248143b61f45e114a6b/emoji-2.1.0-py3-none-any.whl
Installing collected packages: emoji
Successfully installed emoji-2.1.0

%SYS>

Specify a different install directory:

// Install to some other python package target
$SYS> zpip "install --target '/durable/iconfig/lib/python' emoji"

Uninstalling a python package

// Requires -y!
%SYS>zpip "uninstall -y emoji"
Found existing installation: emoji 2.1.0
Uninstalling emoji-2.1.0:
  Successfully uninstalled emoji-2.1.0

Other useful pip commands

list packages

// List Packages
%SYS> zpip "list"
Package                      Version    
---------------------------- -----------
absl-py                      1.1.0      
argon2-cffi                  21.3.0     
argon2-cffi-bindings         21.2.0     
asttokens                    2.0.5      
astunparse                   1.6.3      
attrs                        21.4.0     
backcall                     0.2.0      
beautifulsoup4               4.11.1     
bleach                       5.0.0      
bs4                          0.0.1   
...

Limitations

  • Interactive commands are unsupported
    • use -y for uninstalls
  • Search may not work depending on the system configuration
  • Uses the underlying os's pip infrastructure so your installation is dependant on the os's pip version.
Discussion (6)2
Log in or sign up to continue