Registry System
LazyRegistry
The blog of ppwwyyxx inspired LazyRegistry
. To reduce the unnecessary imports, ExCore
provides LazyRegistry
, which store the mappings of class/function name to its qualname
and dump the mappings to local. When config parsing, the necessary modules will be imported.
Rather than calling it a registry, it's more like providing a tagging feature. With the feature, ExCore
can find all class/function and statically analysis them, then dump the results in local to support some editing features to config files, see config extension.
Features
Extra information
from excore import Registry
Models = Registry("Model", extra_field="is_backbone")
@Models.register(is_backbone=True)
class ResNet:
pass