ngpt 2.15.1__py3-none-any.whl → 2.15.2__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.
@@ -7,6 +7,7 @@ import subprocess
7
7
  from datetime import datetime
8
8
  import logging
9
9
  from ..formatters import COLORS
10
+ from ..ui import spinner
10
11
  from ...utils.log import create_gitcommsg_logger
11
12
  from ...utils.cli_config import get_cli_config_option
12
13
 
@@ -436,15 +437,8 @@ def handle_api_call(client, prompt, system_prompt=None, logger=None, max_retries
436
437
  print(f"{COLORS['yellow']}{error_msg}{COLORS['reset']}")
437
438
  print(f"{COLORS['yellow']}Retrying in {wait_seconds} seconds...{COLORS['reset']}")
438
439
 
439
- # Create a spinner effect for waiting
440
- spinner = "⣾⣽⣻⢿⡿⣟⣯⣷"
441
- for _ in range(wait_seconds * 5):
442
- for char in spinner:
443
- sys.stdout.write(f"\r{COLORS['yellow']}Waiting... {char}{COLORS['reset']}")
444
- sys.stdout.flush()
445
- time.sleep(0.2)
446
-
447
- print("\r" + " " * 20 + "\r", end="")
440
+ # Use the spinner function
441
+ spinner(f"Retrying in {wait_seconds} seconds...", wait_seconds, color=COLORS['yellow'])
448
442
 
449
443
  # Exponential backoff
450
444
  wait_seconds *= 2
@@ -517,8 +511,8 @@ def process_with_chunking(client, diff_content, context, chunk_size=200, recursi
517
511
 
518
512
  # Rate limit protection between chunks
519
513
  if i < chunk_count - 1:
520
- print(f"{COLORS['yellow']}Waiting to avoid rate limits...{COLORS['reset']}")
521
- time.sleep(5)
514
+ # Use the spinner function
515
+ spinner("Waiting to avoid rate limits...", 5, color=COLORS['yellow'])
522
516
 
523
517
  # Combine partial analyses
524
518
  print(f"\n{COLORS['cyan']}Combining analyses from {len(partial_analyses)} chunks...{COLORS['reset']}")
@@ -708,8 +702,8 @@ SECTION OF ANALYSIS TO CONDENSE:
708
702
 
709
703
  # Rate limit protection between chunks
710
704
  if i < analysis_chunk_count - 1:
711
- print(f"{COLORS['yellow']}Waiting to avoid rate limits...{COLORS['reset']}")
712
- time.sleep(5)
705
+ # Use the spinner function
706
+ spinner("Waiting to avoid rate limits...", 5, color=COLORS['yellow'])
713
707
 
714
708
  # Combine condensed chunks
715
709
  combined_condensed = "\n\n".join(condensed_chunks)
ngpt/cli/ui.py CHANGED
@@ -1,4 +1,5 @@
1
1
  import sys
2
+ import time
2
3
  import shutil
3
4
 
4
5
  # Optional imports for enhanced UI
@@ -151,4 +152,37 @@ def get_multiline_input():
151
152
 
152
153
  except KeyboardInterrupt:
153
154
  print("\nInput cancelled by user. Exiting gracefully.")
154
- return None
155
+ return None
156
+
157
+ def spinner(message, duration=5, spinner_chars="⣾⣽⣻⢿⡿⣟⣯⣷", color=None):
158
+ """Display a spinner animation with a message.
159
+
160
+ Args:
161
+ message: The message to display alongside the spinner
162
+ duration: Duration in seconds to show the spinner
163
+ spinner_chars: Characters to use for the spinner animation
164
+ color: Optional color from COLORS dict to use for the message
165
+ """
166
+ # Default color handling
167
+ color_start = ""
168
+ color_end = ""
169
+ if color:
170
+ color_start = color
171
+ color_end = "\033[0m" # Reset
172
+
173
+ # Each character shows for 0.2 seconds
174
+ char_duration = 0.2
175
+ # Total number of characters to show (not iterations through the entire spinner sequence)
176
+ total_chars = int(duration / char_duration)
177
+
178
+ # Run the spinner
179
+ for i in range(total_chars):
180
+ # Get the appropriate character by cycling through the spinner characters
181
+ char = spinner_chars[i % len(spinner_chars)]
182
+ sys.stdout.write(f"\r{color_start}{message} {char}{color_end}")
183
+ sys.stdout.flush()
184
+ time.sleep(char_duration)
185
+
186
+ # Clear the line when done
187
+ sys.stdout.write("\r" + " " * (len(message) + 10) + "\r")
188
+ sys.stdout.flush()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ngpt
3
- Version: 2.15.1
3
+ Version: 2.15.2
4
4
  Summary: A lightweight Python CLI and library for interacting with OpenAI-compatible APIs, supporting both official and self-hosted LLM endpoints.
5
5
  Project-URL: Homepage, https://github.com/nazdridoy/ngpt
6
6
  Project-URL: Repository, https://github.com/nazdridoy/ngpt
@@ -8,11 +8,11 @@ ngpt/cli/formatters.py,sha256=HBYGlx_7eoAKyzfy0Vq5L0yn8yVKjngqYBukMmXCcz0,9401
8
8
  ngpt/cli/interactive.py,sha256=DZFbExcXd7RylkpBiZBhiI6N8FBaT0m_lBes0Pvhi48,10894
9
9
  ngpt/cli/main.py,sha256=6GO4r9e9su7FFukj9JeVmJt1bJsqPOJBj6xo3iyMZXU,28911
10
10
  ngpt/cli/renderers.py,sha256=gJ3WdVvCGkNxrLEkLCh6gk9HBFMK8y7an6CsEkqt2Z8,10535
11
- ngpt/cli/ui.py,sha256=iMinm_QdsmwrEUpb7CBRexyyBqf4sviFI9M3E8D-hhA,5303
11
+ ngpt/cli/ui.py,sha256=gTtxg2E1WJg4W9JQxrUaM83OYjKjv6pOFTOaWlfa6Mw,6548
12
12
  ngpt/cli/modes/__init__.py,sha256=R3aO662RIzWEOvr3moTrEI8Tpg0zDDyMGGh1-OxiRgM,285
13
13
  ngpt/cli/modes/chat.py,sha256=4a5EgM_5A1zCSrLrjgQMDnBwIHd1Rnu5_BjSKSm7p24,4255
14
14
  ngpt/cli/modes/code.py,sha256=RjOAj7BDO5vLUdIPkUfPtyIkI_W6qEHsZvYh-sIdVaM,4293
15
- ngpt/cli/modes/gitcommsg.py,sha256=Kx9pWGWB2bMNFhpBPAa4q7VwHmJQwnZ2qoFrWK7t3gs,45080
15
+ ngpt/cli/modes/gitcommsg.py,sha256=dbT9_Y1RiahJxBXvrKC0IIEddzd7CXjMae7txauOK7Q,44840
16
16
  ngpt/cli/modes/rewrite.py,sha256=Zb0PFvWRKXs4xJCF3GEdYc-LSmy6qRszz8-QJuldHc0,8595
17
17
  ngpt/cli/modes/shell.py,sha256=lF9f7w-0bl_FdZl-WJnZuV736BKrWQtrwoKr3ejPXFE,2682
18
18
  ngpt/cli/modes/text.py,sha256=ncYnfLFMdTPuHiOvAaHNiOWhox6GF6S-2fTwMIrAz-g,3140
@@ -20,8 +20,8 @@ ngpt/utils/__init__.py,sha256=E46suk2-QgYBI0Qrs6WXOajOUOebF3ETAFY7ah8DTWs,942
20
20
  ngpt/utils/cli_config.py,sha256=tQxR3a2iXyc5TfRBPQHSUXPInO2dv_zTPGn04eWfmoo,11285
21
21
  ngpt/utils/config.py,sha256=WYOk_b1eiYjo6hpV3pfXr2RjqhOnmKqwZwKid1T41I4,10363
22
22
  ngpt/utils/log.py,sha256=f1jg2iFo35PAmsarH8FVL_62plq4VXH0Mu2QiP6RJGw,15934
23
- ngpt-2.15.1.dist-info/METADATA,sha256=vKoeQ_IrjV2UtPpEGsThb-i8wg6OE46qXw-UDZdj9YQ,23523
24
- ngpt-2.15.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
25
- ngpt-2.15.1.dist-info/entry_points.txt,sha256=SqAAvLhMrsEpkIr4YFRdUeyuXQ9o0IBCeYgE6AVojoI,44
26
- ngpt-2.15.1.dist-info/licenses/LICENSE,sha256=mQkpWoADxbHqE0HRefYLJdm7OpdrXBr3vNv5bZ8w72M,1065
27
- ngpt-2.15.1.dist-info/RECORD,,
23
+ ngpt-2.15.2.dist-info/METADATA,sha256=ZUt1VWznWOfW3-kOB9EgIV8Xkw0x2LdoR8Q9BTMeOkg,23523
24
+ ngpt-2.15.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
25
+ ngpt-2.15.2.dist-info/entry_points.txt,sha256=SqAAvLhMrsEpkIr4YFRdUeyuXQ9o0IBCeYgE6AVojoI,44
26
+ ngpt-2.15.2.dist-info/licenses/LICENSE,sha256=mQkpWoADxbHqE0HRefYLJdm7OpdrXBr3vNv5bZ8w72M,1065
27
+ ngpt-2.15.2.dist-info/RECORD,,
File without changes