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 src/phable/xeto_cli.py
10 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 | |
__init__
__init__(*, docker_cli=False, io_format='zinc')
Initialize a XetoCLI instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xeto_dir
|
Optional path to a local directory with Xeto libraries. If provided, CLI commands will
be executed from this directory assuming a local Haxall installation is linked. If |
required | |
io_format
|
typing.Literal['json', 'zinc']
|
Data serialization format for communication with Haxall. Either |
'zinc'
|
Source code in src/phable/xeto_cli.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
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 src/phable/xeto_cli.py
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 | |