XetoCLI
XetoCLI
A client interface to Haxall's Xeto CLI tools for type checking and analysis of Haystack records.
This API is experimental and subject to change in future releases.
XetoCLI can be directly imported as follows:
from phable import XetoCLI
Source code in phable/xeto_cli.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
__init__
__init__(*, local_haxall_path=None, io_format='zinc')
Initialize a XetoCLI instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
local_haxall_path
|
str | pathlib.Path | None
|
Optional path to a local Haxall installation directory. If provided,
commands will execute against the local installation. If |
None
|
io_format
|
typing.Literal['json', 'zinc']
|
Data serialization format for communication with Haxall. Either |
'zinc'
|
Source code in phable/xeto_cli.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
fits_explain
fits_explain(recs, graph=True)
Analyze records against Xeto type specifications and return detailed explanations.
This method executes the Haxall xeto fits command to determine whether the
provided records conform to their declared Xeto types. It returns a detailed
explanation of type conformance, including any type mismatches or missing
required tags.
Example:
from phable import Marker, Number, Ref, XetoCLI
cli = XetoCLI()
recs = [
{
"dis": "Site 1",
"site": Marker(),
"area": Number(1_000, "square_foot"),
"spec": Ref("ph::Site"),
}
]
result = cli.fits_explain(recs)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recs
|
list[dict[str, typing.Any]]
|
List of Haystack record dictionaries to analyze. Each record should
specify a Xeto type with a |
required |
graph
|
bool
|
If |
True
|
Returns:
| Type | Description |
|---|---|
phable.Grid
|
|
Source code in phable/xeto_cli.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |