Select scientific providers
The Apizr 0.4.6 engine exposes explicit scientific-provider selection.
The default is apizr.builtin version 1, shipped in the core wheel. Providers
recognize static input reads, metric calls, output candidates and randomness
controls. Recognition does not prove runtime values or reproducibility.
Built-in recognition
| Evidence | Recognized source forms |
|---|---|
| Input reads | Literal first positional paths in pandas.read_csv, pandas.read_parquet, numpy.load and joblib.load. Remote references retain unknown content. |
| Metric signals | Calls to sklearn.metrics.accuracy_score, precision_score, recall_score, f1_score, roc_auc_score and mean_squared_error. Static inspection never evaluates their values. |
| Output candidates | joblib.dump with a literal filename and supported arguments. Discovery never opens or deserializes the output. |
| Randomness controls | Literal arguments to random.seed, numpy.random.seed, numpy.random.default_rng, torch.manual_seed, tensorflow.random.set_seed, and supported sklearn random_state keywords. Dynamic or conflicting values stay unknown; accelerator determinism stays unknown. |
Explicit import bindings and aliases are checked conservatively; shadowing and
unsupported scopes do not grant callable authority. These are the version 1
source rules, not certification of every scientific-library version. Libraries
remain workload dependencies and are never imported by recognition. Selected
runtime package versions are separate Run observations.
The alternative example is a separate wheel with its own pyproject.toml, Python
module and apizr-extension.json manifest. Its module implements
scientific.describe and scientific.recognize; the core uses the existing
extension installer and protocol. The wheel identity apizr-literal-accuracy
version 0.0.0 is separate from its producer identity example.literal-accuracy
version 1. See the package example
and installation workflow. No core modification or automatic
entrypoint discovery is needed.
List and select providers
apizr providers list
apizr providers list --format json
apizr experiment inspect model.py --providers providers.json --format json
apizr experiment run model.py --providers providers.json
providers.json uses the selection schema.
For example, select an already installed, explicitly activated extension for
metrics and retain built-in recognition for the other capabilities:
{
"schema_version": "apizr.provider-selection/v1",
"providers": [
{
"identity": {"name": "example.literal-accuracy", "version": "1"},
"capabilities": ["metric_signals"],
"enabled": true,
"extension": "apizr-literal-accuracy"
},
{"identity": {"name": "apizr.builtin", "version": "1"}}
]
}
The first entry claiming a capability owns it, including when disabled or
unavailable. Later entries own only remaining capabilities. There is no fallback
after failure. Set enabled to false to disable an entry; use "providers": []
to disable all automatic scientific recognition. Explicit declarations and
runtime SDK logging retain their own contracts.
providers list --selection providers.json --directory STORE lists the selected
inventory with exact identities, descriptors, capabilities, limits, active entries
and ownership. This is an explicit inventory, not discovery of every installed
package. Disabled or fully shadowed extensions are never invoked, so their
descriptor is unknown. The built-in descriptor is always known. JSON output
follows the provider report schema.
Use --provider-directory STORE with experiment inspect or experiment run
when the selected extension lives in a nondefault extension store. Selection
never installs, activates or imports arbitrary packages. Describing or recognizing
with a selected external provider executes trusted installed extension code
through the existing extension protocol. Process limits
are 10 seconds, a 4 MiB request and 1 MiB stdout; descriptor JSON is limited to
64 KiB. The selection file is limited to 64 KiB, 16 entries and bounded JSON depth.
Provider-declared source, AST and result limits can only lower core ceilings.
Python API
from apizr.scientific_providers.contracts.selection import ProviderSelection
from apizr.scientific_providers.selection import list_providers
from apizr.experiments.inspection import inspect_experiment
selection = ProviderSelection() # Explicit built-in selection.
inventory = list_providers(selection)
inspection = inspect_experiment("model.py", providers=selection)
print(inventory.model_dump_json())
For a trusted in-process implementation, supply an explicit
provider_implementations={"name": instance} mapping to inspect_experiment or
run_experiment, or implementations to list_providers. Its descriptor must
match the selected name and version exactly. apizr.builtin is reserved. No
entrypoint scanning or global registry is used. Each admitted SourceView carries
immutable bounded source facts shared during that inspection; tree() always
returns a fresh mutable AST owned by its caller.
Diagnostics and retained evidence
| Code | Meaning |
|---|---|
provider_disabled |
Explicitly disabled; selected evidence is unknown. |
provider_shadowed |
Earlier entries own every requested capability; not invoked. |
provider_unavailable |
Missing implementation or unavailable installed extension/descriptor. |
provider_incompatible |
Descriptor is invalid or has a different identity/version. |
provider_unsupported |
Descriptor does not support a selected capability. |
provider_failed |
Recognition raised or its extension invocation failed. |
provider_result_invalid |
Candidate failed source binding or core result admission. |
provider_limit |
Source/request/result exceeded an admitted bound. |
Refused evidence stays unknown and raw provider exception text is not exposed. Provider candidates are revalidated before use; identity, source digest, locations, capabilities and aggregate result limits remain core authority.
experiment run records the provider report in the Plan's immutable
execution.controls entry scientific_providers. The Run binds that Plan by
digest. experiment show and experiment diff read the retained report without
loading the producer, including after uninstall. Diff presents provider changes as
context, without claiming they caused an outcome change. Historical records
without a report remain readable and yield unknown provider comparison context.
Standalone inspection without an explicit selection preserves its historical
wire output; an explicit selection adds the provider report.
The separately packaged literal-accuracy example and installed-wheel qualification demonstrate protocol invocation and reading history after uninstall. See the provider contracts for authoring and admission details.