nirs4all.pipeline.dagml.native_client module

Thin native training/replay client for the DAG-ML Python facade.

This module is the nirs4all-side seam for roadmap W2-PY. It deliberately does not compile nirs4all pipelines, run Python fallback logic, or reimplement any DAG-ML contract validation. Its only responsibility is to load the installed dag_ml facade, check that the required native entry points exist, and call them with the already-built JSON/control-plane objects. Contract proofs such as DAG-ML D10 cache_namespace_fingerprints are forwarded as part of those objects; nirs4all does not recalculate, normalize or filter them.

class nirs4all.pipeline.dagml.native_client.DagMLNativeCapabilities(package_version: str | None, contract_manifest: dict[str, Any] | None, training: bool, loaded_predictor_replay: bool)[source]

Bases: object

Installed DAG-ML native capabilities visible from nirs4all.

contract_manifest: dict[str, Any] | None
loaded_predictor_replay: bool
package_version: str | None
training: bool
class nirs4all.pipeline.dagml.native_client.DagMLNativeClient(module_name: str = 'dag_ml')[source]

Bases: object

Minimal adapter around the installed dag_ml Python facade.

The constructor is side-effect free. Importing dag_ml is deferred until capabilities() or a native call is made, so importing nirs4all itself does not require the DAG-ML wheel to be importable.

capabilities() → DagMLNativeCapabilities[source]

Return the installed native training/replay capability snapshot.

execute_methods_cv_refit_terminal_predict(request: Any, data_envelopes: Any, relations: Any, training_influence: Any, methods_inputs: Any, predict_envelope: Any, predict_input: Any, *, methods_library_path: str, outcome_id: str, run_id: str, bundle_id: str, package_id: str, terminal_node_id: str, terminal_port: str, warnings: Any = (), diagnostics: Any = None) → Any[source]

Execute the closed callback-free Methods CV→REFIT→PREDICT facade.

This must stay separate from execute_methods_training: the latter produces only an attached training result, whereas this entry point atomically validates the terminal V2 cohort, hydrates the refit artifact and returns the native frozen result/receipt pair.

execute_methods_portable_full_refit(source_package: Any, target_request: Any, data_envelopes: Any, relations: Any, training_influence: Any, methods_inputs: Any, *, methods_library_path: str, recipe_id: str, package_id: str, outcome_id: str, run_id: str, bundle_id: str) → Any[source]

Execute one fresh Methods REFIT and return its V3 child.

execute_methods_training(request: Any, data_envelopes: Any, relations: Any, training_influence: Any, methods_inputs: Any, *, methods_library_path: str, outcome_id: str, run_id: str, bundle_id: str, warnings: Any = (), diagnostics: Any = None) → Any[source]

Execute the no-callback portable Methods PLS lane.

This intentionally has a distinct facade method: routing a Methods model through execute_training would install a Python callback and silently turn a supposedly portable model into a host sidecar.

execute_training(request: Any, data_envelopes: Any, relations: Any, training_influence: Any, op_callback: Any, *, outcome_id: str, run_id: str, bundle_id: str, warnings: Any = (), diagnostics: Any = None) → Any[source]

Execute native DAG-ML training through the installed facade.

DAG-ML owns validation of any cache namespace proofs embedded in the request, bundle or payload objects. This seam forwards them unchanged.

property module_name: str

The explicit DAG-ML Python module selected for this client.

replay_loaded_methods_portable_refit_package_v3(package: Any, request: Any, data_envelopes: Any, methods_inputs: Any, *, methods_library_path: str, outcome_id: str, run_id: str, warnings: Any = (), diagnostics: Any = None) → Any[source]

Replay one detached Package V3 child without a sidecar callback.

replay_loaded_methods_predictor_package(package: Any, request: Any, data_envelopes: Any, methods_inputs: Any, *, methods_library_path: str, outcome_id: str, run_id: str, warnings: Any = (), diagnostics: Any = None) → Any[source]

Replay a native Methods package without callback or sidecar adapters.

replay_loaded_predictor_package(package: Any, request: Any, data_envelopes: Any, artifact_handles: Any, op_callback: Any, *, outcome_id: str, run_id: str, artifact_callback: Any = None, warnings: Any = (), diagnostics: Any = None) → Any[source]

Replay a loaded portable predictor package through the installed facade.

request is intentionally forwarded unchanged: DAG-ML owns the canonical validation of phase and currently accepts native package replay for PREDICT and EXPLAIN. The same boundary applies to D10 cache namespace proofs embedded in replay payloads or requests.

select_portable_output(package: Any, binding_id: str) → dict[str, Any][source]

Resolve one explicit output through DAG-ML’s validated package contract.

Typed PortablePredictorPackage instances own the most direct select_output operation. JSON-like packages use the equivalent facade function. Both paths retain the complete package for later all-output replay; this method returns only the native selection view.

exception nirs4all.pipeline.dagml.native_client.DagMLNativeCoverageError[source]

Bases: DagMlUnsupported

The installed DAG-ML facade lacks a native capability required by nirs4all.

This is a coverage error, not an availability error: dag_ml may import successfully while still being too old to expose the training/replay contracts needed by the W2 native path. Keeping this type catchable through DagMlUnsupported preserves the current fail-loud fallback boundary until P7 removes fallback for covered shapes.

nirs4all.pipeline.dagml.native_client.native_client() → DagMLNativeClient[source]

Create the default native DAG-ML client.