Scan a Python package and any of its subpackages. All top-level objects will be considered; those marked with venusian callback attributes related to category will be processed.
The package argument should be a reference to a Python package or module object.
The categories argument should be sequence of Venusian callback categories (each category usually a string) or the special value None which means all Venusian callback categories. The default is None.
An instance of this class is returned by the venusian.attach() function. It has the following attributes:
scope
One of exec, module, class, function call or unknown (each a string). This is the scope detected while executing the decorator which runs the attach function.
module
The module in which the decorated function was defined.
locals
A dictionary containing decorator frame’s f_locals.
globals
A dictionary containing decorator frame’s f_globals.
category
The category argument passed to attach (or None, the default).
codeinfo
A tuple in the form (filename, lineno, function, sourceline) representing the context of the venusian decorator used. Eg. ('/home/chrism/projects/venusian/tests/test_advice.py', 81, 'testCallInfo', 'add_handler(foo, bar)')
Attach a callback to the wrapped object. It will be found later during a scan. This function returns an instance of the venusian.AttachInfo class.