pproperty¶

pconfigs.pproperty(_func=None, *, deps=None, manual_deps=False)[source]¶

Decorator that defines a computed property in a pconfig class.

See also

For examples, see Properties.

Unlike regular properties (which should be avoided), pproperty-based properties have the following characteristics:

  • They are evaluated at class construction time, which enables python -m pconfigs.test.

  • Their dependencies are inferred and cycles are detected at class definition time.

  • The user can provide input values to the property, which can be revised by the property.

Usage:

@pproperty or @pproperty()

Parameters:
  • manual_deps (bool, optional) – When False, property dependencies are inferred from the property’s source code. When True, only the dependencies specified in deps are used.

  • deps (Sequence[str], optional) – Explicit list of attribute names that the property depends on. This is optional and should rarely be used.

Raises:

SyntaxError – If the property function cannot be parsed.