deepctl-cmd-projects 0.1.12__tar.gz → 0.2.1__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-projects
3
- Version: 0.1.12
3
+ Version: 0.2.1
4
4
  Summary: Projects command for deepctl
5
5
  Author-email: Deepgram <devrel@deepgram.com>
6
6
  Maintainer-email: Deepgram <devrel@deepgram.com>
@@ -14,10 +14,10 @@ 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
- Requires-Dist: deepgram-sdk>=7.5.0
20
+ Requires-Dist: deepgram-sdk<8,>=7.7.0
21
21
  Requires-Dist: pydantic>=2.0.0
22
22
 
23
23
  # deepctl-cmd-projects
@@ -57,7 +57,7 @@ pipx run deepctl --help
57
57
 
58
58
  - `click>=8.0.0`
59
59
  - `rich>=13.0.0`
60
- - `deepgram-sdk>=6.0.0rc2`
60
+ - `deepgram-sdk>=7.7.0,<8`
61
61
  - `pydantic>=2.0.0`
62
62
 
63
63
  ## License
@@ -35,7 +35,7 @@ pipx run deepctl --help
35
35
 
36
36
  - `click>=8.0.0`
37
37
  - `rich>=13.0.0`
38
- - `deepgram-sdk>=6.0.0rc2`
38
+ - `deepgram-sdk>=7.7.0,<8`
39
39
  - `pydantic>=2.0.0`
40
40
 
41
41
  ## License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "deepctl-cmd-projects"
7
- version = "0.1.12" # x-release-please-version
7
+ version = "0.2.1" # x-release-please-version
8
8
  description = "Projects command for deepctl"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -21,10 +21,10 @@ classifiers = [
21
21
  keywords = ["deepgram", "cli", "projects", "management"]
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
- "deepgram-sdk>=7.5.0",
27
+ "deepgram-sdk>=7.7.0,<8",
28
28
  "pydantic>=2.0.0",
29
29
  ]
30
30
 
@@ -8,12 +8,17 @@ from deepctl_core import (
8
8
  BaseResult,
9
9
  Config,
10
10
  DeepgramClient,
11
+ get_output_format,
12
+ get_status_console,
11
13
  )
12
14
  from rich.console import Console
13
15
 
14
16
  from .models import ProjectInfo, ProjectsResult
15
17
 
16
18
  console = Console()
19
+ # Status/progress chrome must never touch stdout, or it corrupts JSON/CSV
20
+ # output that callers pipe into jq and friends.
21
+ status_console = get_status_console()
17
22
 
18
23
 
19
24
  class ProjectsCommand(BaseCommand):
@@ -110,12 +115,12 @@ class ProjectsCommand(BaseCommand):
110
115
  return self._list_projects(client)
111
116
 
112
117
  except Exception as e:
113
- console.print(f"[red]Error:[/red] {e}")
118
+ status_console.print(f"[red]Error:[/red] {e}")
114
119
  return BaseResult(status="error", message=str(e))
115
120
 
116
121
  def _list_projects(self, client: DeepgramClient) -> ProjectsResult | BaseResult:
117
122
  """List all projects."""
118
- console.print("[blue]Fetching projects...[/blue]")
123
+ status_console.print("[blue]Fetching projects...[/blue]")
119
124
 
120
125
  try:
121
126
  result = client.get_projects()
@@ -134,7 +139,7 @@ class ProjectsCommand(BaseCommand):
134
139
  projects_raw = result.get("projects", [])
135
140
 
136
141
  if not projects_raw:
137
- console.print("[yellow]No projects found[/yellow]")
142
+ status_console.print("[yellow]No projects found[/yellow]")
138
143
  return ProjectsResult(
139
144
  status="info",
140
145
  message="No projects found",
@@ -143,8 +148,6 @@ class ProjectsCommand(BaseCommand):
143
148
  )
144
149
 
145
150
  project_models: list[ProjectInfo] = []
146
- console.print(f"[green]Found {len(projects_raw)} project(s):[/green]")
147
-
148
151
  for proj in projects_raw:
149
152
  # Handle project objects that might not be dicts
150
153
  project_data = proj
@@ -162,10 +165,16 @@ class ProjectsCommand(BaseCommand):
162
165
  )
163
166
  project_models.append(info)
164
167
 
165
- console.print(f" • {info.name}")
166
- console.print(f" ID: {info.project_id}")
167
- console.print(f" Company: {info.company or 'N/A'}")
168
- console.print()
168
+ # Human list only in default mode; json/yaml/csv are emitted by the
169
+ # framework from the returned result, so printing here would prepend
170
+ # non-parseable text to that output.
171
+ if get_output_format() == "default":
172
+ console.print(f"[green]Found {len(project_models)} project(s):[/green]")
173
+ for info in project_models:
174
+ console.print(f" • {info.name}")
175
+ console.print(f" ID: {info.project_id}")
176
+ console.print(f" Company: {info.company or 'N/A'}")
177
+ console.print()
169
178
 
