scverse_misc.make_register_namespace_decorator#
- scverse_misc.make_register_namespace_decorator(cls, canonical_instance_name, decorator_name=None, docstring_style=None)#
Create a decorator for registering custom functionality with a class.
The decorator will allow your users to extend
clsobjects with custom methods and properties organized under a namespace. The namespace becomes accessible as an attribute onclsinstances, providing a clean way for users to add domain-specific functionality without modifying theclsclass itself.If the
scverse_miscSphinx extension is enabled, the returned decorator will be documented along with examples.- Parameters:
cls (
type) – The class to be made extensible.canonical_instance_name (
str) – The typical name of an instance ofcls, e.g.adataforAnnData. This is used for run-time checking of constructor signatures of the namespace classes.decorator_name (
str|None(default:None)) – Deprecated and unused.docstring_style (
str|None(default:None)) – Deprecated and unused.
See also
- Return type:
Callable[[str],Callable[[type[TypeVar(NameSpT, bound=ExtensionNamespace)]],type[TypeVar(NameSpT, bound=ExtensionNamespace)]]]