Third party libraries with HLAs

First and foremost, thank you for all the hard work that’s being put into Logic 2. It’s become a regular part of my daily work flow.

I wanted to analyze some protobufs in my HLA, but quickly hit upon the issue that I couldn’t import the dependencies required. After going about several methods of adding the packages, I only got to where I wanted after unpacking the AppImage… I doubt that’s a recommended way of going about things.

What is the best way to add third party modules to a new HLAs? Is that just not yet supported?

Hi Scarzer,

Thank you for the kind words! We don’t currently have a supported way of installing Python dependencies. This is made harder on Linux, as you discovered, by the fact that the AppImage installs to a separate temporary directory each run.

For an easier workaround in the meantime, you can modify the sys.path in your extension file to include the directory that you installed the Python package to:

import sys
MY_ADDITIONAL_PACKAGES_PATH = '/packages/install/location'
if MY_ADDITIONAL_PACKAGES_PATH not in sys.path:
    sys.path.append(MY_ADDITIONAL_PACKAGES_PATH)

import protobuf

Note that ‘/packages/install/location’ is the directory where you installed the packages, not the path to the package itself. So in the protobuf case, it should contain a folder with the name ‘protobuf’ containing the package’s Python files.

An extension that uses the package in this way will unfortunately not work if added to the marketplace at the moment. We’ll likely support installing package dependencies at the extension level either via a standard setup.py or requirements.txt in the future.

Best,
John

An extension that uses the package in this way will unfortunately not work if added to the marketplace at the moment.

Would it work if the user happened to have the packages installed in that location though? That would provide a workaround - just add an instruction to the description/README to make sure the packages are available in that location. Or are you saying that the import would somehow be blocked if the extension were installed through the marketplace?

It should work if the user manually installs the package to that location, though coming up with an install location that will work on Windows and macOS/Linux will be challenging. Extensions installed via the marketplace are configured in the same way as local extensions at the Python level so there shouldn’t be any differences there.

Could the extension.json provide a standard mechanism to specify system path additions specific to the extension? Which would show up in the cfg dialogs?