orchestra-cli 0.0.1__tar.gz → 0.0.3__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.
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orchestra-cli
3
- Version: 0.0.1
4
- Summary: Orchestra CLI
3
+ Version: 0.0.3
4
+ Summary: Orchestra CLI. Perform operations with Orchestra locally.
5
5
  Author-email: Orchestra Technologies <support@getorchestra.io>
6
6
  Requires-Python: >=3.8
7
7
  Description-Content-Type: text/markdown
@@ -15,7 +15,7 @@ Requires-Dist: pytest>=7.0; extra == "dev"
15
15
 
16
16
  A Python-based CLI tool for running Orchestra actions.
17
17
 
18
- ## Usage
18
+ ## Example
19
19
 
20
20
  ```bash
21
21
  orchestra-cli validate example.yaml
@@ -29,9 +29,4 @@ orchestra-cli validate example.yaml
29
29
  ## Building and Releasing
30
30
 
31
31
  - Run `uv build` to build the CLI
32
- - Run `uv publish` to publish the CLI
33
-
34
- ## Troubleshooting
35
-
36
- - If `orchestra-cli` is not found, make sure you have run `uv pip install -e .` and your venv is activated.
37
- - If you get 'No such command', check you are using the correct subcommand (e.g., `validate`).
32
+ - Run `uv publish` to publish the CLI (you will need to pass the `--token` flag)
@@ -2,7 +2,7 @@
2
2
 
3
3
  A Python-based CLI tool for running Orchestra actions.
4
4
 
5
- ## Usage
5
+ ## Example
6
6
 
7
7
  ```bash
8
8
  orchestra-cli validate example.yaml
@@ -16,9 +16,4 @@ orchestra-cli validate example.yaml
16
16
  ## Building and Releasing
17
17
 
18
18
  - Run `uv build` to build the CLI
19
- - Run `uv publish` to publish the CLI
20
-
21
- ## Troubleshooting
22
-
23
- - If `orchestra-cli` is not found, make sure you have run `uv pip install -e .` and your venv is activated.
24
- - If you get 'No such command', check you are using the correct subcommand (e.g., `validate`).
19
+ - Run `uv publish` to publish the CLI (you will need to pass the `--token` flag)
@@ -0,0 +1,109 @@
1
+ import yaml
2
+ import httpx
3
+ import typer
4
+ from pathlib import Path
5
+ from typing import Any, List
6
+
7
+ app = typer.Typer(help="Orchestra CLI – perform operations with Orchestra locally.")
8
+
9
+ API_URL = "https://app.getorchestra.io/api/engine/public/pipelines/schema"
10
+
11
+
12
+ # Colors
13
+ def red(msg):
14
+ return typer.style(msg, fg=typer.colors.RED, bold=True)
15
+
16
+
17
+ def green(msg):
18
+ return typer.style(msg, fg=typer.colors.GREEN, bold=True)
19
+
20
+
21
+ def yellow(msg):
22
+ return typer.style(msg, fg=typer.colors.YELLOW, bold=True)
23
+
24
+
25
+ def bold(msg):
26
+ return typer.style(msg, bold=True)
27
+
28
+
29
+ def indent_message(msg: str, indent: str = " ") -> str:
30
+ return "\n".join(indent + line for line in msg.splitlines())
31
+
32
+
33
+ def get_yaml_snippet(data: Any, loc: List[Any]) -> dict[str, Any]:
34
+ weird_keys = ["TaskGroupModel"]
35
+ try:
36
+ for idx, key in enumerate(loc):
37
+ if key not in weird_keys:
38
+ if key not in data:
39
+ return {loc[idx - 1]: data}
40
+ data = data[key]
41
+ return {loc[-1]: data}
42
+ except Exception:
43
+ return None
44
+
45
+
46
+ @app.command()
47
+ def validate(file: Path = typer.Argument(..., help="YAML file to validate")):
48
+ """
49
+ Validate a YAML file against the API.
50
+ """
51
+ if not file.exists():
52
+ typer.echo(red(f"File not found: {file}"))
53
+ raise typer.Exit(code=1)
54
+
55
+ try:
56
+ with file.open("r") as f:
57
+ data = yaml.safe_load(f)
58
+ except Exception as e:
59
+ typer.echo(red(f"Invalid YAML: {e}"))
60
+ raise typer.Exit(code=1)
61
+
62
+ try:
63
+ response = httpx.post(API_URL, json=data, timeout=10)
64
+ except Exception as e:
65
+ typer.echo(red(f"HTTP request failed: {e}"))
66
+ raise typer.Exit(code=1)
67
+
68
+ if response.status_code == 200:
69
+ typer.echo(green("✅ Validation passed!"))
70
+ raise typer.Exit(code=0)
71
+ else:
72
+ typer.echo(red(f"❌ Validation failed with status {response.status_code}\n"))
73
+ try:
74
+ errors = response.json()
75
+ details = errors.get("detail")
76
+ if details and isinstance(details, list):
77
+ for err in details:
78
+ loc = err.get("loc", [])
79
+ msg = err.get("msg", "Unknown error")
80
+ typer.echo(
81
+ bold(yellow(f"Error at: {'.'.join(str(x) for x in loc)}"))
82
+ )
83
+ typer.echo(red(indent_message(msg)))
84
+ snippet = get_yaml_snippet(data, loc)
85
+ if snippet is not None:
86
+ typer.echo(bold("\nYAML snippet:"))
87
+ typer.echo(
88
+ yaml.dump(
89
+ snippet, sort_keys=False, default_flow_style=False
90
+ )
91
+ )
92
+ else:
93
+ typer.echo(
94
+ yellow("(Could not locate this path in your YAML)")
95
+ )
96
+ else:
97
+ typer.echo(errors)
98
+ except Exception:
99
+ typer.echo(response.text)
100
+ raise typer.Exit(code=1)
101
+
102
+
103
+ @app.command()
104
+ def upload():
105
+ """
106
+ Upload a YAML file to the API. (Not supported yet)
107
+ """
108
+ typer.echo(red("Action not supported yet"))
109
+ raise typer.Exit(code=1)
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orchestra-cli
3
- Version: 0.0.1
4
- Summary: Orchestra CLI
3
+ Version: 0.0.3
4
+ Summary: Orchestra CLI. Perform operations with Orchestra locally.
5
5
  Author-email: Orchestra Technologies <support@getorchestra.io>
