get_instance
Returns the identity and versions of this CAT installation, the stored license key and the platform it runs on. Works without sign-in.
On this page
Signature
cat.get_instance()
Parameters
None.
What it does
Loads the engine if needed, reads %APPDATA%\CAT\.catconfig (~/.config/CAT/.catconfig on Linux) and the runtime, and returns one object describing the installation. It does not sign in and needs neither a token nor a key — it is the one function that always works, which makes it the first thing to run when something else does not (and the way to verify an installation).
Returns
A CatInstanceInfoDTO object:
| Property | Meaning |
|---|---|
InstanceID |
Identity of this installation (a GUID, created on first use). |
InstallationTimestamp |
When the instance was created. |
LicenseKey |
The stored license key (the whole key), or None. |
AutomationPlatform |
The CI/CD platform CAT detected it was started by, or None for an interactive start — what the interactive-only rule sees. |
CatTool |
Python. |
CoreVersion, ToolVersion |
Versions of the CAT engine and of the package. |
Platform, OsVersion |
Windows / Linux and the OS version. |
Expectations, Providers |
The expectations and providers this version knows, as one string each. |
The plan is not on this object — it is decided at sign-in, which this function does not do.
Raises
RuntimeError: Failed to create a .NET runtime (coreclr)… when no .NET runtime is installed.
Examples
from justcatit import cat
i = cat.get_instance()
print(i) # the whole object, one line
print(i.ToolVersion, i.CoreVersion, i.Platform)
print(bool(i.LicenseKey)) # is a key stored on this machine?
Related
- Introduction — session model, logging, .NET objects, exceptions, sign-in.
set_instance— set or remove the key.- Installation.