Mayapy Launcher is a launcher similar to the Py Launcher on windows but for mayapy.
It lets you easily launch any version of mayapy without having any of them in your PATH.
⚠️ mayapy-launcher is a Windows only tool at this point as it uses the registry to find the maya install location.
pipx install mayapy-launcher
pip install mayapy-launcher
Simply run mayapy in your terminal.
mayapy
When called without a specific version number the version is resolved in this order:
-
If a virtualenv is currently active, the Launcher will check the
python --version
and use the most mayapy relevant interpreter 1. -
The Launcher will look for a
.maya-version
file in all parent directories and use the first version it specifies# .maya-version 2023
-
The Launcher will look for a
.python-version
file in all parent directories and match the first python version with the most relevant mayapy version1.# .python-version 3.9.7
-
latest installed version will automatically be used.
You can run any version of mayapy by passing the version as the first parameter
mayapy -2023
All parameters that don't match a version number are passed directly to the interpreter that gets spawned.
mayapy -2023 my_file.py
Footnotes
-
The most relevant mayapy interpreter is resolved with a few rules:
- It must share the same Major version as the python version. This means no Python 3 interpreter can be used to run python 2 code et vice et versa.
- If specified, the minor version must match the python version as well.
- Since we don't have a release for every python version, the closest patch version will be used.