rez.utils.schema#

Utilities for working with dict-based schemas.

rez.utils.schema.schema_keys(schema)#

Get the string values of keys in a dict-based schema.

Non-string keys are ignored.

Returns:

Set of string keys of a schema which is in the form (eg):

schema = Schema({Required("foo"): int,
                 Optional("bah"): str})

Return type:

set[str]

rez.utils.schema.dict_to_schema(schema_dict, required, allow_custom_keys=True, modifier=None)#

Convert a dict of Schemas into a Schema.

Parameters:
  • required (bool) – Whether to make schema keys optional or required.

  • allow_custom_keys (Optional[bool]) – If True, creates a schema that allows custom items in dicts.

  • modifier (Optional[Callable]) – Functor to apply to dict values - it is applied via Schema.Use.

Returns:

A Schema object.

rez.utils.schema.extensible_schema_dict(schema_dict)#

Create schema dict that allows arbitrary extra keys.

This helps to keep newer configs or package definitions compatible with older rez versions, that may not support newer schema fields.