rez.pip

class rez.pip.InstallMode(value, names=None, module=None, type=None)[source]

Bases: rez.vendor.enum.enum.Enum

rez.pip.find_pip(pip_version=None, python_version=None)[source]

Find pip.

Pip is searched in the following order:

  1. Search for rezified python matching python version request;

  2. If found, test if pip is present;

  3. If pip is present, use it;

  4. If not present, search for rezified pip (this is for backwards compatibility);

  5. If rezified pip is found, use it;

  6. If not, fall back to rez’s python installation.

Parameters
  • pip_version (str or Version) – Version of pip to use, or latest if None.

  • python_version (str or Version) – Python version to use, or latest if None.

Returns

  • str: Python executable.

  • ResolvedContext: Context containing pip, or None if we fell back to system pip.

Return type

2-tuple

rez.pip.find_pip_from_context(python_version, pip_version=None)[source]

Find pip from rez context.

Parameters
  • python_version (str or Version) – Python version to use

  • pip_version (str or Version) – Version of pip to use, or latest.

Returns

  • str: Python executable or None if we fell back to system pip.

  • str: Pip version or None if we fell back to system pip.

  • ResolvedContext: Context containing pip, or None if we fell back to system pip.

Return type

3-tuple

rez.pip.find_python_in_context(context)[source]

Find Python executable within the given context.

Parameters
  • context (ResolvedContext) – Resolved context with Python and pip.

  • name (str) – Name of the package for Python instead of “python”.

  • default (str) – Force a particular fallback path for Python executable.

Returns

Path to Python executable, if any.

Return type

str or None

rez.pip.pip_install_package(source_name, pip_version=None, python_version=None, mode=<InstallMode.min_deps: 1>, release=False, prefix=None, extra_args=None)[source]

Install a pip-compatible python package as a rez package. :param source_name: Name of package or archive/url containing the pip

package source. This is the same as the arg you would pass to the ‘pip install’ command.

Parameters
  • pip_version (str or Version) – Version of pip to use to perform the install, uses latest if None.

  • python_version (str or Version) – Python version to use to perform the install, and subsequently have the resulting rez package depend on.

  • mode (InstallMode) – Installation mode, determines how dependencies are managed.

  • release (bool) – If True, install as a released package; otherwise, it will be installed as a local package.

  • extra_args (List[str]) – Additional options to the pip install command.

Returns

List of Variant: Installed variants; List of Variant: Skipped variants (already installed).

Return type

2-tuple

rez.pip.run_pip_command(command_args, pip_version=None, python_version=None)[source]

Run a pip command. :param command_args: Args to pip. :type command_args: list of str

Returns

Pip process.

Return type

subprocess.Popen