deepctl-cmd-models 0.0.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepctl-cmd-models
3
- Version: 0.0.2
3
+ Version: 0.1.0
4
4
  Summary: Models command for deepctl
5
5
  Author-email: Deepgram <devrel@deepgram.com>
6
6
  Maintainer-email: Deepgram <devrel@deepgram.com>
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
15
  Requires-Python: >=3.10
16
16
  Description-Content-Type: text/markdown
17
- Requires-Dist: deepctl-core>=0.1.10
17
+ Requires-Dist: deepctl-core>=0.2.16
18
18
  Requires-Dist: click>=8.0.0
19
19
  Requires-Dist: rich>=13.0.0
20
20
  Requires-Dist: pydantic>=2.0.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "deepctl-cmd-models"
7
- version = "0.0.2" # x-release-please-version
7
+ version = "0.1.0" # x-release-please-version
8
8
  description = "Models command for deepctl"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -21,7 +21,7 @@ classifiers = [
21
21
  keywords = ["deepgram", "cli", "models"]
22
22
  requires-python = ">=3.10"
23
23
  dependencies = [
24
- "deepctl-core>=0.1.10",
24
+ "deepctl-core>=0.2.16",
25
25
  "click>=8.0.0",
26
26
  "rich>=13.0.0",
27
27
  "pydantic>=2.0.0",
@@ -10,6 +10,8 @@ from deepctl_core import (
10
10
  BaseResult,
11
11
  Config,
12
12
  DeepgramClient,
13
+ get_output_format,
14
+ get_status_console,
13
15
  )
14
16
  from rich.console import Console
15
17
  from rich.table import Table
@@ -17,6 +19,9 @@ from rich.table import Table
17
19
  from .models import ModelInfo, ModelsResult
18
20
 
19
21
  console = Console()
22
+ # Status/progress chrome must never touch stdout, or it corrupts JSON/CSV
23
+ # output that callers pipe into jq and friends.
24
+ status_console = get_status_console()
20
25
 
21
26
 
22
27
  class ModelsCommand(BaseCommand):
@@ -101,26 +106,29 @@ class ModelsCommand(BaseCommand):
101
106
  )
102
107
 
103
108
  if not all_models:
104
- console.print("[yellow]No models found[/yellow]")
109
+ status_console.print("[yellow]No models found[/yellow]")
105
110
  return ModelsResult(status="info", message="No models found")
106
111
 
107
- # Display as table
108
- table = Table(
109
- title="Deepgram Models", show_header=True, header_style="bold blue"
110
- )
111
- table.add_column("Name", style="green")
112
- table.add_column("Type", style="cyan")
113
- table.add_column("Language")
114
- table.add_column("Version")
115
- table.add_column("ID", style="dim")
116
-
117
- for m in all_models:
118
- table.add_row(
119
- m.name, m.model_type.upper(), m.language, m.version, m.model_id
112
+ # Render the human table only in default mode. For json/yaml/csv
113
+ # the framework serialises the returned result to stdout, so
114
+ # printing the table here would corrupt that output for piping.
115
+ if get_output_format() == "default":
116
+ table = Table(
117
+ title="Deepgram Models", show_header=True, header_style="bold blue"
120
118
  )
119
+ table.add_column("Name", style="green")
120
+ table.add_column("Type", style="cyan")
121
+ table.add_column("Language")
122
+ table.add_column("Version")
123
+ table.add_column("ID", style="dim")
124
+
125
+ for m in all_models:
126
+ table.add_row(
127
+ m.name, m.model_type.upper(), m.language, m.version, m.model_id
128
+ )
121
129
 
122
- console.print(table)
123
- console.print(f"\n[dim]{len(all_models)} model(s) found[/dim]")
130
+ console.print(table)
131
+ console.print(f"\n[dim]{len(all_models)} model(s) found[/dim]")
124
132
 
125
133
  return ModelsResult(
126
134
  status="success",
@@ -129,5 +137,5 @@ class ModelsCommand(BaseCommand):
129
137
  )
130
138
 
131
139
  except Exception as e:
132
- console.print(f"[red]Error listing models:[/red] {e}")
140
+ status_console.print(f"[red]Error listing models:[/red] {e}")
133
141
  return BaseResult(status="error", message=str(e))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepctl-cmd-models
3
- Version: 0.0.2
3
+ Version: 0.1.0
4
4
  Summary: Models command for deepctl
5
5
  Author-email: Deepgram <devrel@deepgram.com>
6
6
  Maintainer-email: Deepgram <devrel@deepgram.com>
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
15
  Requires-Python: >=3.10
16
16
  Description-Content-Type: text/markdown
17
- Requires-Dist: deepctl-core>=0.1.10
17
+ Requires-Dist: deepctl-core>=0.2.16
18
18
  Requires-Dist: click>=8.0.0
19
19
  Requires-Dist: rich>=13.0.0
20
20
  Requires-Dist: pydantic>=2.0.0
@@ -1,4 +1,4 @@
1
- deepctl-core>=0.1.10
1
+ deepctl-core>=0.2.16
2
2
  click>=8.0.0
3
3
  rich>=13.0.0
4
4
  pydantic>=2.0.0