rez.packages#
- class rez.packages.PackageRepositoryResourceWrapper#
- property repository#
The package repository this resource comes from.
- Returns:
PackageRepository.
- class rez.packages.PackageFamily#
A package family.
Note
Do not instantiate this class directly, instead use the function iter_package_families.
- __init__(resource)#
- iter_packages()#
Iterate over the packages within this family, in no particular order.
- Returns:
Package iterator.
- class rez.packages.PackageBaseResourceWrapper#
Abstract base class for Package and Variant.
- __init__(resource, context=None)#
- property config#
Returns the config for this package.
Defaults to global config if this package did not provide a ‘config’ section.
- is_local()#
Returns True if the package is in the local package repository
- print_info(buf=None, format_=<FileFormat.yaml: ('yaml', )>, skip_attributes=None, include_release=False)#
Print the contents of the package.
- class rez.packages.Package#
A package.
Warning
Do not instantiate this class directly, instead use the function
iter_packages()
orPackageFamily.iter_packages()
.- is_package = True#
Allows for a simple check like
this.is_package
in late-bound funcs, wherethis
may be a package or variant.
- is_variant = False#
Allows for a simple check like
this.is_variant
in late-bound funcs, wherethis
may be a package or variant.
- __init__(resource, context=None)#
- arbitrary_keys()#
Get the arbitrary keys present in this package.
These are any keys not in the standard list (‘name’, ‘version’ etc).
- qualified_name()#
Get the qualified name of the package.
- Returns:
Name of the package with version, eg “maya-2016.1”.
- Return type:
- as_exact_requirement()#
Get the package, as an exact requirement string.
- Returns:
Equivalent requirement string, eg “maya==2016.1”
- parent()#
Get the parent package family.
- Returns:
PackageFamily.
- property is_relocatable#
True if the package and its payload is safe to copy.
- property is_cachable#
True if the package and its payload is safe to cache locally.
- iter_variants()#
Iterate over the variants within this package, in index order.
- Returns:
Variant iterator.
- get_variant(index=None)#
Get the variant with the associated index.
- Returns:
Variant object, or None if no variant with the given index exists.
- class rez.packages.Variant#
A package variant.
Warning
Do not instantiate this class directly, instead use the function
Package.iter_variants()
.- is_package = False#
See
Package.is_package
.
- is_variant = True#
See
Package.is_variant
.
- __init__(resource, context=None, parent=None)#
- qualified_name()#
Get the qualified name of the variant.
- Returns:
Name of the variant with version and index, eg “maya-2016.1[1]”.
- Return type:
- parent()#
Get the parent package.
- Returns:
Package.
- property variant_requires#
Get the subset of requirements specific to this variant.
- Returns:
List of Requirement objects.
- property requires#
Get variant requirements.
This is a concatenation of the package requirements and those of this specific variant.
- Returns:
List of Requirement objects.
- get_requires(build_requires=False, private_build_requires=False)#
Get the requirements of the variant.
- install(path, dry_run=False, overrides=None)#
Install this variant into another package repository.
If the package already exists, this variant will be correctly merged into the package. If the variant already exists in this package, the existing variant is returned.
- Parameters:
path (str) – Path to destination package repository.
dry_run (bool) – If True, do not actually install the variant. In this mode, a Variant instance is only returned if the equivalent variant already exists in this repository; otherwise, None is returned.
overrides (dict) – Use this to change or add attributes to the installed variant.
- Returns:
Variant object - the (existing or newly created) variant in the specified repository. If dry_run is True, None may be returned.
- class rez.packages.PackageSearchPath#
A list of package repositories.
For example, $REZ_PACKAGES_PATH refers to a list of repositories.
- __init__(packages_path)#
Create a package repository list.
- iter_packages(name, range_=None)#
See iter_packages.
- Returns:
Package iterator.
- rez.packages.iter_package_families(paths=None)#
Iterate over package families, in no particular order.
Note that multiple package families with the same name can be returned. Unlike packages, families later in the searchpath are not hidden by earlier families.
- rez.packages.iter_packages(name, range_=None, paths=None)#
Iterate over Package instances, in no particular order.
Packages of the same name and version earlier in the search path take precedence - equivalent packages later in the paths are ignored. Packages are not returned in any specific order.
- Parameters:
name (str) – Name of the package, eg ‘maya’.
range (VersionRange or str) – If provided, limits the versions returned to those in range_.
paths (list of str, optional) – paths to search for packages, defaults to config.packages_path.
- Returns:
Package iterator.
- rez.packages.get_package(name, version, paths=None)#
Get a package by searching a list of repositories.
- rez.packages.get_package_family_from_repository(name, path)#
Get a package family from a repository.
- Parameters:
name (str) – Name of the package, eg ‘maya’.
- Returns:
PackageFamily object, or None if the family was not found.
- rez.packages.get_package_from_repository(name, version, path)#
Get a package from a repository.
- rez.packages.get_package_from_handle(package_handle)#
Create a package given its handle (or serialized dict equivalent)
- Parameters:
package_handle (ResourceHandle or dict) – Resource handle, or equivalent serialized dict representation from ResourceHandle.to_dict
- Returns:
Package.
- rez.packages.get_package_from_string(txt, paths=None)#
Get a package given a string.
- rez.packages.get_developer_package(path, format=None)#
Create a developer package.
- rez.packages.create_package(name, data, package_cls=None)#
Create a package given package data.
- rez.packages.get_variant(variant_handle, context=None)#
Create a variant given its handle (or serialized dict equivalent)
- Parameters:
variant_handle (ResourceHandle or dict) – Resource handle, or equivalent serialized dict representation from ResourceHandle.to_dict
context (ResolvedContext) – The context this variant is associated with, if any.
- Returns:
Variant.
- rez.packages.get_package_from_uri(uri, paths=None)#
Get a package given its URI.
- rez.packages.get_variant_from_uri(uri, paths=None)#
Get a variant given its URI.
- rez.packages.get_last_release_time(name, paths=None)#
Returns the most recent time this package was released.
Note that releasing a variant into an already-released package is also considered a package release.
- rez.packages.get_completions(prefix, paths=None, family_only=False)#
Get autocompletion options given a prefix string.
Example
>>> get_completions("may") set(["maya", "maya_utils"]) >>> get_completions("maya-") set(["maya-2013.1", "maya-2015.0.sp1"])
- rez.packages.get_latest_package(name, range_=None, paths=None, error=False)#
Get the latest package for a given package name.
- Parameters:
- Returns:
Package object, or None if no package is found.
- rez.packages.get_latest_package_from_string(txt, paths=None, error=False)#
Get the latest package found within the given request string.