6
6
  Requires-Python: >=3.8
7
7
  Description-Content-Type: text/markdown
@@ -15,7 +15,7 @@ Requires-Dist: pytest>=7.0; extra == "dev"
15
15
 
16
16
  A Python-based CLI tool for running Orchestra actions.
17
17
 
18
- ## Usage
18
+ ## Example
19
19
 
20
20
  ```bash
21
21
  orchestra-cli validate example.yaml
@@ -29,9 +29,4 @@ orchestra-cli validate example.yaml
29
29
  ## Building and Releasing
30
30
 
31
31
  - Run `uv build` to build the CLI
32
- - Run `uv publish` to publish the CLI
33
-
34
- ## Troubleshooting
35
-
36
- - If `orchestra-cli` is not found, make sure you have run `uv pip install -e .` and your venv is activated.
37
- - If you get 'No such command', check you are using the correct subcommand (e.g., `validate`).
32
+ - Run `uv publish` to publish the CLI (you will need to pass the `--token` flag)
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "orchestra-cli"
3
- version = "0.0.1"
4
- description = "Orchestra CLI"
3
+ version = "0.0.3"
4
+ description = "Orchestra CLI. Perform operations with Orchestra locally."
5
5
  readme = "README.md"
6
6
  authors = [
7
7
  { name = "Orchestra Technologies", email = "support@getorchestra.io" },
@@ -1,61 +0,0 @@
1
- import yaml
2
- import httpx
3
- import typer
4
- from pathlib import Path
5
-
6
- app = typer.Typer(help="Orchestra CLI – perform operations with Orchestra locally.")
7
-
8
- API_URL = "https://httpstat.us/200" # Replace with your real endpoint
9
-
10
-
11
- # Colors
12
- def red(msg):
13
- return typer.style(msg, fg=typer.colors.RED, bold=True)
14
-
15
-
16
- def green(msg):
17
- return typer.style(msg, fg=typer.colors.GREEN, bold=True)
18
-
19
-
20
- @app.command()
21
- def validate(file: Path = typer.Argument(..., help="YAML file to validate")):
22
- """
23
- Validate a YAML file against the API.
24
- """
25
- if not file.exists():
26
- typer.echo(red(f"File not found: {file}"))
27
- raise typer.Exit(code=1)
28
-
29
- try:
30
- with file.open("r") as f:
31
- data = yaml.safe_load(f)
32
- except Exception as e:
33
- typer.echo(red(f"Invalid YAML: {e}"))
34
- raise typer.Exit(code=1)
35
-
36
- try:
37
- response = httpx.post(API_URL, json=data, timeout=10)
38
- except Exception as e:
39
- typer.echo(red(f"HTTP request failed: {e}"))
40
- raise typer.Exit(code=1)
41
-
42
- if response.status_code == 200:
43
- typer.echo(green("✅ Validation passed!"))
44
- raise typer.Exit(code=0)
45
- else:
46
- typer.echo(red(f"❌ Validation failed with status {response.status_code}"))
47
- try:
48
- errors = response.json()
49
- typer.echo(yaml.dump(errors, sort_keys=False))
50
- except Exception:
51
- typer.echo(response.text)
52
- raise typer.Exit(code=1)
53
-
54
-
55
- @app.command()
56
- def upload(file: Path = typer.Argument(..., help="YAML file to upload")):
57
- """
58
- Upload a YAML file to the API. (Not supported yet)
59
- """
60
- typer.echo(red("Action not supported yet"))
61
- raise typer.Exit(code=1)
File without changes