tangle-cli 0.0.1a1__tar.gz → 0.1.0__tar.gz

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.
Files changed (76) hide show
  1. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/PKG-INFO +38 -73
  2. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/README.md +36 -71
  3. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/__init__.py +4 -4
  4. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/api_cli.py +8 -4
  5. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/cli_helpers.py +7 -6
  6. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/client.py +8 -1
  7. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/component_publisher.py +3 -3
  8. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/handler.py +1 -1
  9. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/models.py +51 -5
  10. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/openapi/codegen.py +46 -192
  11. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/openapi/parser.py +4 -3
  12. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/pipeline_run_search.py +3 -3
  13. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/quickstart.py +11 -12
  14. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/pyproject.toml +6 -2
  15. tangle_cli-0.1.0/skills/tangent/OSS-CONVENTIONS.md +471 -0
  16. tangle_cli-0.1.0/skills/tangent/PORT-README.md +79 -0
  17. tangle_cli-0.1.0/skills/tangent/SKILL.md +124 -0
  18. tangle_cli-0.1.0/skills/tangent/agents/auth-wizard.md +150 -0
  19. tangle_cli-0.1.0/skills/tangent/agents/builder.md +252 -0
  20. tangle_cli-0.1.0/skills/tangent/agents/debugger.md +142 -0
  21. tangle_cli-0.1.0/skills/tangent/agents/reporter.md +103 -0
  22. tangle_cli-0.1.0/skills/tangent/agents/researcher.md +197 -0
  23. tangle_cli-0.1.0/skills/tangent/agents/reviewer.md +106 -0
  24. tangle_cli-0.1.0/skills/tangent/agents/scenario-builder.md +451 -0
  25. tangle_cli-0.1.0/skills/tangent/references/data-sources.md +334 -0
  26. tangle_cli-0.1.0/skills/tangent/references/event-log.md +110 -0
  27. tangle_cli-0.1.0/skills/tangent/references/example-scenarios/01-mslr-ranking.md +165 -0
  28. tangle_cli-0.1.0/skills/tangent/references/example-scenarios/02-text-classification.md +147 -0
  29. tangle_cli-0.1.0/skills/tangent/references/example-scenarios/INDEX.md +48 -0
  30. tangle_cli-0.1.0/skills/tangent/references/iterating-on-runs.md +56 -0
  31. tangle_cli-0.1.0/skills/tangent/references/knowledge-corpus.md +128 -0
  32. tangle_cli-0.1.0/skills/tangent/references/secrets.md +347 -0
  33. tangle_cli-0.1.0/skills/tangent/references/setup.md +157 -0
  34. tangle_cli-0.1.0/skills/tangent/references/step-0-initialize.md +107 -0
  35. tangle_cli-0.1.0/skills/tangent/references/step-1-analyze.md +91 -0
  36. tangle_cli-0.1.0/skills/tangent/references/step-2-hypothesize.md +42 -0
  37. tangle_cli-0.1.0/skills/tangent/references/step-3-submit.md +174 -0
  38. tangle_cli-0.1.0/skills/tangent/references/step-4-monitor.md +123 -0
  39. tangle_cli-0.1.0/skills/tangent/references/step-5-evaluate.md +53 -0
  40. tangle_cli-0.1.0/skills/tangent/references/step-6-synthesize.md +56 -0
  41. tangle_cli-0.1.0/skills/tangent/references/step-7-decide.md +79 -0
  42. tangle_cli-0.1.0/skills/tangent/references/tangle-tools.md +410 -0
  43. tangle_cli-0.1.0/skills/tangent/references/uploading-artifacts.md +229 -0
  44. tangle_cli-0.0.1a1/packages/tangle-cli/src/tangle_cli/generated_runtime.py +0 -43
  45. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/api_schema.py +0 -0
  46. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/api_transport.py +0 -0
  47. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/args_container.py +0 -0
  48. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/artifacts.py +0 -0
  49. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/artifacts_cli.py +0 -0
  50. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/cli.py +0 -0
  51. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/cli_options.py +0 -0
  52. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/component_from_func.py +0 -0
  53. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/component_generator.py +0 -0
  54. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/component_inspector.py +0 -0
  55. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/components_cli.py +0 -0
  56. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/dynamic_discovery_client.py +0 -0
  57. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/generated_model_extensions.py +0 -0
  58. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/hydration_trust.py +0 -0
  59. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/logger.py +0 -0
  60. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/module_bundler.py +0 -0
  61. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/openapi/__init__.py +0 -0
  62. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/pipeline_dehydrator.py +0 -0
  63. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/pipeline_hydrator.py +0 -0
  64. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/pipeline_run_annotations.py +0 -0
  65. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/pipeline_run_details.py +0 -0
  66. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/pipeline_run_manager.py +0 -0
  67. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/pipeline_runner.py +0 -0
  68. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/pipeline_runs_cli.py +0 -0
  69. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/pipelines.py +0 -0
  70. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/pipelines_cli.py +0 -0
  71. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/published_components_cli.py +0 -0
  72. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/py.typed +0 -0
  73. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/secrets.py +0 -0
  74. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/secrets_cli.py +0 -0
  75. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/utils.py +0 -0
  76. {tangle_cli-0.0.1a1 → tangle_cli-0.1.0}/packages/tangle-cli/src/tangle_cli/version_manager.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: tangle-cli
3
- Version: 0.0.1a1
3
+ Version: 0.1.0
4
4
  Summary: CLI for Tangle, the open-source ML pipeline orchestration platform
5
5
  Author: Alexey Volkov, Tangle authors
