shotgun-sh 0.1.0.dev8__py3-none-any.whl → 0.1.0.dev10__py3-none-any.whl

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.
shotgun/logging_config.py CHANGED
@@ -6,6 +6,8 @@ import os
6
6
  import sys
7
7
  from pathlib import Path
8
8
 
9
+ from shotgun.utils.env_utils import is_truthy
10
+
9
11
 
10
12
  def get_log_directory() -> Path:
11
13
  """Get the log directory path, creating it if necessary.
@@ -78,8 +80,24 @@ def setup_logger(
78
80
  if format_string is None:
79
81
  format_string = "%(asctime)s | %(levelname)-8s | %(name)s | %(message)s"
80
82
 
83
+ # Check if this is a dev build with Logfire enabled
84
+ is_logfire_dev_build = False
85
+ try:
86
+ from shotgun.build_constants import IS_DEV_BUILD, LOGFIRE_ENABLED
87
+
88
+ if IS_DEV_BUILD and is_truthy(LOGFIRE_ENABLED):
89
+ is_logfire_dev_build = True
90
+ # This debug message will only appear in file logs
91
+ logger.debug("Console logging disabled for Logfire dev build")
92
+ except ImportError:
93
+ # No build constants available (local development)
94
+ pass
95
+
81
96
  # Check if console logging is enabled (default: off)
82
- console_logging_enabled = os.getenv("LOGGING_TO_CONSOLE", "false").lower() == "true"
97
+ # Force console logging OFF if Logfire is enabled in dev build
98
+ console_logging_enabled = (
99
+ is_truthy(os.getenv("LOGGING_TO_CONSOLE", "false")) and not is_logfire_dev_build
100
+ )
83
101
 
84
102
  if console_logging_enabled:
85
103
  # Create console handler
@@ -94,7 +112,7 @@ def setup_logger(
94
112
  logger.addHandler(console_handler)
95
113
 
96
114
  # Check if file logging is enabled (default: on)
97
- file_logging_enabled = os.getenv("LOGGING_TO_FILE", "true").lower() == "true"
115
+ file_logging_enabled = is_truthy(os.getenv("LOGGING_TO_FILE", "true"))
98
116
 
99
117
  if file_logging_enabled:
100
118
  try:
shotgun/telemetry.py CHANGED
@@ -3,6 +3,8 @@
3
3
  import logging
4
4
  import os
5
5
 
6
+ from shotgun.utils.env_utils import is_falsy, is_truthy
7
+
6
8
  logger = logging.getLogger(__name__)
7
9
 
8
10
 
@@ -36,11 +38,11 @@ def setup_logfire_observability() -> bool:
36
38
 
37
39
  # Allow environment variable to override and disable Logfire
38
40
  env_override = os.getenv("LOGFIRE_ENABLED")
39
- if env_override and env_override.lower() in ("false", "0", "no"):
41
+ if env_override and is_falsy(env_override):
40
42
  logfire_enabled = env_override
41
43
 
42
44
  # Check if Logfire observability is enabled
43
- if logfire_enabled.lower() not in ("true", "1", "yes"):
45
+ if not is_truthy(logfire_enabled):
44
46
  logger.debug("Logfire observability disabled via LOGFIRE_ENABLED")
45
47
  return False
46
48
 
@@ -0,0 +1,35 @@
1
+ """Utilities for working with environment variables."""
2
+
3
+
4
+ def is_truthy(value: str | None) -> bool:
5
+ """Check if a string value represents true.
6
+
7
+ Args:
8
+ value: String value to check (e.g., from environment variable)
9
+
10
+ Returns:
11
+ True if value is "true", "1", or "yes" (case-insensitive)
12
+ False otherwise (including None, empty string, or any other value)
13
+ """
14
+ if not value:
15
+ return False
16
+ return value.lower() in ("true", "1", "yes")
17
+
18
+
19
+ def is_falsy(value: str | None) -> bool:
20
+ """Check if a string value explicitly represents false.
21
+
22
+ Args:
23
+ value: String value to check (e.g., from environment variable)
24
+
25
+ Returns:
26
+ True if value is "false", "0", or "no" (case-insensitive)
27
+ False otherwise (including None, empty string, or any other value)
28
+
29
+ Note:
30
+ This is NOT the opposite of is_truthy(). A value can be neither
31
+ truthy nor falsy (e.g., None, "", "maybe", etc.)
32
+ """
33
+ if not value:
34
+ return False
35
+ return value.lower() in ("false", "0", "no")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shotgun-sh
3
- Version: 0.1.0.dev8
3
+ Version: 0.1.0.dev10
4
4
  Summary: AI-powered research, planning, and task management CLI tool
5
5
  Project-URL: Homepage, https://shotgun.sh/
6
6
  Project-URL: Repository, https://github.com/shotgun-sh/shotgun
@@ -1,11 +1,11 @@
1
1
  shotgun/__init__.py,sha256=P40K0fnIsb7SKcQrFnXZ4aREjpWchVDhvM1HxI4cyIQ,104
2
2
  shotgun/build_constants.py,sha256=RXNxMz46HaB5jucgMVpw8a2yCJqjbhTOh0PddyEVMN8,713
3
- shotgun/logging_config.py,sha256=EJL2kpwH8-zRtpKit3_BbpeUxbRR-wen3MaNXuHCoD4,5600
3
+ shotgun/logging_config.py,sha256=3fZy0_MSNXNtkmy_Wwpu_VCu7NUR1yt0OZ4uy-vXeA8,6249
4
4
  shotgun/main.py,sha256=7gXkTNmwqW2phBnENn76bUyh5Qm68Iq7NBf3GnWG6J0,4618
5
5
  shotgun/posthog_telemetry.py,sha256=7drAXtedvZmpPqq4_9dI19kJ_xEHGk7XKXQk797QvCM,4954
6
6
  shotgun/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  shotgun/sentry_telemetry.py,sha256=3r9on0GQposn9aX6Dkb9mrfaVQl_dIZzhu9BjE838AU,2854
8
- shotgun/telemetry.py,sha256=p4l9GxDfoxbEsmUpuSkQclRMhVFWqsOv97ze60KxRjk,2899
8
+ shotgun/telemetry.py,sha256=4Zgcqker7amcY9HLc51McacqR2hogER7lODMBGkiASo,2913
9
9
  shotgun/agents/__init__.py,sha256=8Jzv1YsDuLyNPFJyckSr_qI4ehTVeDyIMDW4omsfPGc,25
10
10
  shotgun/agents/agent_manager.py,sha256=1Aof8btrV2Ei3V3bNn8bLzdBiBsJ-sjaQq0t7bnwbpo,6564
11
11
  shotgun/agents/common.py,sha256=xNlbvwt68de2588930iI4JnNVyPMGsUEwf_ySFXttFE,9439
@@ -94,10 +94,11 @@ shotgun/tui/screens/chat.tcss,sha256=MV7-HhXSpBxIsSbB57RugNeM0wOpqMpIVke7qCf4-yQ
94
94
  shotgun/tui/screens/provider_config.py,sha256=A_tvDHF5KLP5PV60LjMJ_aoOdT3TjI6_g04UIUqGPqM,7126
95
95
  shotgun/tui/screens/splash.py,sha256=E2MsJihi3c9NY1L28o_MstDxGwrCnnV7zdq00MrGAsw,706
96
96
  shotgun/utils/__init__.py,sha256=WinIEp9oL2iMrWaDkXz2QX4nYVPAm8C9aBSKTeEwLtE,198
97
+ shotgun/utils/env_utils.py,sha256=8QK5aw_f_V2AVTleQQlcL0RnD4sPJWXlDG46fsHu0d8,1057
97
98
  shotgun/utils/file_system_utils.py,sha256=KQCxgkspb1CR8VE1n66q7-oT6O7MmV_edCXFEEO-CNY,871
98
99
  shotgun/utils/update_checker.py,sha256=Xf-7w3Pos3etzCoT771gJe2HLkA8_V2GrqWy7ni9UqA,11373
99
- shotgun_sh-0.1.0.dev8.dist-info/METADATA,sha256=EYMSwvdWlWiwseTmyKYNvPZraUta6RQXtRqSRzwpz5o,11239
100
- shotgun_sh-0.1.0.dev8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
101
- shotgun_sh-0.1.0.dev8.dist-info/entry_points.txt,sha256=zMC2AP_RmTKW4s4FlQRdap3AzzPOUvByudp8cALAiVY,71
102
- shotgun_sh-0.1.0.dev8.dist-info/licenses/LICENSE,sha256=YebsZl590zCHrF_acCU5pmNt0pnAfD2DmAnevJPB1tY,1065
103
- shotgun_sh-0.1.0.dev8.dist-info/RECORD,,
100
+ shotgun_sh-0.1.0.dev10.dist-info/METADATA,sha256=TNCzMJeoyhwMobw7byCSv9psRD9zeLhfOwoq28sTL9M,11240
101
+ shotgun_sh-0.1.0.dev10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
102
+ shotgun_sh-0.1.0.dev10.dist-info/entry_points.txt,sha256=asZxLU4QILneq0MWW10saVCZc4VWhZfb0wFZvERnzfA,45
103
+ shotgun_sh-0.1.0.dev10.dist-info/licenses/LICENSE,sha256=YebsZl590zCHrF_acCU5pmNt0pnAfD2DmAnevJPB1tY,1065
104
+ shotgun_sh-0.1.0.dev10.dist-info/RECORD,,
@@ -1,3 +1,2 @@
1
1
  [console_scripts]
2
2
  shotgun = shotgun.main:app
3
- tui = shotgun.tui.app:run