torch, tensorflow, pandas,
datasets, SQL drivers, …) are installed, and, when called with
required names, raise CirronDependencyError listing every missing
dep at once with a combined pip install command.
Use it at the top of a long training script so a missing extra raises
immediately instead of 40 minutes into training with a cryptic
ImportError, or inside library code that wraps the SDK and wants to
gate on what’s present.
ci.deps() is the in-process equivalent of the cirron doctor CLI,
which inspects an installed cirron-sdk from outside the Python
process. Both read from the same pyproject.toml extras list.
Signature
Parameters
| Name | Type | Purpose |
|---|---|---|
*required | str | Optional. Names of extras that must be present. Raises if any are missing. |
required name can be either the import name ("torch",
"datasets", "sklearn") or the pyproject extras name
("hf" for datasets). Unknown names raise ValueError: that’s a
caller bug, not a missing dep.
Returns
A dict keyed by import name. With no arguments, one entry for every known extra, mapping to the installed version string orNone. With
required names, only the requested entries (all present; missing
ones would have raised).
Behavior
- Zero import cost: uses
importlib.util.find_spec+importlib.metadata.version, not__import__. Heavy frameworks (torch, tensorflow, transformers) are never actually loaded by the check itself. Cheap to call at module import time. - Fail-fast form lists every miss at once: one
CirronDependencyErrorwith every missing dep in the body and a combinedpip install 'cirron-sdk[a,b,c]'command, rather than one error per missing dep. - Caller bug vs missing dep: unknown extras names raise
ValueError, notCirronDependencyError. CatchingCirronDependencyErrornever hides a typo in your code.
Examples
Report every extra
deps["polars"] reads naturally. Extras
whose pyproject name differs from the import name (hf → datasets,
sklearn → scikit-learn) show up under the import name.
Fail fast at script startup
Guard optional code paths
Accept both import and extras names
From a Cirron instance
Module-level ci.deps is sugar over the default instance; the method
exists on Cirron for API symmetry with the other surface.
When a check returns "unknown"
If a module is importable but not pip-tracked (e.g. an editable install
with no metadata, or a vendored copy), ci.deps() reports
"unknown" instead of a version string. The extra is considered
present, and ci.deps(name) does not raise.
What it does not do
- Does not install anything. The error message names the pip command; the user runs it.
- Does not probe the Cirron platform. Fully local.
- Does not validate config. For that, see
ci.profile().health().
Related
cirron doctor
External CLI equivalent. Inspects an installed
cirron-sdk from
outside the Python process.CirronDependencyError
Exception raised by the fail-fast form.
Installation
The full list of extras and what they add.
Profile lifecycle
profiler.health() for runtime state.