pdd-cli 0.0.15__py3-none-any.whl → 0.0.17__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/cli.py +1 -1
- pdd/fix_error_loop.py +6 -0
- pdd/get_extension_1_1_0_0_20250221_234728.py +52 -0
- pdd/get_extension_1_1_1_0_20250221_230416.py +52 -0
- {pdd_cli-0.0.15.dist-info → pdd_cli-0.0.17.dist-info}/METADATA +3 -3
- {pdd_cli-0.0.15.dist-info → pdd_cli-0.0.17.dist-info}/RECORD +10 -8
- {pdd_cli-0.0.15.dist-info → pdd_cli-0.0.17.dist-info}/LICENSE +0 -0
- {pdd_cli-0.0.15.dist-info → pdd_cli-0.0.17.dist-info}/WHEEL +0 -0
- {pdd_cli-0.0.15.dist-info → pdd_cli-0.0.17.dist-info}/entry_points.txt +0 -0
- {pdd_cli-0.0.15.dist-info → pdd_cli-0.0.17.dist-info}/top_level.txt +0 -0
pdd/cli.py
CHANGED
|
@@ -46,7 +46,7 @@ console = Console()
|
|
|
46
46
|
@click.option("--review-examples", is_flag=True,
|
|
47
47
|
help="Review and optionally exclude few-shot examples before command execution.")
|
|
48
48
|
@click.option('--local', is_flag=True, help='Run commands locally instead of in the cloud.')
|
|
49
|
-
@click.version_option(version="0.0.
|
|
49
|
+
@click.version_option(version="0.0.17")
|
|
50
50
|
@click.pass_context
|
|
51
51
|
def cli(
|
|
52
52
|
ctx,
|
pdd/fix_error_loop.py
CHANGED
|
@@ -37,9 +37,15 @@ def run_pytest_on_file(test_file: str) -> (int, int, int, str):
|
|
|
37
37
|
output = json.loads(result.stdout)
|
|
38
38
|
test_results = output.get('test_results', [{}])[0]
|
|
39
39
|
|
|
40
|
+
# Check pytest's return code first
|
|
41
|
+
return_code = test_results.get('return_code', 1)
|
|
42
|
+
|
|
40
43
|
failures = test_results.get('failures', 0)
|
|
41
44
|
errors = test_results.get('errors', 0)
|
|
42
45
|
warnings = test_results.get('warnings', 0)
|
|
46
|
+
|
|
47
|
+
if return_code == 2:
|
|
48
|
+
errors += 1
|
|
43
49
|
|
|
44
50
|
# Combine stdout and stderr from the test results
|
|
45
51
|
logs = test_results.get('standard_output', '') + '\n' + test_results.get('standard_error', '')
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# To implement the `get_extension` function as described, we will follow the steps outlined in your request. We'll use the `pandas` library to read the CSV file, and we'll handle the environment variable for the file path. Here's how you can implement this function:
|
|
2
|
+
|
|
3
|
+
# ```python
|
|
4
|
+
import os
|
|
5
|
+
import pandas as pd
|
|
6
|
+
|
|
7
|
+
def get_extension(language):
|
|
8
|
+
# Step 1: Load the environment variable PDD_PATH
|
|
9
|
+
pdd_path = os.getenv('PDD_PATH')
|
|
10
|
+
if not pdd_path:
|
|
11
|
+
raise ValueError("Environment variable PDD_PATH is not set.")
|
|
12
|
+
|
|
13
|
+
# Construct the full path to the CSV file
|
|
14
|
+
csv_file_path = os.path.join(pdd_path, 'data', 'language_format.csv')
|
|
15
|
+
|
|
16
|
+
# Step 2: Lower case the language string
|
|
17
|
+
language_lower = language.lower()
|
|
18
|
+
|
|
19
|
+
# Step 3: Load the CSV file and look up the file extension
|
|
20
|
+
try:
|
|
21
|
+
df = pd.read_csv(csv_file_path)
|
|
22
|
+
except FileNotFoundError:
|
|
23
|
+
raise FileNotFoundError(f"The file {csv_file_path} does not exist.")
|
|
24
|
+
|
|
25
|
+
# Check if the language exists in the DataFrame
|
|
26
|
+
row = df[df['language'].str.lower() == language_lower]
|
|
27
|
+
|
|
28
|
+
# Step 4: Return the file extension or an empty string if not found
|
|
29
|
+
if not row.empty:
|
|
30
|
+
extension = row['extension'].values[0]
|
|
31
|
+
return extension if isinstance(extension, str) and extension else ''
|
|
32
|
+
|
|
33
|
+
return ''
|
|
34
|
+
|
|
35
|
+
# Example usage:
|
|
36
|
+
# Assuming the environment variable PDD_PATH is set correctly
|
|
37
|
+
# print(get_extension('Python')) # Output: .py
|
|
38
|
+
# ```
|
|
39
|
+
|
|
40
|
+
# ### Explanation of the Code:
|
|
41
|
+
# 1. **Environment Variable**: We use `os.getenv` to retrieve the `PDD_PATH` environment variable. If it's not set, we raise a `ValueError`.
|
|
42
|
+
# 2. **Lowercase Language**: The input language string is converted to lowercase to ensure case-insensitive comparison.
|
|
43
|
+
# 3. **Load CSV**: We use `pandas` to read the CSV file. If the file is not found, we raise a `FileNotFoundError`.
|
|
44
|
+
# 4. **Lookup**: We filter the DataFrame to find the row corresponding to the given language. If found, we check if the extension is a valid string and return it; otherwise, we return an empty string.
|
|
45
|
+
# 5. **Return Value**: If the language is not found, we return an empty string.
|
|
46
|
+
|
|
47
|
+
# ### Note:
|
|
48
|
+
# - Make sure to have the `pandas` library installed in your Python environment. You can install it using pip:
|
|
49
|
+
# ```bash
|
|
50
|
+
# pip install pandas
|
|
51
|
+
# ```
|
|
52
|
+
# - Ensure that the CSV file is structured correctly and located at the specified path.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# To implement the `get_extension` function as described, we will follow the steps outlined in your request. We'll use the `pandas` library to read the CSV file, and we'll handle the environment variable for the file path. Here's how you can implement this function:
|
|
2
|
+
|
|
3
|
+
# ```python
|
|
4
|
+
import os
|
|
5
|
+
import pandas as pd
|
|
6
|
+
|
|
7
|
+
def get_extension(language):
|
|
8
|
+
# Step 1: Load the environment variable PDD_PATH
|
|
9
|
+
pdd_path = os.getenv('PDD_PATH')
|
|
10
|
+
if not pdd_path:
|
|
11
|
+
raise ValueError("Environment variable PDD_PATH is not set.")
|
|
12
|
+
|
|
13
|
+
# Construct the full path to the CSV file
|
|
14
|
+
csv_file_path = os.path.join(pdd_path, 'data', 'language_format.csv')
|
|
15
|
+
|
|
16
|
+
# Step 2: Lower case the language string
|
|
17
|
+
language_lower = language.lower()
|
|
18
|
+
|
|
19
|
+
# Step 3: Load the CSV file and look up the file extension
|
|
20
|
+
try:
|
|
21
|
+
df = pd.read_csv(csv_file_path)
|
|
22
|
+
except FileNotFoundError:
|
|
23
|
+
raise FileNotFoundError(f"The file {csv_file_path} does not exist.")
|
|
24
|
+
|
|
25
|
+
# Check if the language exists in the DataFrame
|
|
26
|
+
row = df[df['language'].str.lower() == language_lower]
|
|
27
|
+
|
|
28
|
+
# Step 4: Return the file extension or an empty string if not found
|
|
29
|
+
if not row.empty:
|
|
30
|
+
extension = row['extension'].values[0]
|
|
31
|
+
return extension if isinstance(extension, str) and extension else ''
|
|
32
|
+
|
|
33
|
+
return ''
|
|
34
|
+
|
|
35
|
+
# Example usage:
|
|
36
|
+
# Assuming the environment variable PDD_PATH is set correctly
|
|
37
|
+
# print(get_extension('Python')) # Output: .py
|
|
38
|
+
# ```
|
|
39
|
+
|
|
40
|
+
# ### Explanation of the Code:
|
|
41
|
+
# 1. **Environment Variable**: We use `os.getenv` to retrieve the `PDD_PATH` environment variable. If it's not set, we raise a `ValueError`.
|
|
42
|
+
# 2. **Lowercase Language**: The input language string is converted to lowercase to ensure case-insensitive comparison.
|
|
43
|
+
# 3. **Load CSV**: We use `pandas` to read the CSV file. If the file is not found, we raise a `FileNotFoundError`.
|
|
44
|
+
# 4. **Lookup**: We filter the DataFrame to find the row corresponding to the given language. If found, we check if the extension is a valid string and return it; otherwise, we return an empty string.
|
|
45
|
+
# 5. **Return Value**: If the language is not found, we return an empty string.
|
|
46
|
+
|
|
47
|
+
# ### Note:
|
|
48
|
+
# - Make sure to have the `pandas` library installed in your Python environment. You can install it using pip:
|
|
49
|
+
# ```bash
|
|
50
|
+
# pip install pandas
|
|
51
|
+
# ```
|
|
52
|
+
# - Ensure that the CSV file is structured correctly and located at the specified path.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: pdd-cli
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.17
|
|
4
4
|
Summary: PDD (Prompt-Driven Development) Command Line Interface
|
|
5
5
|
Author: Greg Tanaka
|
|
6
6
|
Author-email: glt@alumni.caltech.edu
|
|
@@ -40,7 +40,7 @@ Requires-Dist: semver==3.0.2
|
|
|
40
40
|
Requires-Dist: setuptools==75.1.0
|
|
41
41
|
Requires-Dist: python-Levenshtein
|
|
42
42
|
|
|
43
|
-
.. image:: https://img.shields.io/badge/pdd--cli-v0.0.
|
|
43
|
+
.. image:: https://img.shields.io/badge/pdd--cli-v0.0.17-blue
|
|
44
44
|
:alt: PDD-CLI Version
|
|
45
45
|
|
|
46
46
|
PDD (Prompt-Driven Development) Command Line Interface
|
|
@@ -101,7 +101,7 @@ After installation, verify:
|
|
|
101
101
|
|
|
102
102
|
pdd --version
|
|
103
103
|
|
|
104
|
-
You'll see the current PDD version (e.g., 0.0.
|
|
104
|
+
You'll see the current PDD version (e.g., 0.0.17).
|
|
105
105
|
|
|
106
106
|
Advanced Installation Tips
|
|
107
107
|
--------------------------
|
|
@@ -6,7 +6,7 @@ pdd/bug_main.py,sha256=myKU9--QWdkV4Wf3mD2PoLPJFNgRjwf4z8s7TC28G_s,3720
|
|
|
6
6
|
pdd/bug_to_unit_test.py,sha256=dsJNm6qAwx-m7RvFF5RquFJRzxzZGCWT4IKYnzVCUws,5569
|
|
7
7
|
pdd/change.py,sha256=iqjWS5DrQ73yMkuUQlwIRIFlofmKdaK6t6-v3zHKL-4,4985
|
|
8
8
|
pdd/change_main.py,sha256=yL_i1Ws5vt4vAkWiC826csNi2cHP6wKbwe_PfMqbbPY,11407
|
|
9
|
-
pdd/cli.py,sha256=
|
|
9
|
+
pdd/cli.py,sha256=tvHIVZIA85EiL6fzrFnrAoDc9gnpIZInN4FQ_4dFDew,16593
|
|
10
10
|
pdd/cmd_test_main.py,sha256=aSCxRnSurg15AvPcJDAPp9xy8p_qqnjU1oV14Hi2R54,5301
|
|
11
11
|
pdd/code_generator.py,sha256=n5akrX7VPe71X4RsD6kKqAVvzBLMlciJI4RtJA1PcgA,4375
|
|
12
12
|
pdd/code_generator_main.py,sha256=G2eRBPXc1cGszkk0PbIPmJZHPaf_dw5d2yZbsvQZA3c,4793
|
|
@@ -23,13 +23,15 @@ pdd/detect_change_main.py,sha256=1Z4ymhjJaVr2aliGyqkqeqSmQ7QMgcl23p0wdsmBas0,365
|
|
|
23
23
|
pdd/find_section.py,sha256=lz_FPY4KDCRAGlL1pWVZiutUNv7E4KsDFK-ymDWA_Ec,962
|
|
24
24
|
pdd/fix_code_loop.py,sha256=L0yxq2yAziPIyFGb8lIP2mvufu8a_gtc5nnN2LuMuKs,8596
|
|
25
25
|
pdd/fix_code_module_errors.py,sha256=M6AnlR2jF5LI-nNg6gIO5LvSkxiaLIUGyTvfnUfe1cU,4625
|
|
26
|
-
pdd/fix_error_loop.py,sha256=
|
|
26
|
+
pdd/fix_error_loop.py,sha256=1_pW4MGy8FhLuq4RiGUBligev5IJg8Bs_-r2GaZN5Y8,17085
|
|
27
27
|
pdd/fix_errors_from_unit_tests.py,sha256=8qCEyHZ6lUSBtV9vhQyhgAxDuhngmOy7vVy2HObckd0,8934
|
|
28
28
|
pdd/fix_main.py,sha256=02OIViH12BcsykpDp4Osxw2ndEeThnNakMFkzdpYr48,5333
|
|
29
29
|
pdd/generate_output_paths.py,sha256=zz42GTx9eGyWIYSl3jcWvtJRGnieC3eoPM6DIVcWz2k,7219
|
|
30
30
|
pdd/generate_test.py,sha256=BwmRnjaPDTlxUqJZ37N3bxTBHlLPCZIR5i1bwrNNv54,4791
|
|
31
31
|
pdd/get_comment.py,sha256=yuRtk68-SDkMaGzOSyIFdldRoymJBRSKjOYkr0narVc,2627
|
|
32
32
|
pdd/get_extension.py,sha256=ZSsbi7n-tFw-7RQX7c3pV1qWsRt72qS_3AlAYjV53jA,2393
|
|
33
|
+
pdd/get_extension_1_1_0_0_20250221_234728.py,sha256=ZSsbi7n-tFw-7RQX7c3pV1qWsRt72qS_3AlAYjV53jA,2393
|
|
34
|
+
pdd/get_extension_1_1_1_0_20250221_230416.py,sha256=ZSsbi7n-tFw-7RQX7c3pV1qWsRt72qS_3AlAYjV53jA,2393
|
|
33
35
|
pdd/get_jwt_token.py,sha256=BGxqMh7qf2mG-TFw7JlV941O9XtrW22L_dRoS_UZNjM,11560
|
|
34
36
|
pdd/get_language.py,sha256=yxyQqVEb5H3ep3Hc6XgAl3vMLTHD5OIs8ZSekB493GA,1438
|
|
35
37
|
pdd/git_update.py,sha256=Ya7eI7YFtGIpT7FdziFJfnFkiZlj8I9Lh98lqtXfClc,2855
|
|
@@ -90,9 +92,9 @@ pdd/prompts/trim_results_start_LLM.prompt,sha256=WwFlOHha4wzMLtRHDMI6GtcNdl2toE8
|
|
|
90
92
|
pdd/prompts/unfinished_prompt_LLM.prompt,sha256=-JgBpiPTQZdWOAwOG1XpfpD9waynFTAT3Jo84eQ4bTw,1543
|
|
91
93
|
pdd/prompts/update_prompt_LLM.prompt,sha256=_lGaxeVP4oF8yGqiN6yj6UE0j79lxfGdjsYr5w5KSYk,1261
|
|
92
94
|
pdd/prompts/xml_convertor_LLM.prompt,sha256=YGRGXJeg6EhM9690f-SKqQrKqSJjLFD51UrPOlO0Frg,2786
|
|
93
|
-
pdd_cli-0.0.
|
|
94
|
-
pdd_cli-0.0.
|
|
95
|
-
pdd_cli-0.0.
|
|
96
|
-
pdd_cli-0.0.
|
|
97
|
-
pdd_cli-0.0.
|
|
98
|
-
pdd_cli-0.0.
|
|
95
|
+
pdd_cli-0.0.17.dist-info/LICENSE,sha256=-1bjYH-CEjGEQ8VixtnRYuu37kN6F9NxmZSDkBuUQ9o,1062
|
|
96
|
+
pdd_cli-0.0.17.dist-info/METADATA,sha256=qUaf1QAujAPdv6HU36UQPfg7DT65bHrcWYhtSLVs5AM,6808
|
|
97
|
+
pdd_cli-0.0.17.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
98
|
+
pdd_cli-0.0.17.dist-info/entry_points.txt,sha256=Kr8HtNVb8uHZtQJNH4DnF8j7WNgWQbb7_Pw5hECSR-I,36
|
|
99
|
+
pdd_cli-0.0.17.dist-info/top_level.txt,sha256=xjnhIACeMcMeDfVNREgQZl4EbTni2T11QkL5r7E-sbE,4
|
|
100
|
+
pdd_cli-0.0.17.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|