Skip to content
Marcus Ottosson edited this page Jun 22, 2019 · 31 revisions

Welcome to the Bleeding Rez Wiki!

You are welcome to edit this as you see fit; make new pages, add them to the sidebar, make it yours and help the community make Bleeding Rez great!


Table of contents


What Is Rez?

Rez is a dynamic environment management system, like Python's virtualenv except packages are shared.

Unlike many other package managers, packages are not installed into standalone environments but rather are installed into a central repository, and standalone environments reference these existing packages. This makes environments lightweight, and very fast to create, often taking just a few seconds to configure despite containing hundreds of packages.


Typical package managers install packages into an environment



Rez installs packages once, and configures environments dynamically


Rez takes a list of package requests, and constructs the target environment, resolving all the necessary package dependencies. Any type of software package is supported - compiled, python, applications and libraries.

The Basics

Packages are stored in repositories on disk. Each package has a single concise definition file (package.py) that defines its dependencies, its commands (how it configures the environment containing it), and other metadata. For example, the following is the package definition file for the popular requests python module:

name = "requests"

version = "2.8.1"

authors = ["Kenneth Reitz"]

requires = [
  "python-2.7+"
]

def commands():
  env.PYTHONPATH.append("{root}/python")

This package requires python-2.7 or greater. When used, the 'python' subdirectory within its install location is appended to the PYTHONPATH environment variable.

When an environment is created with the rez API or rez-env tool, a dependency resolution algorithm tracks package requirements and resolves to a list of needed packages. The commands from these packages are concatenated and evaluated, resulting in a configured environment. Rez is able to configure environments containing hundreds of packages, often within a few seconds. Resolves can also be saved to file, and when re-evaluated later will reconstruct the same environment once more.

Examples

This example places the user into a resolved shell containing the requested packages, using the rez-env tool:

]$ rez-env requests-2.2+ python-2.6 'pymongo-0+<2.7'

You are now in a rez-configured environment.

resolved by ajohns@nn188.somewhere.com, on Wed Feb 26 15:56:20 2014, using Rez v2.0.0

requested packages:
requests-2.2+
python-2.6
pymongo-0+<2.7

resolved packages:
python-2.6.8    /software/ext/python/2.6.8
platform-linux  /software/ext/platform/linux
requests-2.2.1  /software/ext/requests/2.2.1/python-2.6
pymongo-2.6.3   /software/ext/pymongo/2.6.3
arch-x86_64     /software/ext/arch/x86_64

> ]$ _

This example creates an environment containing the package 'houdini' version 12.5 or greater, and runs the command 'hescape -h' inside that environment:

]$ rez-env houdini-12.5+ -- hescape -h
Usage: hescape [-foreground] [-s editor] [filename ...]
-h: output this usage message
-s: specify starting desktop by name
-foreground: starts process in foreground

Resolved environments can also be created via the API:

>>> import subprocess
>>> from rez.resolved_context import ResolvedContext
>>>
>>> r = ResolvedContext(["houdini-12.5+", "houdini-0+<13", "java", "!java-1.8+"])
>>> p = r.execute_shell(command='which hescape', stdout=subprocess.PIPE)
>>> out, err = p.communicate()
>>>
>>> print out
'/software/ext/houdini/12.5.562/bin/hescape'
Clone this wiki locally