170
179
  return ProjectsResult(
171
180
  status="success",
@@ -174,17 +183,17 @@ class ProjectsCommand(BaseCommand):
174
183
  )
175
184
 
176
185
  except Exception as e:
177
- console.print(f"[red]Failed to list projects:[/red] {e}")
186
+ status_console.print(f"[red]Failed to list projects:[/red] {e}")
178
187
  return BaseResult(status="error", message=str(e))
179
188
 
180
189
  def _create_project(
181
190
  self, client: DeepgramClient, name: str, company: str | None
182
191
  ) -> ProjectsResult | BaseResult:
183
192
  """Create a new project."""
184
- console.print(f"[blue]Creating project:[/blue] {name}")
193
+ status_console.print(f"[blue]Creating project:[/blue] {name}")
185
194
 
186
195
  if company:
187
- console.print(f"[dim]Company:[/dim] {company}")
196
+ status_console.print(f"[dim]Company:[/dim] {company}")
188
197
 
189
198
  try:
190
199
  result = client.create_project(name, company)
@@ -200,8 +209,8 @@ class ProjectsCommand(BaseCommand):
200
209
 
201
210
  if isinstance(result_dict, dict) and "project_id" in result_dict:
202
211
  project_id = result_dict["project_id"]
203
- console.print("[green]✓[/green] Project created successfully")
204
- console.print(f"[dim]Project ID:[/dim] {project_id}")
212
+ status_console.print("[green]✓[/green] Project created successfully")
213
+ status_console.print(f"[dim]Project ID:[/dim] {project_id}")
205
214
 
206
215
  proj = ProjectInfo(project_id=project_id, name=name, company=company)
207
216
  return ProjectsResult(
@@ -211,7 +220,7 @@ class ProjectsCommand(BaseCommand):
211
220
  count=1,
212
221
  )
213
222
  else:
