CApiCompiler#

class scikitplot.cython.CApiCompiler[source]#

Built-in custom compiler for Scenario 5: NumPy C-API projects.

Wraps the Cython+setuptools pipeline with automatic NumPy include injection and support for multi-file C-API source trees.

Attributes:
namestr

Always "custom_c_api".

Notes

Master user note: register this compiler and pass your C source tree via extra_sources:

from scikitplot.cython._custom_compiler import (
    CApiCompiler,
    collect_c_api_sources,
    register_compiler,
)

register_compiler(CApiCompiler())
sources = collect_c_api_sources("src/mylib/")

Examples

>>> cc = CApiCompiler()
>>> cc.name
'custom_c_api'
>>> isinstance(cc, CustomCompilerProtocol)
True
__call__(source, *, build_dir, module_name, extra_sources=None, include_dirs=None, extra_compile_args=None, extra_link_args=None, **kwargs)[source]#

Compile a Cython+NumPy C-API extension.

Parameters:
sourcestr

Cython (.pyx) source text.

build_dirpathlib.Path

Output directory.

module_namestr

Python module name.

extra_sourcessequence of path-like or None

Additional C/C++ source files (e.g., from collect_c_api_sources).

include_dirssequence of path-like or None

Additional include directories (NumPy headers added automatically).

extra_compile_argssequence of str or None

Additional compiler flags.

extra_link_argssequence of str or None

Additional linker flags.

**kwargs

Ignored for forward compatibility.

Returns:
pathlib.Path

Path to the compiled artifact.

Raises:
ImportError

If NumPy or Cython is not installed.

RuntimeError

If compilation fails.

Parameters:
Return type:

Path

name: str = 'custom_c_api'#