PlatformCapabilities#

class scikitplot.cython.PlatformCapabilities(platform, is_browser_wasm, can_compile_at_runtime, prebuilt_only, wasm_package_suffix)[source]#

Declarative contract describing what the current platform supports.

Runtime Cython compilation requires an out-of-process C/C++ compiler. In a browser/WASM runtime (Emscripten — e.g. Pyodide / JupyterLite / xeus) there is no subprocess compiler, so on-the-fly compilation is unavailable and only prebuilt emscripten-wasm32 extensions can be imported. Exposing this as an explicit contract lets callers branch deterministically instead of discovering the limitation through an opaque build failure (CYTHON-WASM-001).

Parameters:
platformstr

The value of sys.platform.

is_browser_wasmbool

True on an Emscripten/WASM runtime (browser).

can_compile_at_runtimebool

True when an out-of-process compiler toolchain can be invoked. Always False on browser/WASM.

prebuilt_onlybool

True when only prebuilt extensions may be imported (no runtime build). The complement of can_compile_at_runtime.

wasm_package_suffixstr or None

The platform tag for prebuilt browser packages ("emscripten-wasm32") on a browser runtime, else None.

Parameters:
  • platform (str)

  • is_browser_wasm (bool)

  • can_compile_at_runtime (bool)

  • prebuilt_only (bool)

  • wasm_package_suffix (str | None)

See also

platform_capabilities

Construct the contract for the current process.

Examples

>>> caps = platform_capabilities()
>>> if not caps.can_compile_at_runtime:
...     ...  # import a prebuilt artifact instead of compiling
can_compile_at_runtime: bool[source]#

Alias for field number 2

count(value, /)#

Return number of occurrences of value.

index(value, start=0, stop=sys.maxsize, /)#

Return first index of value.

Raises ValueError if the value is not present.

is_browser_wasm: bool[source]#

Alias for field number 1

platform: str[source]#

Alias for field number 0

prebuilt_only: bool[source]#

Alias for field number 3

wasm_package_suffix: str | None[source]#

Alias for field number 4