build_extension_module#

scikitplot.cython.build_extension_module(*, code, source_path, module_name, cache_dir, use_cache, force_rebuild, verbose, profile=None, annotate, view_annotate, numpy_support, numpy_required, include_dirs, library_dirs, libraries, define_macros, extra_compile_args, extra_link_args, compiler_directives, extra_sources=None, support_files=None, support_paths=None, include_cwd=True, lock_timeout_s=60.0, language=None)[source]#

Compile and import an extension module (module-only convenience wrapper).

This is the internal implementation used by the public API. It delegates entirely to build_extension_module_result and returns only the imported module object. Use build_extension_module_result when structured metadata (cache key, artifact path, fingerprint) is required.

Parameters:
codestr or None

Cython source string. Exactly one of code or source_path must be provided.

source_pathpathlib.Path or None

Path to a .pyx file. Exactly one of code or source_path must be provided.

module_namestr or None

Optional explicit module name. Derived from the cache key if None.

cache_dirstr or pathlib.Path or None

Root cache directory for build artifacts.

use_cachebool

If True, reuse an existing cached artifact when the cache key matches.

force_rebuildbool

If True, rebuild even when a valid cached artifact exists.

verboseint

Build verbosity. Negative values suppress most output.

profilestr or None

Optional build profile ("fast-debug", "release", "annotate").

annotatebool

If True, generate a Cython HTML annotation file.

view_annotatebool

If True, open the annotation HTML in a browser after compilation. Requires annotate=True. Silently skipped in headless environments.

numpy_supportbool

If True, attempt to add NumPy include directories.

numpy_requiredbool

If True and numpy_support=True, raise ImportError when NumPy is not installed.

include_dirssequence of path-like or None

Additional C/C++ include directories.

library_dirssequence of path-like or None

Additional linker search directories.

librariessequence of str or None

Libraries to link against.

define_macrossequence of (str, str | None) or None

Preprocessor macros to define.

extra_compile_argssequence of str or None

Extra flags passed to the C/C++ compiler.

extra_link_argssequence of str or None

Extra flags passed to the linker.

compiler_directivesMapping[str, Any] or None

Cython compiler directives merged over the baseline defaults.

extra_sourcessequence of path-like or None, default=None

Additional C/C++ source files to compile and link.

support_filesMapping[str, str | bytes] or None, default=None

In-memory support files written into the build directory before compilation (e.g., .pxd / .pxi headers).

support_pathssequence of path-like or None, default=None

On-disk support files copied into the build directory before compilation.

include_cwdbool, default=True

If True, add the current working directory to include paths.

lock_timeout_sfloat, default=60.0

Maximum seconds to wait for the per-key build lock.

language{{‘c’, ‘c++’}} or None, default=None

Optional language override for the extension.

Returns:
types.ModuleType

The imported extension module.

Parameters:
Return type:

ModuleType

See also

build_extension_module_result

Same operation returning structured metadata.