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 name attribute starting with custom_ or Custom, 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 compiler does not satisfy the protocol.

Parameters:
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