deepctl-shared-utils 0.1.11__tar.gz → 0.1.13__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 (16) hide show
  1. {deepctl_shared_utils-0.1.11 → deepctl_shared_utils-0.1.13}/PKG-INFO +1 -1
  2. {deepctl_shared_utils-0.1.11 → deepctl_shared_utils-0.1.13}/pyproject.toml +1 -1
  3. {deepctl_shared_utils-0.1.11 → deepctl_shared_utils-0.1.13}/src/deepctl_shared_utils/__init__.py +1 -1
  4. deepctl_shared_utils-0.1.13/src/deepctl_shared_utils/diagnostics.py +52 -0
  5. {deepctl_shared_utils-0.1.11 → deepctl_shared_utils-0.1.13}/src/deepctl_shared_utils/ffprobe.py +7 -2
  6. {deepctl_shared_utils-0.1.11 → deepctl_shared_utils-0.1.13}/src/deepctl_shared_utils/validation.py +7 -2
  7. {deepctl_shared_utils-0.1.11 → deepctl_shared_utils-0.1.13}/src/deepctl_shared_utils.egg-info/PKG-INFO +1 -1
  8. {deepctl_shared_utils-0.1.11 → deepctl_shared_utils-0.1.13}/src/deepctl_shared_utils.egg-info/SOURCES.txt +1 -0
  9. {deepctl_shared_utils-0.1.11 → deepctl_shared_utils-0.1.13}/README.md +0 -0
  10. {deepctl_shared_utils-0.1.11 → deepctl_shared_utils-0.1.13}/setup.cfg +0 -0
  11. {deepctl_shared_utils-0.1.11 → deepctl_shared_utils-0.1.13}/src/deepctl_shared_utils/ffprobe_models.py +0 -0
  12. {deepctl_shared_utils-0.1.11 → deepctl_shared_utils-0.1.13}/src/deepctl_shared_utils/models.py +0 -0
  13. {deepctl_shared_utils-0.1.11 → deepctl_shared_utils-0.1.13}/src/deepctl_shared_utils/py.typed +0 -0
  14. {deepctl_shared_utils-0.1.11 → deepctl_shared_utils-0.1.13}/src/deepctl_shared_utils.egg-info/dependency_links.txt +0 -0
  15. {deepctl_shared_utils-0.1.11 → deepctl_shared_utils-0.1.13}/src/deepctl_shared_utils.egg-info/requires.txt +0 -0
  16. {deepctl_shared_utils-0.1.11 → deepctl_shared_utils-0.1.13}/src/deepctl_shared_utils.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepctl-shared-utils
3
- Version: 0.1.11
3
+ Version: 0.1.13
4
4
  Summary: Shared utilities for deepctl
5
5
  Author-email: Deepgram <devrel@deepgram.com>
6
6
  Maintainer-email: Deepgram <devrel@deepgram.com>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "deepctl-shared-utils"
7
- version = "0.1.11" # x-release-please-version
7
+ version = "0.1.13" # x-release-please-version
8
8
  description = "Shared utilities for deepctl"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -28,4 +28,4 @@ __all__ = [
28
28
  "validate_url",
29
29
  ]
30
30
 
