rez.package_order

class rez.package_order.NullPackageOrder[source]

Bases: rez.package_order.PackageOrder

An orderer that does not change the order - a no op.

This orderer is useful in cases where you want to apply some default orderer to a set of packages, but may want to explicitly NOT reorder a particular package. You would use a NullPackageOrder in a PerFamilyOrder to do this.

classmethod from_pod(data)[source]
name = 'no_order'
reorder(iterable, key=None)[source]

Put packages into some order for consumption.

You can safely assume that the packages referred to by iterable are all versions of the same package family.

Note

Returning None, and an unchanged iterable list, are not the same thing. Returning None may cause rez to pass the package list to the next orderer; whereas a package list that has been reordered (even if the unchanged list is returned) is not passed onto another orderer.

Parameters
  • iterable – Iterable list of packages, or objects that contain packages.

  • key (callable) – Callable, where key(iterable) gives a Package. If None, iterable is assumed to be a list of Package objects.

Returns

List of iterable type, reordered.

to_pod()[source]

Example (in yaml):

type: no_order

class rez.package_order.PackageOrder[source]

Bases: object

Package reorderer base class.

name = None
reorder(iterable, key=None)[source]

Put packages into some order for consumption.

You can safely assume that the packages referred to by iterable are all versions of the same package family.

Note

Returning None, and an unchanged iterable list, are not the same thing. Returning None may cause rez to pass the package list to the next orderer; whereas a package list that has been reordered (even if the unchanged list is returned) is not passed onto another orderer.

Parameters
  • iterable – Iterable list of packages, or objects that contain packages.

  • key (callable) – Callable, where key(iterable) gives a Package. If None, iterable is assumed to be a list of Package objects.

Returns

List of iterable type, reordered.

property sha1
to_pod()[source]
class rez.package_order.PackageOrderList(iterable=(), /)[source]

Bases: list

A list of package orderer.

classmethod from_pod(data)[source]
singleton = [][source]
to_pod()[source]
class rez.package_order.PerFamilyOrder(order_dict, default_order=None)[source]

Bases: rez.package_order.PackageOrder

An orderer that applies different orderers to different package families.

classmethod from_pod(data)[source]
name = 'per_family'
reorder(iterable, key=None)[source]

Put packages into some order for consumption.

You can safely assume that the packages referred to by iterable are all versions of the same package family.

Note

Returning None, and an unchanged iterable list, are not the same thing. Returning None may cause rez to pass the package list to the next orderer; whereas a package list that has been reordered (even if the unchanged list is returned) is not passed onto another orderer.

Parameters
  • iterable – Iterable list of packages, or objects that contain packages.

  • key (callable) – Callable, where key(iterable) gives a Package. If None, iterable is assumed to be a list of Package objects.

Returns

List of iterable type, reordered.

to_pod()[source]

Example (in yaml):

type: per_family orderers: - packages: [‘foo’, ‘bah’]

type: version_split first_version: ‘4.0.5’

  • packages: [‘python’] type: sorted descending: false

default_order:

type: sorted descending: true

class rez.package_order.SortedOrder(descending)[source]

Bases: rez.package_order.PackageOrder

An orderer that sorts wrt version.

classmethod from_pod(data)[source]
name = 'sorted'
reorder(iterable, key=None)[source]

Put packages into some order for consumption.

You can safely assume that the packages referred to by iterable are all versions of the same package family.

Note

Returning None, and an unchanged iterable list, are not the same thing. Returning None may cause rez to pass the package list to the next orderer; whereas a package list that has been reordered (even if the unchanged list is returned) is not passed onto another orderer.

Parameters
  • iterable – Iterable list of packages, or objects that contain packages.

  • key (callable) – Callable, where key(iterable) gives a Package. If None, iterable is assumed to be a list of Package objects.

Returns

List of iterable type, reordered.

to_pod()[source]

Example (in yaml):

type: sorted descending: true

class rez.package_order.TimestampPackageOrder(timestamp, rank=0)[source]

Bases: rez.package_order.PackageOrder

A timestamp order function.

Given a time T, this orderer returns packages released before T, in descending order, followed by those released after. If rank is non-zero, version changes at that rank and above are allowed over the timestamp.

For example, consider the common case where we want to prioritize packages released before T, except for newer patches. Consider the following package versions, and time T:

2.2.1 2.2.0 2.1.1 2.1.0 2.0.6 2.0.5

<– T

2.0.0 1.9.0

A timestamp orderer set to rank=3 (patch versions) will attempt to consume the packages in the following order:

2.0.6 2.0.5 2.0.0 1.9.0 2.1.1 2.1.0 2.2.1 2.2.0

Notice that packages before T are preferred, followed by newer versions. Newer versions are consumed in ascending order, except within rank (this is why 2.1.1 is consumed before 2.1.0).

classmethod from_pod(data)[source]
name = 'soft_timestamp'
reorder(iterable, key=None)[source]

Put packages into some order for consumption.

You can safely assume that the packages referred to by iterable are all versions of the same package family.

Note

Returning None, and an unchanged iterable list, are not the same thing. Returning None may cause rez to pass the package list to the next orderer; whereas a package list that has been reordered (even if the unchanged list is returned) is not passed onto another orderer.

Parameters
  • iterable – Iterable list of packages, or objects that contain packages.

  • key (callable) – Callable, where key(iterable) gives a Package. If None, iterable is assumed to be a list of Package objects.

Returns

List of iterable type, reordered.

to_pod()[source]

Example (in yaml):

type: soft_timestamp timestamp: 1234567 rank: 3

class rez.package_order.VersionSplitPackageOrder(first_version)[source]

Bases: rez.package_order.PackageOrder

Orders package versions <= a given version first.

For example, given the versions [5, 4, 3, 2, 1], an orderer initialized with version=3 would give the order [3, 2, 1, 5, 4].

classmethod from_pod(data)[source]
name = 'version_split'
reorder(iterable, key=None)[source]

Put packages into some order for consumption.

You can safely assume that the packages referred to by iterable are all versions of the same package family.

Note

Returning None, and an unchanged iterable list, are not the same thing. Returning None may cause rez to pass the package list to the next orderer; whereas a package list that has been reordered (even if the unchanged list is returned) is not passed onto another orderer.

Parameters
  • iterable – Iterable list of packages, or objects that contain packages.

  • key (callable) – Callable, where key(iterable) gives a Package. If None, iterable is assumed to be a list of Package objects.

Returns

List of iterable type, reordered.

to_pod()[source]

Example (in yaml):

type: version_split first_version: “3.0.0”

rez.package_order.from_pod(data)[source]
rez.package_order.register_orderer(cls)[source]
rez.package_order.to_pod(orderer)[source]