6
6
  Author-email: Alexey Volkov <alexey.volkov@ark-kun.com>
@@ -13,8 +13,8 @@ Requires-Dist: platformdirs>=4.10.0
13
13
  Requires-Dist: pydantic>=2.0
14
14
  Requires-Dist: pyyaml>=6.0
15
15
  Requires-Dist: requests>=2.32.0
16
+ Requires-Dist: tangle-api==0.1.0
16
17
  Requires-Dist: tomli>=2.0 ; python_full_version < '3.11'
17
- Requires-Dist: tangle-api==0.1.0 ; extra == 'native'
18
18
  Requires-Python: >=3.10
19
19
  Project-URL: Homepage, https://tangleml.com
20
20
  Project-URL: Documentation, https://tangleml.com/docs/
@@ -58,7 +58,7 @@ By default `tangle api` uses `--schema-source auto`, which means official static
58
58
 
59
59
  `tangle sdk` commands are hand-written workflows. They can be:
60
60
 
61
- - **local-only**: no generated/native API bindings required, e.g. pipeline validation/layout and component generation;
61
+ - **local-only**: no generated API bindings required, e.g. pipeline validation/layout and component generation;
62
62
  - **API-backed**: use the generated client but add domain behavior, e.g. pipeline-run submit payload construction, hydration, artifact lookup, publishing/version checks, or config batching.
63
63
 
64
64
  Current SDK groups include:
@@ -111,22 +111,26 @@ Use `--log-type none` for quiet machine-readable runs, and `--log-type file` to
111
111
  The repository contains two Python import packages with different responsibilities:
112
112
 
113
113
  - `tangle_cli` is hand-written. It contains CLI wiring, SDK/business helpers, local pipeline/component workflows, dynamic API discovery, codegen, shared runtime classes, logging, and extension classes.
114
- - `tangle_api` is generated/native. It contains checked-in generated Pydantic models, generated endpoint operation methods, and the official OpenAPI snapshot.
114
+ - `tangle_api` is generated/static. It contains checked-in generated Pydantic models, generated endpoint operation methods, and the official OpenAPI snapshot.
115
115
 
116
- The default `tangle-cli` package keeps the top-level import and local-only SDK commands native-free. Install the native extra when you want static API-backed commands and the handwritten `TangleApiClient` wrapper to use the checked-in generated bindings:
116
+ The default public `tangle-cli` package depends on the matching `tangle-api` package, so normal installs include the checked-in generated bindings used by static API-backed commands and the handwritten `TangleApiClient` wrapper:
117
117
 
118
118
  ```bash
119
- pip install 'tangle-cli[native]'
119
+ pip install tangle-cli
120
120
  ```
121
121
 
122
- In this workspace, `uv` installs the workspace `tangle-api` package for development and tests:
122
+ The `native` extra remains as a compatibility no-op alias for older install instructions. In this workspace, `uv` installs the workspace `tangle-api` package for development and tests:
123
123
 
124
124
  ```bash
125
125
  uv run tangle api --help
126
126
  uv run tangle sdk pipelines validate pipeline.yaml
127
127
  ```
128
128
 
129
- If you are embedding `tangle_cli` in a downstream project, you can provide your own local `tangle_api.generated` package produced from your backend schema instead of using this repo's official generated package.
129
+ Custom API/codegen users can still run codegen from the fully capable install; generating bindings does not require removing the official `tangle-api` package. For project-local generated APIs, generate into a local source tree such as `src/tangle_api/generated` (and `src/tangle_api/schema/openapi.json` when you want `tangle api --schema-source official`) and run from that project so local `src/tangle_api` shadows site-packages. For packaged custom APIs, publish/provide a distribution named `tangle-api` with a version compatible with this `tangle-cli` release (for example `0.1.0+yourorg` for a `tangle-cli` dependency on `tangle-api==0.1.0`) via a private index, `--find-links`, or uv sources. As an expert escape hatch, `--no-deps` installs only `tangle-cli` and skips all dependencies, so that environment must manually provide every required runtime dependency plus its generated/custom `tangle_api`; this is acceptable for controlled codegen/custom scenarios but not normal UX.
130
+
131
+ ## Agent skills
132
+
133
+ This repo includes the Tangent agent-skill bundle under `skills/tangent/`. The bundle was ported from `tangle-cli-lab` and now treats this repository as the canonical source. It drives the public `tangle` / `tangle-cli` command surface, assumes the default `tangle-cli` install includes `tangle-api`, and keeps relative references (`agents/*.md`, `references/*.md`) self-contained for Pi-style skill loaders. The source distribution includes `skills/**` so downstream source-based consumers can inspect or vendor the skill docs with the release.
130
134
 
131
135
  ## Quick command examples
132
136
 
@@ -229,9 +233,9 @@ uv run tangle api reset-cache --base-url https://api.example
229
233
 
230
234
  Schema source modes are:
231
235
 
