quantlab.runs.record.code_record#

quantlab.runs.record.code_record(components)[source]#

Return the code record of a component tree.

Parameters:
componentsiterable of (str, object) pairs

Every component of the run with its component path; the root’s path is "". walk_components yields the rest of a tree.

Returns:
dict

git: {"commit", "dirty"} of the repository quantlab is imported from, or None outside one. modules: by module name, {"sha256", "framework", "components"}, the component paths whose class or a base class of it the module defines. libraries: by distribution name, the installed version, for those of _LIBRARIES that are installed.

Examples

>>> record = code_record([("", backtester), *walk_components(backtester)])
>>> sorted(record)
['git', 'libraries', 'modules']
>>> record["modules"]["tests.backtest_fixtures"]["framework"]
False
>>> record["modules"]["quantlab.factor.base"]["framework"]
True