hydra_zen.is_partial_builds#

hydra_zen.is_partial_builds(x)[source]#

Returns True if the input is a targeted structured config that entails partial instantiation, either via _partial_=True [1] or via _zen_partial=True.

Parameters:
xAny
Returns:
is_partial_configbool

References

Examples

>>> from hydra_zen import is_partial_builds

An example involving a basic structured config

>>> from dataclasses import dataclass
>>> @dataclass
... class A:
...     _target_ : str = 'builtins.int'
...     _partial_ : bool = True
>>> is_partial_builds(A)
True
>>> is_partial_builds(A(_partial_=False))
False

An example of a config that leverages partial instantiation via zen-processing

>>> from hydra_zen import builds, uses_zen_processing, instantiate
>>> Conf = builds(int, 0, zen_partial=True, zen_meta=dict(a=1))
>>> hasattr(Conf, "_partial_")
False
>>> uses_zen_processing(Conf)
True
>>> is_partial_builds(Conf)
True
>>> instantiate(Conf)
functools.partial(<class 'int'>, 0)