Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
rez 3.3.0 documentation
Light Logo Dark Logo

General

  • Installation
  • Getting started
  • Basic concepts
  • Building packages
  • Releasing packages
  • Context
  • Variants
  • User guides
    • Update to rez 3.0.0
    • Developing your own plugin

Advanced

  • Ephemerals
  • Context bundles
  • Suites
  • Managing packages
  • Caching
  • Pip
  • Plugins
  • Package Orderers

Package definition

  • Package definition
  • Package commands

Reference

  • Configuring rez
  • Commands
    • rez
    • rez-benchmark
    • rez-bind
    • rez-build
    • rez-bundle
    • rez-config
    • rez-context
    • rez-cp
    • rez-depends
    • rez-diff
    • rez-env
    • rez-gui
    • rez-help
    • rez-interpret
    • rez-memcache
    • rez-mv
    • rez-pip
    • rez-pkg-cache
    • rez-pkg-ignore
    • rez-plugins
    • rez-python
    • rez-release
    • rez-rm
    • rez-search
    • rez-selftest
    • rez-status
    • rez-suite
    • rez-test
    • rez-view
    • rez-yaml2py
  • Environment variables
  • Python API
    • rez.build_process
    • rez.build_system
    • rez.bundle_context
    • rez.command
    • rez.config
    • rez.developer_package
    • rez.exceptions
    • rez.package_cache
    • rez.package_copy
    • rez.package_filter
    • rez.package_help
    • rez.package_maker
    • rez.package_move
    • rez.package_order
    • rez.package_py_utils
    • rez.package_remove
    • rez.package_repository
    • rez.package_resources
    • rez.package_search
    • rez.package_serialise
    • rez.package_test
    • rez.packages
    • rez.plugin_managers
    • rez.release_hook
    • rez.release_vcs
    • rez.resolved_context
    • rez.resolver
    • rez.rex_bindings
    • rez.rex
    • rez.serialise
    • rez.shells
    • rez.solver
    • rez.status
    • rez.suite
    • rez.system
    • rez.util
    • rez.utils
      • rez.utils.amqp
      • rez.utils.backcompat
      • rez.utils.base26
      • rez.utils.colorize
      • rez.utils.data_utils
      • rez.utils.diff_packages
      • rez.utils.elf
      • rez.utils.execution
      • rez.utils.filesystem
      • rez.utils.formatting
      • rez.utils.graph_utils
      • rez.utils.installer
      • rez.utils.logging
      • rez.utils.memcached
      • rez.utils.patching
      • rez.utils.pip
      • rez.utils.platform
      • rez.utils.platform_mapped
      • rez.utils.py_dist
      • rez.utils.resolve_graph
      • rez.utils.resources
      • rez.utils.schema
      • rez.utils.scope
      • rez.utils.sourcecode
      • rez.utils.which
      • rez.utils.yaml
    • rez.version
    • rez.wrapper
  • Changelog
Back to top
View this page

rez.package_search¶

Default algorithms for searching for packages based on some criteria. Package repository plugins may implement these algorithms instead, because they may be able to search packages much faster - for example, in a database-based package repository. The algorithms here serve as backup for those package repositories that do not provide an implementation.

rez.package_search.get_reverse_dependency_tree(package_name, depth=None, paths=None, build_requires=False, private_build_requires=False)¶

Find packages that depend on the given package.

This is a reverse dependency lookup. A tree is constructed, showing what packages depend on the given package, with an optional depth limit. A resolve does not occur. Only the latest version of each package is used, and requirements from all variants of that package are used.

Parameters:
  • package_name (str) – Name of the package depended on.

  • depth (int) – Tree depth limit, unlimited if None.

  • paths (list of str) – paths to search for packages, defaults to config.packages_path.

  • build_requires (bool) – If True, includes packages’ build_requires.

  • private_build_requires (bool) – If True, include package_name’s private_build_requires.

Returns:

A 2-tuple:

  • (list of list of str): Lists of package names, where each list is a single depth in the tree. The first list is always [package_name].

  • pygraph.digraph object, where nodes are package names, and package_name is always the leaf node.

