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_resultand returns only the imported module object. Usebuild_extension_module_resultwhen structured metadata (cache key, artifact path, fingerprint) is required.- Parameters:
- codestr or None
Cython source string. Exactly one of
codeorsource_pathmust be provided.- source_pathpathlib.Path or None
Path to a
.pyxfile. Exactly one ofcodeorsource_pathmust 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. Requiresannotate=True. Silently skipped in headless environments.- numpy_supportbool
If
True, attempt to add NumPy include directories.- numpy_requiredbool
If
Trueandnumpy_support=True, raiseImportErrorwhen 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/.pxiheaders).- 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:
code (str | None)
source_path (Path | None)
module_name (str | None)
use_cache (bool)
force_rebuild (bool)
verbose (int)
profile (str | None)
annotate (bool)
view_annotate (bool)
numpy_support (bool)
numpy_required (bool)
include_dirs (Sequence[PathLike[str] | PathLike[bytes] | str | bytes] | None)
extra_sources (Sequence[PathLike[str] | PathLike[bytes] | str | bytes] | None)
support_paths (Sequence[PathLike[str] | PathLike[bytes] | str | bytes] | None)
include_cwd (bool)
lock_timeout_s (float)
language (str | None)
- Return type:
See also
build_extension_module_resultSame operation returning structured metadata.