PybindCompiler#
- class scikitplot.cython.PybindCompiler[source]#
Built-in custom compiler for Scenario 4: pybind11-only projects.
This compiler wraps the standard Cython+setuptools pipeline but automatically injects the pybind11 include directory and sets
language="c++".- Attributes:
- namestr
Always
"custom_pybind11".
Notes
Master user note: register and use this compiler when building pybind11 extension modules without Cython
.pyxfiles. You write standard C++ with pybind11 macros; this compiler handles the rest:from scikitplot.cython._custom_compiler import PybindCompiler, register_compiler register_compiler(PybindCompiler())
The compiler requires
pybind11to be importable. Check withpybind11_only_prereqs.Examples
>>> pc = PybindCompiler() >>> pc.name 'custom_pybind11' >>> isinstance(pc, CustomCompilerProtocol) True
- __call__(source, *, build_dir, module_name, include_dirs=None, extra_compile_args=None, extra_link_args=None, **kwargs)[source]#
Compile a pybind11 C++ extension from source text.
- Parameters:
- sourcestr
C++ source code with pybind11 bindings.
- build_dirpathlib.Path
Output directory.
- module_namestr
Python module name for the compiled extension.
- include_dirssequence of path-like or None
Additional include directories (pybind11 headers added automatically).
- extra_compile_argssequence of str or None
Additional C++ compiler flags (
-std=c++17added by default).- extra_link_argssequence of str or None
Additional linker flags.
- **kwargs
Ignored extra arguments for forward compatibility.
- Returns:
- pathlib.Path
Path to the compiled
.so/.pydartifact.
- Raises:
- ImportError
If pybind11 is not installed.
- RuntimeError
If compilation fails.
- Parameters:
- Return type: