User selectable Python interpreter#
By default repo_man will use the python interpreter that packman brings along, typically referenced via tools/packman/python.{bat,sh}
. Traditionally this has been either py37 or py310, but it cannot be easily swapped out.
Some projects need the ability to run the full tool suite through different versions of Python in order to generate version specific artifacts. In order to support this a new set of repo.toml configuration options have been provided. repo_tools.toml
includes a sample under the [repo.python_executable]
block that details the three ways that a Python executable can be passed into repo
and thereby the subtools like format or test.
Mechanically repo
during bootstrapping will fetch any Packman packages that are needed, and then use os.exec
in order to re-launch repo
using the specified interpreter.
The Thing with Windows#
Windows does not support fork + exec via os.exec
, so on Windows we subprocess into the desired Python executable. This causes some problems when debugging as we don’t map in sys.stdin into subprocess.Popen
. If you debug via pdb.set_trace
you will need to set the environment variable repo_diagnostic=1
in order to map in sys.stdin.
Host-specific executable path:#
Perhaps you always expect a version of Python to be available at a known path e.g. /opt/py310/bin/python
. You can set just python_executable_path
with that executable path.
Packman package defined in another packman.xml file#
Perhaps you want to utilize a version of Python that gets pulled in via one of your Packman dependency files.
You can instead set packman_file_path
pointing at that .xml file, set packman_package_name
with the name of your Python package, and set python_executable_path
indicating the path of the executable within that package. repo
will combine the linkPath value in your .xml file with the python_executable_path
value to yield the path to the executable.
Packman package defined in repo.toml#
Simplest you can just define packman_package_name
with the package name e.g. python
, a version via packman_package_version
e.g. "3.10.10+nv1-${platform}"
, the linkPath via packman_link_path
for where you want that package linked into your repository, and python_executable_path
indicating the path of the executable within that package.