Return type:

tuple

rez.package_search.get_plugins(package_name, paths=None)¶

Find packages that are plugins of the given package.

Parameters:
  • package_name (str) – Name of the package.

  • paths (list of str) – Paths to search for packages, defaults to config.packages_path.

Returns:

The packages that are plugins of the given package.

Return type:

list of str

class rez.package_search.ResourceSearchResult¶

Bases: object

Items from a search.

Will contain either a package, variant, or name of a package family (str).

__init__(resource, resource_type, validation_error=None)¶
class rez.package_search.ResourceSearcher¶

Bases: object

Search for resources (packages, variants or package families).

__init__(package_paths=None, resource_type=None, no_local=False, latest=False, after_time=None, before_time=None, validate=False)¶

Create resource search.

Parameters:
  • package_paths (list of str) – Package search path

  • resource_type (str) – type of resource to search for. One of “family”, “package” or “variant”. If None, is determined based on format of resources_request.

  • no_local (bool) – Do not look in local paths

  • latest (bool) – Only return latest version if resource type is package or variant

  • after_time (int) – Only show packages released after the given epoch time

  • before_time (int) – Only show packages released before the given epoch time

  • validate (bool) – Validate each resource that is found. If False, results are not validated (ie, validation_error is None).

Returns:

List of ResourceSearchResult objects

iter_resources(resources_request=None)¶

Iterate over matching resources.

Parameters:

resources_request (str) – Resource to search, glob-style patterns are supported. If None, returns all matching resource types.

Returns:

2-tuple:

  • str: resource type (family, package, variant);

  • Iterator of ResourceSearchResult: Matching resources. Will be in alphabetical order if families, and version ascending for packages or variants.

Return type:

tuple

search(resources_request=None)¶

Search for resources.

Parameters:

resources_request (str) – Resource to search, glob-style patterns are supported. If None, returns all matching resource types.

Returns:

2-tuple:

  • str: resource type (family, package, variant);

  • List of ResourceSearchResult: Matching resources. Will be in alphabetical order if families, and version ascending for packages or variants.

Return type:

tuple

class rez.package_search.ResourceSearchResultFormatter¶

Bases: object

Formats search results.

fields = ('pre_commands', 'tools', 'uuid', 'build_requires', 'version', 'timestamp', 'release_message', 'private_build_requires', 'revision', 'description', 'base', 'authors', 'variants', 'commands', 'name', 'changelog', 'post_commands', 'requires', 'root', 'index', 'uri', 'num_variants', 'qualified_name')¶
__init__(output_format=None, suppress_newlines=False)¶
Parameters:
  • output_format (str) – String that can contain keywords such as “{base}”. These (or their appreviations) will be expanded into the matching resource attribute, or left unexpanded if the attribute does not exist. The ‘n’ literal will be converted into newlines. Defaults to qualified name.

  • suppress_newlines (bool) – If True, replace newlines with ‘n’.

print_search_results(search_results, buf=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)¶

Print formatted search results.

Parameters:

search_results (list of ResourceSearchResult) – Search to format.

format_search_results(search_results)¶

Format search results.

Parameters:

search_results (list of ResourceSearchResult) – Search to format.

Returns:

List of 2-tuple: Text and color to print in.

Return type:

tuple

Next
rez.package_serialise
Previous
rez.package_resources
Copyright © Contributors to the rez project
Made with Sphinx and @pradyunsg's Furo
On this page
  • rez.package_search
    • get_reverse_dependency_tree()
    • get_plugins()
    • ResourceSearchResult
      • ResourceSearchResult.__init__()
    • ResourceSearcher
      • ResourceSearcher.__init__()
      • ResourceSearcher.iter_resources()
      • ResourceSearcher.search()
    • ResourceSearchResultFormatter
      • ResourceSearchResultFormatter.fields
      • ResourceSearchResultFormatter.__init__()
      • ResourceSearchResultFormatter.print_search_results()
      • ResourceSearchResultFormatter.format_search_results()