introduce a way to install additional python packages in UDB easily


some customers might have the need for an extra python package to be installed in UDB. At the moment this is possible but it is a lengthy and error prone procedure.

 

The suggestion is to have a way (like a package manager) that allows customers to install a new python package automatically (either from within UDB or as an external command).

 

The procedure at the moment:

 

# Path to the UDB top-level directory.
UNDO_PATH=...

# Create the directory where to put the Python packages and cd into it.
mkdir packages
cd packages/

# Install pip.
wget https://raw.githubusercontent.com/pypa/get-pip/main/public/get-pip.py
$UNDO_PATH/package-gdb/install/x64/bin/python3 ./get-pip.py install --prefix $PWD

# Make later Python invocations able to use the packages in the current directory.
export PYTHONPATH=$PWD/lib/python3.6/site-packages

# Install what you need, for instance `bson`.
# You can also use `-r requirements.txt` to install from a requirements file.
$UNDO_PATH/package-gdb/install/x64/bin/python3 -m pip install --prefix $PWD bson

# Configure UDB to load packages from the newly created directory.
echo "python sys.path.append('$PYTHONPATH')" >> ~/.udbinit

 

Be the first to reply!