31
- __version__ = "0.1.11" # x-release-please-version
31
+ __version__ = "0.1.13" # x-release-please-version
@@ -0,0 +1,52 @@
1
+ """Plain-text diagnostic output shared by utilities outside deepctl-core."""
2
+
3
+ import os
4
+ import sys
5
+ from typing import TextIO
6
+
7
+ from rich.console import Console
8
+
9
+
10
+ def is_non_interactive() -> bool:
11
+ """Mirror deepctl-core's agent and non-interactive output policy.
12
+
13
+ Shared utilities intentionally do not depend on deepctl-core, so keep this
14
+ lightweight detection aligned with ``deepctl_core.output.is_agentic``.
15
+ """
16
+ env = os.environ
17
+
18
+ if "--non-interactive" in sys.argv or "--agent-friendly" in sys.argv:
19
+ return True
20
+ if env.get("CI") in ("true", "1"):
21
+ return True
22
+ if env.get("CLAUDECODE") or env.get("CLAUDE_CODE_ENTRYPOINT"):
23
+ return True
24
+ if env.get("CODEX_SANDBOX") or env.get("CODEX_SANDBOX_NETWORK_DISABLED"):
25
+ return True
26
+ if env.get("OR_APP_NAME") == "Aider" or "aider" in env.get("OR_SITE_URL", ""):
27
+ return True
28
+
29
+ score = 0
30
+ if not sys.stdin.isatty():
31
+ score += 1
32
+ if not sys.stdout.isatty():
33
+ score += 1
34
+ if not env.get("TERM") or env.get("TERM") == "dumb":
35
+ score += 1
36
+ if "NO_COLOR" in env:
37
+ score += 1
38
+
39
+ return score >= 3
40
+
41
+
42
+ def create_diagnostic_console(
43
+ *, file: TextIO | None = None, force_terminal: bool | None = None
44
+ ) -> Console:
45
+ """Create a stderr diagnostic console with the shared plain-text policy."""
46
+ non_interactive = is_non_interactive()
47
+ return Console(
48
+ file=file or sys.stderr,
49
+ force_terminal=force_terminal,
50
+ no_color=non_interactive,
51
+ highlight=not non_interactive,
52
+ )
@@ -10,15 +10,20 @@ import subprocess
10
10
  import tempfile
11
11
  from typing import TYPE_CHECKING
12
12
 
13
- from rich.console import Console
14
13
  from rich.panel import Panel
15
14
 
15
+ from .diagnostics import create_diagnostic_console
16
16
  from .ffprobe_models import AudioFormatInfo, AudioProbeResult, AudioStreamInfo
17
17
 
18
18
  if TYPE_CHECKING:
19
19
  from deepctl_core import Config
20
20
 
21
- console = Console()
21
+ # Diagnostics only: every console.print below is an error, a warning or a
22
+ # progress line -- never a payload -- so it goes to stderr and can never
23
+ # corrupt the machine-readable result a command writes to stdout (#104).
24
+ # deepctl-shared-utils does not depend on deepctl-core, so this local factory
25
+ # mirrors core's agentic/no-color policy instead of importing `stderr_console`.
26
+ console = create_diagnostic_console()
22
27
 
23
28
 
24
29
  def get_ffprobe_path(config: Config | None = None) -> str | None:
@@ -6,11 +6,16 @@ from pathlib import Path
6
6
  from urllib.parse import urlparse
7
7
 
8
8
  import httpx
9
- from rich.console import Console
10
9
 
10
+ from .diagnostics import create_diagnostic_console
11
11
  from .models import FileInfo
12
12
 
13
- console = Console()
13
+ # Diagnostics only: every console.print below is an error, a warning or a
14
+ # progress line -- never a payload -- so it goes to stderr and can never
15
+ # corrupt the machine-readable result a command writes to stdout (#104).
16
+ # deepctl-shared-utils does not depend on deepctl-core, so this local factory
17
+ # mirrors core's agentic/no-color policy instead of importing `stderr_console`.
18
+ console = create_diagnostic_console()
14
19
 
15
20
  # Supported audio file extensions
16
21
  SUPPORTED_AUDIO_EXTENSIONS = {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: deepctl-shared-utils
3
- Version: 0.1.11
3
+ Version: 0.1.13
4
4
  Summary: Shared utilities for deepctl
5
5
  Author-email: Deepgram <devrel@deepgram.com>
6
6
  Maintainer-email: Deepgram <devrel@deepgram.com>
@@ -1,6 +1,7 @@
1
1
  README.md
2
2
  pyproject.toml
3
3
  src/deepctl_shared_utils/__init__.py
4
+ src/deepctl_shared_utils/diagnostics.py
4
5
  src/deepctl_shared_utils/ffprobe.py
5
6
  src/deepctl_shared_utils/ffprobe_models.py
6
7
  src/deepctl_shared_utils/models.py