Python subprocess package executable

Paths to executables for Python subprocess should be handled robustly to avoid unexpected errors on end user systems that may not occur on the developer’s laptop or CI system.

NOTE: relative paths (names with slashes and/or “..”) are not allowed. That means “build-on-run” or “build-at-setup/install” executables must live at the same directory level as the resource specified.

Example: with black-box executable “amender.bin” that has been already built and exists in the package directory.


Alternatives have downsides for this application including:

setuptools.pkg_resources is not always installed on user systems.

__file__ is not always defined.

Consider performant Python stdlib importlib.resources for general package reference to package files. For PyTest test files, consider conftest.py to generate test files.