pdd-cli 0.0.34__py3-none-any.whl → 0.0.35__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.
Potentially problematic release.
This version of pdd-cli might be problematic. Click here for more details.
- pdd/__init__.py +1 -1
- pdd/auto_update.py +75 -8
- pdd/construct_paths.py +62 -3
- {pdd_cli-0.0.34.dist-info → pdd_cli-0.0.35.dist-info}/METADATA +3 -3
- {pdd_cli-0.0.34.dist-info → pdd_cli-0.0.35.dist-info}/RECORD +9 -9
- {pdd_cli-0.0.34.dist-info → pdd_cli-0.0.35.dist-info}/WHEEL +0 -0
- {pdd_cli-0.0.34.dist-info → pdd_cli-0.0.35.dist-info}/entry_points.txt +0 -0
- {pdd_cli-0.0.34.dist-info → pdd_cli-0.0.35.dist-info}/licenses/LICENSE +0 -0
- {pdd_cli-0.0.34.dist-info → pdd_cli-0.0.35.dist-info}/top_level.txt +0 -0
pdd/__init__.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
__version__ = "0.0.
|
|
1
|
+
__version__ = "0.0.35"
|
|
2
2
|
|
|
3
3
|
# Strength parameter used for LLM extraction across the codebase
|
|
4
4
|
# Used in postprocessing, XML tagging, code generation, and other extraction operations. The module should have a large context window and be affordable.
|
pdd/auto_update.py
CHANGED
|
@@ -3,14 +3,57 @@ import requests
|
|
|
3
3
|
import semver
|
|
4
4
|
import subprocess
|
|
5
5
|
import sys
|
|
6
|
+
import shutil
|
|
7
|
+
|
|
8
|
+
def detect_installation_method(sys_executable):
|
|
9
|
+
"""
|
|
10
|
+
Detect if package is installed via UV or pip.
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
sys_executable (str): Path to the Python executable
|
|
14
|
+
|
|
15
|
+
Returns:
|
|
16
|
+
str: "uv" if installed via UV, "pip" otherwise
|
|
17
|
+
"""
|
|
18
|
+
# Check if executable path contains UV paths
|
|
19
|
+
if any(marker in sys_executable for marker in ["/uv/tools/", ".local/share/uv/"]):
|
|
20
|
+
return "uv"
|
|
21
|
+
return "pip" # Default to pip for all other cases
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def get_upgrade_command(package_name, installation_method):
|
|
25
|
+
"""
|
|
26
|
+
Return appropriate upgrade command based on installation method.
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
package_name (str): Name of the package to upgrade
|
|
30
|
+
installation_method (str): "uv" or "pip"
|
|
31
|
+
|
|
32
|
+
Returns:
|
|
33
|
+
tuple: (command_list, shell_mode) where command_list is the command to run
|
|
34
|
+
and shell_mode is a boolean indicating if shell=True should be used
|
|
35
|
+
"""
|
|
36
|
+
if installation_method == "uv":
|
|
37
|
+
# For UV commands, we need the full path if available
|
|
38
|
+
uv_path = shutil.which("uv")
|
|
39
|
+
if uv_path:
|
|
40
|
+
return ([uv_path, "tool", "upgrade", package_name], False)
|
|
41
|
+
else:
|
|
42
|
+
# If uv isn't in PATH, use shell=True
|
|
43
|
+
return (["uv", "tool", "upgrade", package_name], True)
|
|
44
|
+
else:
|
|
45
|
+
# Default pip method
|
|
46
|
+
return ([sys.executable, "-m", "pip", "install", "--upgrade", package_name], False)
|
|
47
|
+
|
|
6
48
|
|
|
7
49
|
def auto_update(package_name: str = "pdd-cli", latest_version: str = None) -> None:
|
|
8
50
|
"""
|
|
9
51
|
Check if there's a new version of the package available and prompt for upgrade.
|
|
52
|
+
Handles both UV and pip installations automatically.
|
|
10
53
|
|
|
11
54
|
Args:
|
|
12
55
|
latest_version (str): Known latest version (default: None)
|
|
13
|
-
package_name (str): Name of the package to check (default: "pdd")
|
|
56
|
+
package_name (str): Name of the package to check (default: "pdd-cli")
|
|
14
57
|
"""
|
|
15
58
|
try:
|
|
16
59
|
# Get current installed version
|
|
@@ -47,15 +90,39 @@ def auto_update(package_name: str = "pdd-cli", latest_version: str = None) -> No
|
|
|
47
90
|
while True:
|
|
48
91
|
response = input("Would you like to upgrade? [y/N]: ").lower().strip()
|
|
49
92
|
if response in ['y', 'yes']:
|
|
50
|
-
#
|
|
51
|
-
|
|
52
|
-
|
|
93
|
+
# Detect installation method
|
|
94
|
+
installation_method = detect_installation_method(sys.executable)
|
|
95
|
+
cmd, use_shell = get_upgrade_command(package_name, installation_method)
|
|
96
|
+
|
|
97
|
+
cmd_str = " ".join(cmd)
|
|
98
|
+
print(f"\nDetected installation method: {installation_method}")
|
|
99
|
+
print(f"Upgrading with command: {cmd_str}")
|
|
53
100
|
|
|
54
101
|
try:
|
|
55
|
-
subprocess.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
102
|
+
result = subprocess.run(cmd, shell=use_shell, capture_output=True, text=True)
|
|
103
|
+
|
|
104
|
+
if result.returncode == 0:
|
|
105
|
+
print(f"\nSuccessfully upgraded {package_name} to version {latest_version}")
|
|
106
|
+
else:
|
|
107
|
+
print(f"\nUpgrade command failed: {result.stderr}")
|
|
108
|
+
|
|
109
|
+
# If UV failed and we're not already in fallback mode, try pip as fallback
|
|
110
|
+
if installation_method == "uv":
|
|
111
|
+
print("\nAttempting fallback to pip...")
|
|
112
|
+
fallback_cmd, fallback_shell = get_upgrade_command(package_name, "pip")
|
|
113
|
+
fallback_str = " ".join(fallback_cmd)
|
|
114
|
+
print(f"Fallback command: {fallback_str}")
|
|
115
|
+
|
|
116
|
+
try:
|
|
117
|
+
fallback_result = subprocess.run(fallback_cmd, shell=fallback_shell, capture_output=True, text=True)
|
|
118
|
+
if fallback_result.returncode == 0:
|
|
119
|
+
print(f"\nSuccessfully upgraded {package_name} using fallback method")
|
|
120
|
+
else:
|
|
121
|
+
print(f"\nFallback upgrade failed: {fallback_result.stderr}")
|
|
122
|
+
except Exception as fallback_err:
|
|
123
|
+
print(f"\nError during fallback upgrade: {str(fallback_err)}")
|
|
124
|
+
except Exception as e:
|
|
125
|
+
print(f"\nError during upgrade: {str(e)}")
|
|
59
126
|
break
|
|
60
127
|
elif response in ['n', 'no', '']:
|
|
61
128
|
print("\nUpgrade cancelled")
|
pdd/construct_paths.py
CHANGED
|
@@ -16,6 +16,9 @@ from .generate_output_paths import generate_output_paths
|
|
|
16
16
|
|
|
17
17
|
# Assume generate_output_paths raises ValueError on unknown command
|
|
18
18
|
|
|
19
|
+
# Add csv import for the new helper function
|
|
20
|
+
import csv
|
|
21
|
+
|
|
19
22
|
console = Console(theme=Theme({"info": "cyan", "warning": "yellow", "error": "bold red"}))
|
|
20
23
|
|
|
21
24
|
|
|
@@ -65,6 +68,62 @@ def _candidate_prompt_path(input_files: Dict[str, Path]) -> Path | None:
|
|
|
65
68
|
return None
|
|
66
69
|
|
|
67
70
|
|
|
71
|
+
# New helper function to check if a language is known
|
|
72
|
+
def _is_known_language(language_name: str) -> bool:
|
|
73
|
+
"""Checks if a language name is present in the language_format.csv."""
|
|
74
|
+
pdd_path_str = os.getenv('PDD_PATH')
|
|
75
|
+
if not pdd_path_str:
|
|
76
|
+
# Consistent with get_extension, raise ValueError if PDD_PATH is not set.
|
|
77
|
+
# Or, for an internal helper, we might decide to log and return False,
|
|
78
|
+
# but raising an error for missing config is generally safer.
|
|
79
|
+
# However, _determine_language (the caller) already raises ValueError
|
|
80
|
+
# if language cannot be found, so this path might not be strictly necessary
|
|
81
|
+
# if we assume PDD_PATH is validated earlier or by other get_extension/get_language calls.
|
|
82
|
+
# For robustness here, let's keep a check but perhaps make it less severe if called internally.
|
|
83
|
+
# For now, align with how get_extension might handle it.
|
|
84
|
+
# console.print("[error]PDD_PATH environment variable is not set. Cannot validate language.", style="error")
|
|
85
|
+
# return False # Or raise error
|
|
86
|
+
# Given this is internal and other functions (get_extension) already depend on PDD_PATH,
|
|
87
|
+
# we can assume if those ran, PDD_PATH is set. If not, they'd fail first.
|
|
88
|
+
# So, we can simplify or rely on that pre-condition.
|
|
89
|
+
# Let's assume PDD_PATH will be set if other language functions are working.
|
|
90
|
+
# If it's critical, an explicit check and raise ValueError is better.
|
|
91
|
+
# For now, let's proceed assuming PDD_PATH is available if this point is reached.
|
|
92
|
+
pass # Assuming PDD_PATH is checked by get_extension/get_language if they are called
|
|
93
|
+
|
|
94
|
+
# If PDD_PATH is not set, this will likely fail earlier if get_extension/get_language are used.
|
|
95
|
+
# If we want this helper to be fully independent, it needs robust PDD_PATH handling.
|
|
96
|
+
# Let's assume for now, PDD_PATH is available if this point is reached through normal flow.
|
|
97
|
+
|
|
98
|
+
# Re-evaluate: PDD_PATH is critical for this function. Let's keep the check.
|
|
99
|
+
if not pdd_path_str:
|
|
100
|
+
# This helper might be called before get_extension in some logic paths
|
|
101
|
+
# if _determine_language prioritizes suffix checking first.
|
|
102
|
+
# So, it needs its own PDD_PATH check.
|
|
103
|
+
# Raise ValueError to be consistent with get_extension's behavior.
|
|
104
|
+
raise ValueError("PDD_PATH environment variable is not set. Cannot validate language.")
|
|
105
|
+
|
|
106
|
+
csv_file_path = Path(pdd_path_str) / 'data' / 'language_format.csv'
|
|
107
|
+
|
|
108
|
+
if not csv_file_path.is_file():
|
|
109
|
+
# Raise FileNotFoundError if CSV is missing, consistent with get_extension
|
|
110
|
+
raise FileNotFoundError(f"The language format CSV file does not exist: {csv_file_path}")
|
|
111
|
+
|
|
112
|
+
language_name_lower = language_name.lower()
|
|
113
|
+
|
|
114
|
+
try:
|
|
115
|
+
with open(csv_file_path, mode='r', encoding='utf-8', newline='') as csvfile:
|
|
116
|
+
reader = csv.DictReader(csvfile)
|
|
117
|
+
for row in reader:
|
|
118
|
+
if row.get('language', '').lower() == language_name_lower:
|
|
119
|
+
return True
|
|
120
|
+
except csv.Error as e:
|
|
121
|
+
# Log and return False or raise a custom error
|
|
122
|
+
console.print(f"[error]CSV Error reading {csv_file_path}: {e}", style="error")
|
|
123
|
+
return False # Indicates language could not be confirmed due to CSV issue
|
|
124
|
+
return False
|
|
125
|
+
|
|
126
|
+
|
|
68
127
|
def _strip_language_suffix(path_like: os.PathLike[str]) -> str:
|
|
69
128
|
"""
|
|
70
129
|
Remove trailing '_<language>.prompt' or '_<language>' from a filename stem
|
|
@@ -84,7 +143,7 @@ def _strip_language_suffix(path_like: os.PathLike[str]) -> str:
|
|
|
84
143
|
candidate_lang = parts[-1]
|
|
85
144
|
|
|
86
145
|
# Check if the last part is a known language
|
|
87
|
-
if
|
|
146
|
+
if _is_known_language(candidate_lang):
|
|
88
147
|
# If the last part is a language, strip it
|
|
89
148
|
return "_".join(parts[:-1])
|
|
90
149
|
else:
|
|
@@ -183,8 +242,8 @@ def _determine_language(
|
|
|
183
242
|
parts = stem.split("_")
|
|
184
243
|
if len(parts) >= 2:
|
|
185
244
|
token = parts[-1]
|
|
186
|
-
# Check if the token is a known language
|
|
187
|
-
if
|
|
245
|
+
# Check if the token is a known language using the new helper
|
|
246
|
+
if _is_known_language(token):
|
|
188
247
|
return token.lower()
|
|
189
248
|
|
|
190
249
|
# 4 - Special handling for detect command - default to prompt for LLM prompts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pdd-cli
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.35
|
|
4
4
|
Summary: PDD (Prompt-Driven Development) Command Line Interface
|
|
5
5
|
Author: Greg Tanaka
|
|
6
6
|
Author-email: glt@alumni.caltech.edu
|
|
@@ -46,7 +46,7 @@ Requires-Dist: pytest-asyncio; extra == "dev"
|
|
|
46
46
|
Requires-Dist: z3-solver; extra == "dev"
|
|
47
47
|
Dynamic: license-file
|
|
48
48
|
|
|
49
|
-
.. image:: https://img.shields.io/badge/pdd--cli-v0.0.
|
|
49
|
+
.. image:: https://img.shields.io/badge/pdd--cli-v0.0.35-blue
|
|
50
50
|
:alt: PDD-CLI Version
|
|
51
51
|
|
|
52
52
|
.. image:: https://img.shields.io/badge/Discord-join%20chat-7289DA.svg?logo=discord&logoColor=white&link=https://discord.gg/Yp4RTh8bG7
|
|
@@ -134,7 +134,7 @@ After installation, verify:
|
|
|
134
134
|
|
|
135
135
|
pdd --version
|
|
136
136
|
|
|
137
|
-
You'll see the current PDD version (e.g., 0.0.
|
|
137
|
+
You'll see the current PDD version (e.g., 0.0.35).
|
|
138
138
|
|
|
139
139
|
Advanced Installation Tips
|
|
140
140
|
--------------------------
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
pdd/__init__.py,sha256=
|
|
1
|
+
pdd/__init__.py,sha256=Xtbm5MVbAzRicWQuHfgb041CmfSMTkF8KDyf60vTwZg,632
|
|
2
2
|
pdd/auto_deps_main.py,sha256=NVLqL5FHxe2eorViXTuh8z2zH9Sb-b6MNN9aZ1hqevY,3552
|
|
3
3
|
pdd/auto_include.py,sha256=aCa2QXDlOdKbh4vS3uDjWptkHB_Qv3QBNCbZe6mGWoo,6074
|
|
4
|
-
pdd/auto_update.py,sha256=
|
|
4
|
+
pdd/auto_update.py,sha256=oxessVoa9IHPhFF9TP-A6y3r_OZobeu047BRjNWwi3c,5937
|
|
5
5
|
pdd/bug_main.py,sha256=cSGBnHmFIA8WrkGiohJFVRuM2086v-wlPvTJqTv00WQ,4631
|
|
6
6
|
pdd/bug_to_unit_test.py,sha256=oejqoKomLseKknYDFlQKQ04TNT3soqOjMPghxty8Guo,6311
|
|
7
7
|
pdd/change.py,sha256=EKmv7WvXNX24rjLCnrcaoo4xOVkNhCa9HLRbpMAxQSw,5036
|
|
@@ -13,7 +13,7 @@ pdd/code_generator_main.py,sha256=oCI35RqQ7gBov8mncVg1mhdDNX-0jTsoIeSzrz7WpAk,25
|
|
|
13
13
|
pdd/comment_line.py,sha256=sX2hf4bG1fILi_rvI9MkkwCZ2IitgKkW7nOiw8aQKPY,1845
|
|
14
14
|
pdd/conflicts_in_prompts.py,sha256=XaEm9jIMcbENTyhphD8NXs2EmRxuPu1EI8GHrsiRwq0,4687
|
|
15
15
|
pdd/conflicts_main.py,sha256=O87s9baSa9DJMndxPIdsnYO_spoajcv9jii3XYt_-fM,3473
|
|
16
|
-
pdd/construct_paths.py,sha256=
|
|
16
|
+
pdd/construct_paths.py,sha256=hu1LFDnFfUcYyGz20Lgk_4jf40GcNOJAxWVIDUEAsz8,21046
|
|
17
17
|
pdd/context_generator.py,sha256=KQAaJRwVpsPOF4y5lhP3DpIrlxhR39C0hNyTAi1Kx2U,5618
|
|
18
18
|
pdd/context_generator_main.py,sha256=WSS7uRkS2wi8HCixDA3_xzFuPqFRF_X2tGe6K3loUZc,2773
|
|
19
19
|
pdd/continue_generation.py,sha256=upZw77fKqHZ5IS8Ful7eioTi9VTqeuY1V9vzIwHeOJQ,5419
|
|
@@ -101,9 +101,9 @@ pdd/prompts/trim_results_start_LLM.prompt,sha256=OKz8fAf1cYWKWgslFOHEkUpfaUDARh3
|
|
|
101
101
|
pdd/prompts/unfinished_prompt_LLM.prompt,sha256=-JgBpiPTQZdWOAwOG1XpfpD9waynFTAT3Jo84eQ4bTw,1543
|
|
102
102
|
pdd/prompts/update_prompt_LLM.prompt,sha256=prIc8uLp2jqnLTHt6JvWDZGanPZipivhhYeXe0lVaYw,1328
|
|
103
103
|
pdd/prompts/xml_convertor_LLM.prompt,sha256=YGRGXJeg6EhM9690f-SKqQrKqSJjLFD51UrPOlO0Frg,2786
|
|
104
|
-
pdd_cli-0.0.
|
|
105
|
-
pdd_cli-0.0.
|
|
106
|
-
pdd_cli-0.0.
|
|
107
|
-
pdd_cli-0.0.
|
|
108
|
-
pdd_cli-0.0.
|
|
109
|
-
pdd_cli-0.0.
|
|
104
|
+
pdd_cli-0.0.35.dist-info/licenses/LICENSE,sha256=-1bjYH-CEjGEQ8VixtnRYuu37kN6F9NxmZSDkBuUQ9o,1062
|
|
105
|
+
pdd_cli-0.0.35.dist-info/METADATA,sha256=J8jVM5c2lDFLb70DRoKveBmJIofG649nOl9W36OoMrg,7984
|
|
106
|
+
pdd_cli-0.0.35.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
107
|
+
pdd_cli-0.0.35.dist-info/entry_points.txt,sha256=Kr8HtNVb8uHZtQJNH4DnF8j7WNgWQbb7_Pw5hECSR-I,36
|
|
108
|
+
pdd_cli-0.0.35.dist-info/top_level.txt,sha256=xjnhIACeMcMeDfVNREgQZl4EbTni2T11QkL5r7E-sbE,4
|
|
109
|
+
pdd_cli-0.0.35.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|