tangle-cli 0.0.1a1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tangle_cli/__init__.py +19 -0
- tangle_cli/api_cli.py +787 -0
- tangle_cli/api_schema.py +633 -0
- tangle_cli/api_transport.py +461 -0
- tangle_cli/args_container.py +244 -0
- tangle_cli/artifacts.py +293 -0
- tangle_cli/artifacts_cli.py +108 -0
- tangle_cli/cli.py +57 -0
- tangle_cli/cli_helpers.py +116 -0
- tangle_cli/cli_options.py +52 -0
- tangle_cli/client.py +677 -0
- tangle_cli/component_from_func.py +1856 -0
- tangle_cli/component_generator.py +298 -0
- tangle_cli/component_inspector.py +494 -0
- tangle_cli/component_publisher.py +921 -0
- tangle_cli/components_cli.py +269 -0
- tangle_cli/dynamic_discovery_client.py +296 -0
- tangle_cli/generated_model_extensions.py +405 -0
- tangle_cli/generated_runtime.py +43 -0
- tangle_cli/handler.py +96 -0
- tangle_cli/hydration_trust.py +222 -0
- tangle_cli/logger.py +166 -0
- tangle_cli/models.py +407 -0
- tangle_cli/module_bundler.py +662 -0
- tangle_cli/openapi/__init__.py +0 -0
- tangle_cli/openapi/codegen.py +1090 -0
- tangle_cli/openapi/parser.py +77 -0
- tangle_cli/pipeline_dehydrator.py +720 -0
- tangle_cli/pipeline_hydrator.py +1785 -0
- tangle_cli/pipeline_run_annotations.py +41 -0
- tangle_cli/pipeline_run_details.py +203 -0
- tangle_cli/pipeline_run_manager.py +1994 -0
- tangle_cli/pipeline_run_search.py +712 -0
- tangle_cli/pipeline_runner.py +620 -0
- tangle_cli/pipeline_runs_cli.py +584 -0
- tangle_cli/pipelines.py +581 -0
- tangle_cli/pipelines_cli.py +271 -0
- tangle_cli/published_components_cli.py +373 -0
- tangle_cli/py.typed +0 -0
- tangle_cli/quickstart.py +110 -0
- tangle_cli/secrets.py +156 -0
- tangle_cli/secrets_cli.py +269 -0
- tangle_cli/utils.py +942 -0
- tangle_cli/version_manager.py +470 -0
- tangle_cli-0.0.1a1.dist-info/METADATA +561 -0
- tangle_cli-0.0.1a1.dist-info/RECORD +48 -0
- tangle_cli-0.0.1a1.dist-info/WHEEL +4 -0
- tangle_cli-0.0.1a1.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""Offline OpenAPI loading helpers used by generated-client codegen.
|
|
2
|
+
|
|
3
|
+
The runtime client does not import this module. It exists so expanding the
|
|
4
|
+
checked-in generated client is a deterministic local operation over the
|
|
5
|
+
checked-in API-package ``openapi.json`` snapshot.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import json
|
|
11
|
+
from importlib import resources
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from typing import Any
|
|
14
|
+
|
|
15
|
+
from tangle_cli.api_schema import OperationCommand, operation_commands
|
|
16
|
+
|
|
17
|
+
_REPO_ROOT = Path(__file__).resolve().parents[5]
|
|
18
|
+
DEFAULT_OPENAPI_PATH = _REPO_ROOT / "packages" / "tangle-api" / "src" / "tangle_api" / "schema" / "openapi.json"
|
|
19
|
+
DEFAULT_OPENAPI_RESOURCE_PACKAGE = "tangle_api.schema"
|
|
20
|
+
DEFAULT_OPENAPI_RESOURCE_NAME = "openapi.json"
|
|
21
|
+
_FALLBACK_OPENAPI_RESOURCE_PACKAGES = (DEFAULT_OPENAPI_RESOURCE_PACKAGE, "tangle_cli.openapi")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _load_json_file(schema_path: Path) -> dict[str, Any]:
|
|
25
|
+
with schema_path.open("r", encoding="utf-8") as f:
|
|
26
|
+
schema = json.load(f)
|
|
27
|
+
if not isinstance(schema, dict) or "paths" not in schema:
|
|
28
|
+
raise ValueError(f"{schema_path} does not look like an OpenAPI schema")
|
|
29
|
+
return schema
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _load_default_openapi_schema() -> dict[str, Any]:
|
|
33
|
+
if DEFAULT_OPENAPI_PATH.exists():
|
|
34
|
+
return _load_json_file(DEFAULT_OPENAPI_PATH)
|
|
35
|
+
|
|
36
|
+
schema_text = None
|
|
37
|
+
schema_package = DEFAULT_OPENAPI_RESOURCE_PACKAGE
|
|
38
|
+
last_error: Exception | None = None
|
|
39
|
+
for package in _FALLBACK_OPENAPI_RESOURCE_PACKAGES:
|
|
40
|
+
try:
|
|
41
|
+
schema_text = (
|
|
42
|
+
resources.files(package)
|
|
43
|
+
.joinpath(DEFAULT_OPENAPI_RESOURCE_NAME)
|
|
44
|
+
.read_text(encoding="utf-8")
|
|
45
|
+
)
|
|
46
|
+
schema_package = package
|
|
47
|
+
break
|
|
48
|
+
except (FileNotFoundError, ModuleNotFoundError) as exc:
|
|
49
|
+
last_error = exc
|
|
50
|
+
if schema_text is None:
|
|
51
|
+
raise FileNotFoundError(
|
|
52
|
+
"Default OpenAPI snapshot not found. Install tangle-api, run from a "
|
|
53
|
+
"source checkout with packages/tangle-api/src/tangle_api/schema/openapi.json, "
|
|
54
|
+
"or pass --openapi PATH explicitly."
|
|
55
|
+
) from last_error
|
|
56
|
+
|
|
57
|
+
schema = json.loads(schema_text)
|
|
58
|
+
if not isinstance(schema, dict) or "paths" not in schema:
|
|
59
|
+
raise ValueError(
|
|
60
|
+
f"{schema_package}/{DEFAULT_OPENAPI_RESOURCE_NAME} "
|
|
61
|
+
"does not look like an OpenAPI schema"
|
|
62
|
+
)
|
|
63
|
+
return schema
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def load_openapi_schema(path: str | Path | None = None) -> dict[str, Any]:
|
|
67
|
+
"""Load a Tangle OpenAPI schema from disk."""
|
|
68
|
+
|
|
69
|
+
if path is None:
|
|
70
|
+
return _load_default_openapi_schema()
|
|
71
|
+
return _load_json_file(Path(path))
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def parsed_operations(schema: dict[str, Any] | None = None) -> list[OperationCommand]:
|
|
75
|
+
"""Return normalized operations using the same parser as the dynamic CLI."""
|
|
76
|
+
|
|
77
|
+
return operation_commands(schema or load_openapi_schema())
|