register_compiler#
- scikitplot.cython.register_compiler(compiler, *, overwrite=False)[source]#
Register a custom compiler in the module-level registry.
- Parameters:
- compilerCustomCompilerProtocol
Compiler to register. Must have a
nameattribute starting withcustom_orCustom, and be callable.- overwritebool, default=False
Whether to overwrite an existing compiler with the same name.
- Raises:
- ValueError
If the name is invalid or already taken (
overwrite=False).- TypeError
If
compilerdoes not satisfy the protocol.
- Parameters:
compiler (CustomCompilerProtocol)
overwrite (bool)
- Return type:
None
Notes
Register at module-import time in a single-threaded context. The registry is not thread-safe.
Examples
>>> class custom_fast: ... name = "custom_fast" ... ... def __call__(self, source, *, build_dir, module_name, **kw): ... raise NotImplementedError >>> register_compiler(custom_fast()) >>> "custom_fast" in list_compilers() True