214
- console.print(
223
+ status_console.print(
215
224
  "[yellow]Project creation response missing project_id[/yellow]"
216
225
  )
217
226
  return ProjectsResult(
@@ -222,14 +231,14 @@ class ProjectsCommand(BaseCommand):
222
231
  )
223
232
 
224
233
  except Exception as e:
225
- console.print(f"[red]Failed to create project:[/red] {e}")
234
+ status_console.print(f"[red]Failed to create project:[/red] {e}")
226
235
  return BaseResult(status="error", message=str(e))
227
236
 
228
237
  def _show_project(
229
238
  self, client: DeepgramClient, project_id: str
230
239
  ) -> ProjectsResult | BaseResult:
231
240
  """Show details for a specific project."""
232
- console.print(f"[blue]Fetching project details:[/blue] {project_id}")
241
+ status_console.print(f"[blue]Fetching project details:[/blue] {project_id}")
233
242
 
234
243
  try:
235
244
  result = client.get_project(project_id)
@@ -247,15 +256,16 @@ class ProjectsCommand(BaseCommand):
247
256
  name = result_dict.get("name", "N/A")
248
257
  company = result_dict.get("company", "N/A")
249
258
 
250
- console.print("[green]Project Details:[/green]")
251
- console.print(f" Name: {name}")
252
- console.print(f" ID: {project_id}")
253
- console.print(f" Company: {company}")
259
+ if get_output_format() == "default":
260
+ console.print("[green]Project Details:[/green]")
261
+ console.print(f" Name: {name}")
262
+ console.print(f" ID: {project_id}")
263
+ console.print(f" Company: {company}")
254
264
 
255
265
  proj = ProjectInfo(project_id=project_id, name=name, company=company)
256
266
  return ProjectsResult(status="success", projects=[proj], count=1)
257
267
  else:
258
- console.print("[yellow]Project details incomplete[/yellow]")
268
+ status_console.print("[yellow]Project details incomplete[/yellow]")
259
269
  # Still try to create a project info with what we have
260
270
  name = (
261
271
  result_dict.get("name", "Unknown")
@@ -276,7 +286,7 @@ class ProjectsCommand(BaseCommand):
276
286
  )
277
287
 
278
288
  except Exception as e:
279
- console.print(f"[red]Failed to get project details:[/red] {e}")
289
+ status_console.print(f"[red]Failed to get project details:[/red] {e}")
280
290
  return BaseResult(status="error", message=str(e))
281
291
 
282
292
  def _show_current_project(
@@ -286,48 +296,44 @@ class ProjectsCommand(BaseCommand):
286
296
  project_id = auth_manager.get_project_id()
287
297
 
288
298
  if not project_id:
289
- console.print("[yellow]No current project set[/yellow]")
290
- console.print(
299
+ status_console.print("[yellow]No current project set[/yellow]")
300
+ status_console.print(
291
301
  "Set a project ID with: deepctl login --project-id <project_id>"
292
302
  )
293
- console.print("Or use environment variable: DEEPGRAM_PROJECT_ID")
303
+ status_console.print("Or use environment variable: DEEPGRAM_PROJECT_ID")
294
304
  return BaseResult(status="info", message="No current project set")
295
305
 
296
- console.print(f"[blue]Current project ID:[/blue] {project_id}")
306
+ status_console.print(f"[blue]Current project ID:[/blue] {project_id}")
297
307
  return self._show_project(client, project_id)
298
308
 
299
309
  def _set_default_project(
300
310
  self, config: Config, auth_manager: AuthManager, project_id: str
301
311
  ) -> BaseResult:
302
312
  """Set default project ID."""
303
- console.print(f"[blue]Setting default project:[/blue] {project_id}")
313
+ status_console.print(f"[blue]Setting default project:[/blue] {project_id}")
304
314
 
305
315
  try:
306
316
  # Update current profile
307
317
  profile_name = config.profile or "default"
308
- current_profile = config.get_profile(profile_name)
309
318
 
310
319
  # Test if project exists by trying to get it
311
320
  client = DeepgramClient(config, auth_manager)
312
321
  try:
313
322
  client.get_project(project_id)
314
- console.print("[green]✓[/green] Project ID validated")
323
+ status_console.print("[green]✓[/green] Project ID validated")
315
324
  except Exception as e:
316
- console.print(
325
+ status_console.print(
317
326
  f"[yellow]Warning:[/yellow] Could not validate project: {e}"
318
327
  )
319
328
  if not self.confirm("Continue anyway?", default=False):
320
329
  return BaseResult(status="cancelled", message="Cancelled by user")
321
330
 
322
- # Update profile
323
- config.create_profile(
324
- profile_name,
325
- api_key=current_profile.api_key,
326
- project_id=project_id,
327
- base_url=current_profile.base_url,
328
- )
331
+ # Update only the project ID of the profile
332
+ config.update_profile(profile_name, project_id=project_id)
329
333
 
330
- console.print(f"[green]✓[/green] Default project set to: {project_id}")
334
+ status_console.print(
335
+ f"[green]✓[/green] Default project set to: {project_id}"
336
+ )
331
337
 
332
338
  return BaseResult(
333
339
  status="success",
@@ -335,5 +341,8 @@ class ProjectsCommand(BaseCommand):
335
341
  )
336
342
 
337
343
  except Exception as e:
338
- console.print(f"[red]Failed to set default project:[/red] {e}")
344
+ status_console.print(f"[red]Failed to set default project:[/red] {e}")
345
+ from deepctl_core.output import print_error_hint
346
+
347
+ print_error_hint(e)
339
348
  return BaseResult(status="error", message=str(e))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepctl-cmd-projects
3
- Version: 0.1.12
3
+ Version: 0.2.1
4
4
  Summary: Projects command for deepctl
5
5
  Author-email: Deepgram <devrel@deepgram.com>
6
6
  Maintainer-email: Deepgram <devrel@deepgram.com>
@@ -14,10 +14,10 @@ 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
- Requires-Dist: deepgram-sdk>=7.5.0
20
+ Requires-Dist: deepgram-sdk<8,>=7.7.0
21
21
  Requires-Dist: pydantic>=2.0.0
22
22
 
23
23
  # deepctl-cmd-projects
@@ -57,7 +57,7 @@ pipx run deepctl --help
57
57
 
58
58
  - `click>=8.0.0`
59
59
  - `rich>=13.0.0`
60
- - `deepgram-sdk>=6.0.0rc2`
60
+ - `deepgram-sdk>=7.7.0,<8`
61
61
  - `pydantic>=2.0.0`
62
62
 
63
63
  ## License
@@ -0,0 +1,5 @@
1
+ deepctl-core>=0.2.16
2
+ click>=8.0.0
3
+ rich>=13.0.0
4
+ deepgram-sdk<8,>=7.7.0
5
+ pydantic>=2.0.0
@@ -1,5 +0,0 @@
1
- deepctl-core>=0.1.10
2
- click>=8.0.0
3
- rich>=13.0.0
4
- deepgram-sdk>=7.5.0
5
- pydantic>=2.0.0