Architecture#
ArgDigest is organized around three core concepts:
Argument digestion: per-argument digesters discovered from user libraries.
Pipelines: reusable rules registered by
kindand executed in order.Context and errors: structured data and exceptions for consistent diagnostics.
Key modules:
argdigest/core/decorator.py:@arg_digestimplementation and execution flow.argdigest/core/argument_loader.py: discovery of argument digesters. Usesfunctools.lru_cacheto prevent redundant package scanning.argdigest/core/argument_registry.py: decorator-based digester registry.argdigest/core/registry.py: pipeline registry and execution.argdigest/core/context.py: call context container.argdigest/core/errors.py: error and warning classes.
Performance Strategy#
ArgDigest employs caching at two critical levels to ensure minimal runtime overhead:
Digester Discovery:
argument_loader._load_from_packageis memoized to avoid repeatedpkgutil.iter_modulescalls.Signature Inspection:
decorator.get_digester_metadatacachesinspect.signatureresults for all digesters, preventing redundant parsing of function signatures during import.