232
- - `--schema-source auto` (default): official static operations plus cached-only backend extensions when a cache exists. Requires the native `tangle-api` package for official operations.
233
- - `--schema-source official`: only the checked-in official static schema. Requires the native `tangle-api` package.
234
- - `--schema-source cache`: only the schema previously written by `tangle api refresh` for the selected base URL. Does not require the native package.
236
+ - `--schema-source auto` (default): official static operations plus cached-only backend extensions when a cache exists. Normal `tangle-cli` installs include the `tangle-api` package needed for official operations; custom API projects can shadow or replace that package as described in the codegen section.
237
+ - `--schema-source official`: only the checked-in official static schema from `tangle-api` (or a compatible custom `tangle-api` package on your environment's import path).
238
+ - `--schema-source cache`: only the schema previously written by `tangle api refresh` for the selected base URL. This is the custom/source-checkout fallback when a consumer environment does not provide an importable `tangle_api.schema` package.
235
239
 
236
240
  For resource help, put `--schema-source` on the resource group:
237
241
 
@@ -331,7 +335,7 @@ existing = client.find_existing_components(
331
335
 
332
336
  `TangleApiClient` is handwritten in `tangle_cli.client` and inherits generated endpoint methods from `tangle_api.generated.operations.GeneratedTangleApiOperations`. The generated endpoint methods call the handwritten transport/request logic. Handwritten semantic helpers such as `find_existing_components(...)` return domain models and normalize common compatibility cases.
333
337
 
334
- The top-level `import tangle_cli` is lightweight and does not import native static bindings. Install the native extra or otherwise provide a local `tangle_api.generated` package before importing `tangle_cli.client`.
338
+ The top-level `import tangle_cli` is lightweight and does not import static bindings eagerly. Normal installs include `tangle-api`; source checkouts or downstream embeddings may instead provide a local `tangle_api.generated` package before importing `tangle_cli.client`.
335
339
 
336
340
  ## Codegen/autogen from OpenAPI
337
341
 
@@ -362,6 +366,17 @@ uv run python -m tangle_cli.openapi.codegen \
362
366
  --out src/tangle_api/generated
363
367
  ```
364
368
 
369
+ For a project-local custom API package, write both the schema snapshot and generated modules under that project's source tree, then run tools/tests from the project environment so `src/tangle_api` is earlier on `sys.path` than the official site-packages package:
370
+
371
+ ```bash
372
+ uv run python -m tangle_cli.openapi.codegen \
373
+ --openapi-url https://api.example/openapi.json \
374
+ --openapi src/tangle_api/schema/openapi.json \
375
+ --out src/tangle_api/generated
376
+ ```
377
+
378
+ That project-local `tangle_api` package can be an editable/package source tree. If you ship the custom API bindings as a wheel or source distribution, use the distribution name `tangle-api` and a compatible version for the `tangle-cli` release you are using. A PEP 440 local version such as `0.1.0+yourorg` can satisfy a public `==0.1.0` dependency while distinguishing your private build. Provide that package through your private index, `--find-links`, or uv source configuration so the resolver chooses it instead of the public official package.
379
+
365
380
  Generate from a backend checkout explicitly:
366
381
 
367
382
  ```bash
@@ -372,48 +387,29 @@ uv run --group codegen python -m tangle_cli.openapi.codegen \
372
387
 
373
388
  Important codegen options:
374
389
 
375
- - `--out`: directory that receives `__init__.py`, `models.py`, and `operations.py`. Defaults to `packages/tangle-api/src/tangle_api/generated`.
390
+ - `--out`: directory that receives `__init__.py`, `runtime.py`, `models.py`, and `operations.py`. Defaults to `packages/tangle-api/src/tangle_api/generated`.
376
391
  - `--operations-class-name`: generated operations mixin class name. Defaults to `GeneratedTangleApiOperations`.
377
- - `--model-extension-module`: importable module with `MODEL_EXTENSIONS`; repeat to compose modules.
378
392
  - `--model-alias`: expose a stable public model name from one or more source schema names, e.g. `ComponentSpec=ComponentSpecOutput,ComponentSpecInput`.
379
393
  - `--request-body-schema` / `--request-body-schema-file`: override a specific operation's JSON request-body schema without mutating the fetched OpenAPI document.
380
394
 
381
395
  At runtime, more `tangle api ...` commands become available in two ways:
382
396
 
383
- 1. Static codegen: regenerate and install/provide a `tangle_api.generated` package for the schema.
397
+ 1. Static codegen: regenerate and install/provide a local or packaged `tangle_api` package containing `tangle_api.generated` and, for official-schema CLI discovery, `tangle_api.schema`.
384
398
  2. Dynamic cache: run `tangle api refresh --base-url ...` and use `--schema-source auto` or `--schema-source cache` to expose cached-only operations through the dynamic CLI.
385
399
 
386
- ## Generated model extension pattern
400
+ The supported workaround hierarchy for custom API consumers is: prefer a project-local `src/tangle_api` package that shadows site-packages for that project; if distributing bindings, prefer a compatible private `tangle-api` distribution; reserve `--no-deps` installs or manual uninstalls of the official package for controlled expert environments where you manually provide all dependencies and the generated/custom `tangle_api` package.
387
401
 
388
- Generated models use a generated implementation base plus a stable public subclass. For example, codegen emits this shape for a model with a handwritten extension:
402
+ ## Runtime generated model extension pattern
403
+
404
+ `tangle_api.generated.models` is a leaf package and codegen emits plain generated Pydantic models directly:
389
405
 
390
406
  ```python
391
- class _ComponentSpecGenerated(TangleGeneratedModel):
407
+ class ComponentSpec(TangleGeneratedModel):
392
408
  name: Any = None
393
409
  # generated OpenAPI fields...
394
-
395
- class ComponentSpec(ComponentSpecExtensions, _ComponentSpecGenerated):
396
- pass
397
- ```
398
-
399
- The public class is a subclass rather than an alias because the public class name is the stable contract while the generated base can be regenerated. Subclassing lets the public class keep the OpenAPI/Pydantic fields from `_ComponentSpecGenerated` and add or override behavior through normal Python MRO.
400
-
401
- Extension bases are placed to the **left** of the generated base:
402
-
403
- ```python
404
- class ComponentSpec(ComponentSpecExtensions, _ComponentSpecGenerated):
405
- pass
406
- ```
407
-
408
- That means extension methods/properties override generated-base behavior when names overlap, while generated fields and `TangleGeneratedModel` runtime helpers such as `to_dict()` remain available.
409
-
410
- The built-in default extension module is:
411
-
412
- ```text
413
- tangle_cli.generated_model_extensions
414
410
  ```
415
411
 
416
- It defines:
412
+ Generated models do not import `tangle_cli` and codegen does not bake downstream extension modules into `tangle_api`. Downstream packages compose their own extended model namespace at runtime. In `tangle_cli.models`, the default CLI mixins are declared in `tangle_cli.generated_model_extensions`:
417
413
 
418
414
  ```python
419
415
  MODEL_EXTENSIONS = {
@@ -423,42 +419,11 @@ MODEL_EXTENSIONS = {
423
419
  }
424
420
  ```
425
421
 
426
- During codegen, `tangle_api.generated.models` imports those extension classes from `tangle_cli.generated_model_extensions`. This preserves the package boundary: `tangle_api` remains generated bindings, while `tangle_cli` owns handwritten runtime and extension behavior.
427
-
428
- Downstream projects can layer their own extensions:
429
-
430
- ```python
431
- # my_project/tangle_model_extensions.py
432
- class MyComponentSpecExtensions:
433
- @property
434
- def owning_team(self) -> str | None:
435
- return (self.metadata or {}).get("annotations", {}).get("team")
436
-
437
- MODEL_EXTENSIONS = {
438
- "ComponentSpec": "MyComponentSpecExtensions",
439
- }
440
- ```
441
-
442
- ```bash
443
- uv run python -m tangle_cli.openapi.codegen \
444
- --openapi-url https://api.example/openapi.json \
445
- --out src/tangle_api/generated \
446
- --model-extension-module my_project.tangle_model_extensions
447
- ```
448
-
449
- The default module is applied first. Repeated `--model-extension-module` values are applied in order, and later/downstream modules become leftmost in the generated public class MRO, so they override earlier/default extensions. If two modules export the same extension class name, codegen imports them with deterministic aliases.
450
-
451
- Pass an empty string to disable built-in default extensions:
452
-
453
- ```bash
454
- uv run python -m tangle_cli.openapi.codegen \
455
- --from-snapshot \
456
- --model-extension-module ""
457
- ```
422
+ `tangle_cli.models.compose_models(...)` reads those mappings and creates subclasses in the `tangle_cli.models` namespace, e.g. `ComponentSpec(ComponentSpecExtensions, tangle_api.generated.models.ComponentSpec)`, without mutating `tangle_api.generated.models`. The generated operations layer also calls `_response_model(model_name, default)` so `TangleApiClient` can deserialize responses into the CLI-composed classes while the base `GeneratedTangleApiOperations` remains downstream-agnostic.
458
423
 
459
- The same empty-string sentinel can disable built-in `--model-alias` defaults. Built-in aliases keep stable public model names such as `ComponentSpec` even when a backend schema uses names like `ComponentSpecOutput` or `ComponentSpecInput`.
424
+ Downstream projects can use the same pattern in their own namespace: import base classes from `tangle_api.generated.models`, define method/property-only mixins plus a `MODEL_EXTENSIONS` mapping, and compose subclasses locally. Avoid global monkey-patching of `tangle_api.generated.models`.
460
425
 
461
- Extension classes should be importable from their modules and should not import generated model classes. They should be mixins over generated data, not replacements for generated schemas.
426
+ Built-in `--model-alias` defaults still keep stable public model names such as `ComponentSpec` even when a backend schema uses names like `ComponentSpecOutput` or `ComponentSpecInput`.
462
427
 
463
428
  ## Extending SDK behavior
464
429
 
@@ -33,7 +33,7 @@ By default `tangle api` uses `--schema-source auto`, which means official static
33
33
 
34
34
  `tangle sdk` commands are hand-written workflows. They can be:
35
35
 
36
- - **local-only**: no generated/native API bindings required, e.g. pipeline validation/layout and component generation;
36
+ - **local-only**: no generated API bindings required, e.g. pipeline validation/layout and component generation;
37
37
  - **API-backed**: use the generated client but add domain behavior, e.g. pipeline-run submit payload construction, hydration, artifact lookup, publishing/version checks, or config batching.
38
38
 
39
39
  Current SDK groups include:
@@ -86,22 +86,26 @@ Use `--log-type none` for quiet machine-readable runs, and `--log-type file` to
86
86
  The repository contains two Python import packages with different responsibilities:
87
87
 
88
88
  - `tangle_cli` is hand-written. It contains CLI wiring, SDK/business helpers, local pipeline/component workflows, dynamic API discovery, codegen, shared runtime classes, logging, and extension classes.
89
- - `tangle_api` is generated/native. It contains checked-in generated Pydantic models, generated endpoint operation methods, and the official OpenAPI snapshot.
89
+ - `tangle_api` is generated/static. It contains checked-in generated Pydantic models, generated endpoint operation methods, and the official OpenAPI snapshot.
90
90
 
91
- The default `tangle-cli` package keeps the top-level import and local-only SDK commands native-free. Install the native extra when you want static API-backed commands and the handwritten `TangleApiClient` wrapper to use the checked-in generated bindings:
91
+ The default public `tangle-cli` package depends on the matching `tangle-api` package, so normal installs include the checked-in generated bindings used by static API-backed commands and the handwritten `TangleApiClient` wrapper:
92
92
 
93
93
  ```bash
94
- pip install 'tangle-cli[native]'
94
+ pip install tangle-cli
95
95
  ```
96
96
 
97
- In this workspace, `uv` installs the workspace `tangle-api` package for development and tests:
97
+ The `native` extra remains as a compatibility no-op alias for older install instructions. In this workspace, `uv` installs the workspace `tangle-api` package for development and tests:
98
98
 
99
99
  ```bash
100
100
  uv run tangle api --help
101
101
  uv run tangle sdk pipelines validate pipeline.yaml
102
102
  ```
103
103
 
104
- If you are embedding `tangle_cli` in a downstream project, you can provide your own local `tangle_api.generated` package produced from your backend schema instead of using this repo's official generated package.
104
+ Custom API/codegen users can still run codegen from the fully capable install; generating bindings does not require removing the official `tangle-api` package. For project-local generated APIs, generate into a local source tree such as `src/tangle_api/generated` (and `src/tangle_api/schema/openapi.json` when you want `tangle api --schema-source official`) and run from that project so local `src/tangle_api` shadows site-packages. For packaged custom APIs, publish/provide a distribution named `tangle-api` with a version compatible with this `tangle-cli` release (for example `0.1.0+yourorg` for a `tangle-cli` dependency on `tangle-api==0.1.0`) via a private index, `--find-links`, or uv sources. As an expert escape hatch, `--no-deps` installs only `tangle-cli` and skips all dependencies, so that environment must manually provide every required runtime dependency plus its generated/custom `tangle_api`; this is acceptable for controlled codegen/custom scenarios but not normal UX.
105
+
106
+ ## Agent skills
107
+
108
+ This repo includes the Tangent agent-skill bundle under `skills/tangent/`. The bundle was ported from `tangle-cli-lab` and now treats this repository as the canonical source. It drives the public `tangle` / `tangle-cli` command surface, assumes the default `tangle-cli` install includes `tangle-api`, and keeps relative references (`agents/*.md`, `references/*.md`) self-contained for Pi-style skill loaders. The source distribution includes `skills/**` so downstream source-based consumers can inspect or vendor the skill docs with the release.
105
109
 
106
110
  ## Quick command examples
107
111
 
@@ -204,9 +208,9 @@ uv run tangle api reset-cache --base-url https://api.example
204
208
 
205
209
  Schema source modes are:
206
210
 
207
- - `--schema-source auto` (default): official static operations plus cached-only backend extensions when a cache exists. Requires the native `tangle-api` package for official operations.
208
- - `--schema-source official`: only the checked-in official static schema. Requires the native `tangle-api` package.
209
- - `--schema-source cache`: only the schema previously written by `tangle api refresh` for the selected base URL. Does not require the native package.
211
+ - `--schema-source auto` (default): official static operations plus cached-only backend extensions when a cache exists. Normal `tangle-cli` installs include the `tangle-api` package needed for official operations; custom API projects can shadow or replace that package as described in the codegen section.
212
+ - `--schema-source official`: only the checked-in official static schema from `tangle-api` (or a compatible custom `tangle-api` package on your environment's import path).
213
+ - `--schema-source cache`: only the schema previously written by `tangle api refresh` for the selected base URL. This is the custom/source-checkout fallback when a consumer environment does not provide an importable `tangle_api.schema` package.
210
214
 
211
215
  For resource help, put `--schema-source` on the resource group:
212
216
 
@@ -306,7 +310,7 @@ existing = client.find_existing_components(
306
310
 
307
311
  `TangleApiClient` is handwritten in `tangle_cli.client` and inherits generated endpoint methods from `tangle_api.generated.operations.GeneratedTangleApiOperations`. The generated endpoint methods call the handwritten transport/request logic. Handwritten semantic helpers such as `find_existing_components(...)` return domain models and normalize common compatibility cases.
308
312
 
309
- The top-level `import tangle_cli` is lightweight and does not import native static bindings. Install the native extra or otherwise provide a local `tangle_api.generated` package before importing `tangle_cli.client`.
313
+ The top-level `import tangle_cli` is lightweight and does not import static bindings eagerly. Normal installs include `tangle-api`; source checkouts or downstream embeddings may instead provide a local `tangle_api.generated` package before importing `tangle_cli.client`.
310
314
 
311
315
  ## Codegen/autogen from OpenAPI
312
316
 
@@ -337,6 +341,17 @@ uv run python -m tangle_cli.openapi.codegen \
337
341
  --out src/tangle_api/generated
338
342
  ```
339
343
 
344
+ For a project-local custom API package, write both the schema snapshot and generated modules under that project's source tree, then run tools/tests from the project environment so `src/tangle_api` is earlier on `sys.path` than the official site-packages package:
345
+
346
+ ```bash
347
+ uv run python -m tangle_cli.openapi.codegen \
348
+ --openapi-url https://api.example/openapi.json \
349
+ --openapi src/tangle_api/schema/openapi.json \
350
+ --out src/tangle_api/generated
351
+ ```
352
+
353
+ That project-local `tangle_api` package can be an editable/package source tree. If you ship the custom API bindings as a wheel or source distribution, use the distribution name `tangle-api` and a compatible version for the `tangle-cli` release you are using. A PEP 440 local version such as `0.1.0+yourorg` can satisfy a public `==0.1.0` dependency while distinguishing your private build. Provide that package through your private index, `--find-links`, or uv source configuration so the resolver chooses it instead of the public official package.
354
+
340
355
  Generate from a backend checkout explicitly:
341
356
 
342
357
  ```bash
@@ -347,48 +362,29 @@ uv run --group codegen python -m tangle_cli.openapi.codegen \
347
362
 
348
363
  Important codegen options:
349
364
 
350
- - `--out`: directory that receives `__init__.py`, `models.py`, and `operations.py`. Defaults to `packages/tangle-api/src/tangle_api/generated`.
365
+ - `--out`: directory that receives `__init__.py`, `runtime.py`, `models.py`, and `operations.py`. Defaults to `packages/tangle-api/src/tangle_api/generated`.
351
366
  - `--operations-class-name`: generated operations mixin class name. Defaults to `GeneratedTangleApiOperations`.
352
- - `--model-extension-module`: importable module with `MODEL_EXTENSIONS`; repeat to compose modules.
353
367
  - `--model-alias`: expose a stable public model name from one or more source schema names, e.g. `ComponentSpec=ComponentSpecOutput,ComponentSpecInput`.
354
368
  - `--request-body-schema` / `--request-body-schema-file`: override a specific operation's JSON request-body schema without mutating the fetched OpenAPI document.
355
369
 
356
370
  At runtime, more `tangle api ...` commands become available in two ways:
357
371
 
358
- 1. Static codegen: regenerate and install/provide a `tangle_api.generated` package for the schema.
372
+ 1. Static codegen: regenerate and install/provide a local or packaged `tangle_api` package containing `tangle_api.generated` and, for official-schema CLI discovery, `tangle_api.schema`.
359
373
  2. Dynamic cache: run `tangle api refresh --base-url ...` and use `--schema-source auto` or `--schema-source cache` to expose cached-only operations through the dynamic CLI.
360
374
 
361
- ## Generated model extension pattern
375
+ The supported workaround hierarchy for custom API consumers is: prefer a project-local `src/tangle_api` package that shadows site-packages for that project; if distributing bindings, prefer a compatible private `tangle-api` distribution; reserve `--no-deps` installs or manual uninstalls of the official package for controlled expert environments where you manually provide all dependencies and the generated/custom `tangle_api` package.
362
376
 
363
- Generated models use a generated implementation base plus a stable public subclass. For example, codegen emits this shape for a model with a handwritten extension:
377
+ ## Runtime generated model extension pattern
378
+
379
+ `tangle_api.generated.models` is a leaf package and codegen emits plain generated Pydantic models directly:
364
380
 
365
381
  ```python
366
- class _ComponentSpecGenerated(TangleGeneratedModel):
382
+ class ComponentSpec(TangleGeneratedModel):
367
383
  name: Any = None
368
384
  # generated OpenAPI fields...
369
-
370
- class ComponentSpec(ComponentSpecExtensions, _ComponentSpecGenerated):
371
- pass
372
- ```
373
-
374
- The public class is a subclass rather than an alias because the public class name is the stable contract while the generated base can be regenerated. Subclassing lets the public class keep the OpenAPI/Pydantic fields from `_ComponentSpecGenerated` and add or override behavior through normal Python MRO.
375
-
376
- Extension bases are placed to the **left** of the generated base:
377
-
378
- ```python
379
- class ComponentSpec(ComponentSpecExtensions, _ComponentSpecGenerated):
380
- pass
381
- ```
382
-
383
- That means extension methods/properties override generated-base behavior when names overlap, while generated fields and `TangleGeneratedModel` runtime helpers such as `to_dict()` remain available.
384
-
385
- The built-in default extension module is:
386
-
387
- ```text
388
- tangle_cli.generated_model_extensions
389
385
  ```
390
386
 
391
- It defines:
387
+ Generated models do not import `tangle_cli` and codegen does not bake downstream extension modules into `tangle_api`. Downstream packages compose their own extended model namespace at runtime. In `tangle_cli.models`, the default CLI mixins are declared in `tangle_cli.generated_model_extensions`:
392
388
 
393
389
  ```python
394
390
  MODEL_EXTENSIONS = {
@@ -398,42 +394,11 @@ MODEL_EXTENSIONS = {
398
394
  }
399
395
  ```
400
396
 
401
- During codegen, `tangle_api.generated.models` imports those extension classes from `tangle_cli.generated_model_extensions`. This preserves the package boundary: `tangle_api` remains generated bindings, while `tangle_cli` owns handwritten runtime and extension behavior.
402
-
403
- Downstream projects can layer their own extensions:
404
-
405
- ```python
406
- # my_project/tangle_model_extensions.py
407
- class MyComponentSpecExtensions:
408
- @property
409
- def owning_team(self) -> str | None:
410
- return (self.metadata or {}).get("annotations", {}).get("team")
411
-
412
- MODEL_EXTENSIONS = {
413
- "ComponentSpec": "MyComponentSpecExtensions",
414
- }
415
- ```
416
-
417
- ```bash
418
- uv run python -m tangle_cli.openapi.codegen \
419
- --openapi-url https://api.example/openapi.json \
420
- --out src/tangle_api/generated \
421
- --model-extension-module my_project.tangle_model_extensions
422
- ```
423
-
424
- The default module is applied first. Repeated `--model-extension-module` values are applied in order, and later/downstream modules become leftmost in the generated public class MRO, so they override earlier/default extensions. If two modules export the same extension class name, codegen imports them with deterministic aliases.
425
-
426
- Pass an empty string to disable built-in default extensions:
427
-
428
- ```bash
429
- uv run python -m tangle_cli.openapi.codegen \
430
- --from-snapshot \
431
- --model-extension-module ""
432
- ```
397
+ `tangle_cli.models.compose_models(...)` reads those mappings and creates subclasses in the `tangle_cli.models` namespace, e.g. `ComponentSpec(ComponentSpecExtensions, tangle_api.generated.models.ComponentSpec)`, without mutating `tangle_api.generated.models`. The generated operations layer also calls `_response_model(model_name, default)` so `TangleApiClient` can deserialize responses into the CLI-composed classes while the base `GeneratedTangleApiOperations` remains downstream-agnostic.
433
398
 
434
- The same empty-string sentinel can disable built-in `--model-alias` defaults. Built-in aliases keep stable public model names such as `ComponentSpec` even when a backend schema uses names like `ComponentSpecOutput` or `ComponentSpecInput`.
399
+ Downstream projects can use the same pattern in their own namespace: import base classes from `tangle_api.generated.models`, define method/property-only mixins plus a `MODEL_EXTENSIONS` mapping, and compose subclasses locally. Avoid global monkey-patching of `tangle_api.generated.models`.
435
400
 
436
- Extension classes should be importable from their modules and should not import generated model classes. They should be mixins over generated data, not replacements for generated schemas.
401
+ Built-in `--model-alias` defaults still keep stable public model names such as `ComponentSpec` even when a backend schema uses names like `ComponentSpecOutput` or `ComponentSpecInput`.
437
402
 
438
403
  ## Extending SDK behavior
439
404
 
@@ -1,9 +1,9 @@
1
1
  """tangle-cli public API.
2
2
 
3
- The package import is intentionally lightweight: native static API bindings live
4
- in ``tangle_api.generated`` and may be supplied by the consumer environment.
5
- Import ``tangle_cli.client.TangleApiClient`` explicitly when those generated
6
- bindings are available.
3
+ The package import is intentionally lightweight: static API bindings live in
4
+ ``tangle_api.generated`` (included by default in public installs, or supplied by
5
+ source/downstream environments). Import ``tangle_cli.client.TangleApiClient``
6
+ explicitly when generated bindings should be loaded.
7
7
  """
8
8
 
9
9
  from importlib.metadata import PackageNotFoundError
@@ -503,7 +503,8 @@ def _schema_for_current_invocation() -> dict[str, Any] | None:
503
503
  raise SystemExit(
504
504
  f"No cached OpenAPI schema for {_normalize_base_url(base_url)}. "
505
505
  "Run `tangle api refresh` with the same --base-url/--auth-header/--header options, "
506
- "or install tangle-cli[native] to use the official static schema."
506
+ "or use a tangle-cli environment with an official or custom tangle-api package "
507
+ "that provides tangle_api.schema."
507
508
  )
508
509
  return cached
509
510
 
@@ -571,9 +572,12 @@ def _api_tail_requests_help(api_tail: list[str]) -> bool:
571
572
 
572
573
  def _missing_official_schema_message() -> str:
573
574
  return (
574
- "Official static Tangle API commands require the native tangle-api "
575
- "package because the bundled OpenAPI snapshot lives in tangle_api.schema. "
576
- "Install tangle-cli[native], or run `tangle api refresh` and use "
575
+ "Official static Tangle API commands require a tangle-api package "
576
+ "because the OpenAPI snapshot lives in tangle_api.schema. Normal "
577
+ "tangle-cli installs include the official package; custom generated "
578
+ "API projects should run with a local src/tangle_api package that "
579
+ "shadows site-packages or install a compatible private tangle-api "
580
+ "distribution. Otherwise run `tangle api refresh` and use "
577
581
  "`--schema-source cache` for cached backend operations."
578
582
  )
579
583
 
@@ -66,8 +66,8 @@ def api_arg_specs(
66
66
  class LazyTangleApiClient:
67
67
  """Instantiate the generated API client only when a command uses it.
68
68
 
69
- Importing CLI modules must stay native-free so local-only commands can run
70
- without the generated ``tangle_api`` package. This proxy delays importing and
69
+ Importing CLI modules must not eagerly load generated bindings, so local-only
70
+ commands can run without importing ``tangle_api``. This proxy delays importing and
71
71
  constructing ``TangleApiClient`` until an API method is actually accessed,
72
72
  while keeping CLI-friendly error wording in the CLI helper layer.
73
73
  """
@@ -85,9 +85,10 @@ class LazyTangleApiClient:
85
85
  except ModuleNotFoundError as exc:
86
86
  if exc.name == "tangle_api":
87
87
  raise SystemExit(
88
- "Native generated Tangle API bindings are required for "
89
- f"{self.command_name}. Install tangle-cli[native] or provide "
90
- "a local tangle_api.generated package."
88
+ "Generated Tangle API bindings are required for "
89
+ f"{self.command_name}. Install the default tangle-cli package "
90
+ "with tangle-api, run from a project where local src/tangle_api "
91
+ "shadows site-packages, or install a compatible custom tangle-api package."
91
92
  ) from exc
92
93
  raise
93
94
 
@@ -97,7 +98,7 @@ class LazyTangleApiClient:
97
98
  return self._client
98
99
 
99
100
  def require_available(self) -> None:
100
- """Materialize the client so CLI commands fail before native helper imports."""
101
+ """Materialize the client so CLI commands fail before helper imports."""
101
102
 
102
103
  self._get_client()
103
104
 
@@ -26,11 +26,13 @@ from .api_transport import (
26
26
  log_http_exchange,
27
27
  tangle_verbose_enabled,
28
28
  )
29
- from tangle_api.generated.models import ComponentSpec, GetExecutionInfoResponse
30
29
  from tangle_api.generated.operations import GeneratedTangleApiOperations
30
+ from . import models as _cli_models
31
31
  from .logger import Logger, _null_logger, get_default_logger
32
32
  from .models import (
33
33
  ComponentInfo,
34
+ ComponentSpec,
35
+ GetExecutionInfoResponse,
34
36
  GraphExecutionState,
35
37
  PipelineRun,
36
38
  RunDetails,
@@ -78,6 +80,11 @@ class TangleApiClient(GeneratedTangleApiOperations):
78
80
  self.session = session or requests.Session()
79
81
  self.include_env_credentials = include_env_credentials
80
82
 
83
+ def _response_model(self, model_name: str, default: Any) -> Any:
84
+ """Use CLI-composed models for generated operation deserialization."""
85
+
86
+ return getattr(_cli_models, model_name, default)
87
+
81
88
  def set_verbose(self, enabled: bool) -> None:
82
89
  """Enable or disable request logging."""
83
90
 
@@ -22,7 +22,7 @@ from .handler import TangleCliHandler
22
22
  from .logger import Logger
23
23
 
24
24
  if TYPE_CHECKING:
25
- from tangle_api.generated.models import ComponentSpec
25
+ from tangle_cli.models import ComponentSpec
26
26
 
27
27
 
28
28
  class ProcessingOutcome(str, Enum):
@@ -171,12 +171,12 @@ class ComponentPublisher(TangleCliHandler):
171
171
  if self.component_spec_model is not None:
172
172
  return self.component_spec_model
173
173
  try:
174
- from tangle_api.generated.models import ComponentSpec
174
+ from tangle_cli.models import ComponentSpec
175
175
  except ModuleNotFoundError as exc:
176
176
  if exc.name == "tangle_api":
177
177
  raise RuntimeError(
178
178
  "Native generated Tangle API bindings are required for component publishing. "
179
- "Install tangle-cli[native] or provide a local tangle_api.generated package."
179
+ "Install the default tangle-cli package with tangle-api, run from a project where local src/tangle_api shadows site-packages, or install a compatible custom tangle-api package."
180
180
  ) from exc
181
181
  raise
182
182
  return ComponentSpec
@@ -64,7 +64,7 @@ class TangleCliHandler:
64
64
  if exc.name == "tangle_api":
65
65
  self.log.error(
66
66
  "❌ Native generated Tangle API bindings are required for Tangle API operations. "
67
- "Install tangle-cli[native] or provide a local tangle_api.generated package."
67
+ "Install the default tangle-cli package with tangle-api, run from a project where local src/tangle_api shadows site-packages, or install a compatible custom tangle-api package."
68
68
  )
69
69
  return None
70
70
  raise
@@ -11,9 +11,56 @@ from __future__ import annotations
11
11
  from dataclasses import asdict, dataclass, field
12
12
  from typing import Any
13
13
 
14
- from tangle_api.generated.models import ComponentSpec, GetExecutionInfoResponse
14
+ from tangle_api.generated import models as _generated_models
15
15
 
16
16
  from .artifacts import ArtifactComponentQuery, ArtifactInfo
17
+ from . import generated_model_extensions as _cli_model_extensions
18
+
19
+
20
+ def extend_model(public_name: str, base: type[Any], *mixins: type[Any]) -> type[Any]:
21
+ """Compose a generated model with downstream mixins in this namespace."""
22
+
23
+ if not mixins:
24
+ return base
25
+ model = type(public_name, (*mixins, base), {"__module__": __name__})
26
+ model_rebuild = getattr(model, "model_rebuild", None)
27
+ if callable(model_rebuild):
28
+ model_rebuild()
29
+ return model
30
+
31
+
32
+ def compose_models(generated_models_module: Any, *extension_modules: Any) -> dict[str, type[Any]]:
33
+ """Return generated models composed with MODEL_EXTENSIONS mappings.
34
+
35
+ Extension modules declare ``MODEL_EXTENSIONS = {"ModelName": "MixinName"}``.
36
+ Composition happens in this downstream namespace and never mutates
37
+ ``tangle_api.generated.models``.
38
+ """
39
+
40
+ composed: dict[str, type[Any]] = {}
41
+ public_names = getattr(generated_models_module, "__all__", None)
42
+ if public_names is None:
43
+ public_names = [
44
+ name
45
+ for name, value in vars(generated_models_module).items()
46
+ if not name.startswith("_") and isinstance(value, type)
47
+ ]
48
+ for public_name in public_names:
49
+ base = getattr(generated_models_module, public_name)
50
+ mixins: list[type[Any]] = []
51
+ for module in extension_modules:
52
+ mapping = getattr(module, "MODEL_EXTENSIONS", {})
53
+ if not isinstance(mapping, dict):
54
+ continue
55
+ mixin_name = mapping.get(public_name)
56
+ if mixin_name:
57
+ mixins.append(getattr(module, mixin_name))
58
+ composed[public_name] = extend_model(public_name, base, *mixins)
59
+ return composed
60
+
61
+
62
+ _COMPOSED_MODELS = compose_models(_generated_models, _cli_model_extensions)
63
+ globals().update(_COMPOSED_MODELS)
17
64
 
18
65
 
19
66
  # ---- Execution / Run dataclasses -------------------------------------------
@@ -296,10 +343,9 @@ class SecretInfo:
296
343
  # ---- Components ------------------------------------------------------------
297
344
 
298
345
 
299
- # ``ComponentSpec`` is generated from OpenAPI and extended in
300
- # ``tangle_cli.generated_model_extensions.ComponentSpecExtensions``. Re-export
301
- # it from this module for compatibility with callers that import domain models
302
- # from ``tangle_cli.models``.
346
+ # ``ComponentSpec`` is generated from OpenAPI and extended at import time in
347
+ # this module. Re-export it for compatibility with callers that import domain
348
+ # models from ``tangle_cli.models``.
303
349
 
304
350
 
305
351
  @dataclass