error-translator-cli-v2 1.1.2__tar.gz → 1.1.3__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.
- {error_translator_cli_v2-1.1.2 → error_translator_cli_v2-1.1.3}/PKG-INFO +7 -1
- {error_translator_cli_v2-1.1.2 → error_translator_cli_v2-1.1.3}/README.md +6 -0
- {error_translator_cli_v2-1.1.2 → error_translator_cli_v2-1.1.3}/error_translator/cli.py +69 -10
- {error_translator_cli_v2-1.1.2 → error_translator_cli_v2-1.1.3}/error_translator_cli_v2.egg-info/PKG-INFO +7 -1
- {error_translator_cli_v2-1.1.2 → error_translator_cli_v2-1.1.3}/pyproject.toml +1 -1
- {error_translator_cli_v2-1.1.2 → error_translator_cli_v2-1.1.3}/error_translator/__init__.py +0 -0
- {error_translator_cli_v2-1.1.2 → error_translator_cli_v2-1.1.3}/error_translator/ast_handlers.py +0 -0
- {error_translator_cli_v2-1.1.2 → error_translator_cli_v2-1.1.3}/error_translator/auto.py +0 -0
- {error_translator_cli_v2-1.1.2 → error_translator_cli_v2-1.1.3}/error_translator/core.py +0 -0
- {error_translator_cli_v2-1.1.2 → error_translator_cli_v2-1.1.3}/error_translator/server.py +0 -0
- {error_translator_cli_v2-1.1.2 → error_translator_cli_v2-1.1.3}/error_translator_cli_v2.egg-info/SOURCES.txt +0 -0
- {error_translator_cli_v2-1.1.2 → error_translator_cli_v2-1.1.3}/error_translator_cli_v2.egg-info/dependency_links.txt +0 -0
- {error_translator_cli_v2-1.1.2 → error_translator_cli_v2-1.1.3}/error_translator_cli_v2.egg-info/entry_points.txt +0 -0
- {error_translator_cli_v2-1.1.2 → error_translator_cli_v2-1.1.3}/error_translator_cli_v2.egg-info/top_level.txt +0 -0
- {error_translator_cli_v2-1.1.2 → error_translator_cli_v2-1.1.3}/setup.cfg +0 -0
- {error_translator_cli_v2-1.1.2 → error_translator_cli_v2-1.1.3}/tests/test_core.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: error-translator-cli-v2
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.3
|
|
4
4
|
Summary: A CLI tool that explains Python errors in simple human language.
|
|
5
5
|
Author-email: Gourabananda Datta <gourabanandadatta@zohomail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/gourabanandad/error-translator
|
|
@@ -34,6 +34,12 @@ Built for local-first developer workflows: CLI, import-hook auto mode, Python AP
|
|
|
34
34
|
```bash
|
|
35
35
|
pip install error-translator-cli-v2
|
|
36
36
|
```
|
|
37
|
+
### Check if the CLI is working:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
explain-error --version
|
|
41
|
+
```
|
|
42
|
+
|
|
37
43
|
|
|
38
44
|
### Local development setup
|
|
39
45
|
|
|
@@ -23,6 +23,12 @@ Built for local-first developer workflows: CLI, import-hook auto mode, Python AP
|
|
|
23
23
|
```bash
|
|
24
24
|
pip install error-translator-cli-v2
|
|
25
25
|
```
|
|
26
|
+
### Check if the CLI is working:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
explain-error --version
|
|
30
|
+
```
|
|
31
|
+
|
|
26
32
|
|
|
27
33
|
### Local development setup
|
|
28
34
|
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import sys
|
|
2
2
|
import argparse
|
|
3
3
|
from .core import translate_error
|
|
4
|
+
from importlib.metadata import version, PackageNotFoundError
|
|
5
|
+
|
|
6
|
+
try:
|
|
7
|
+
VERSION = version("error-translator-cli-v2")
|
|
8
|
+
except PackageNotFoundError:
|
|
9
|
+
VERSION = "unknown (not installed via pip)" # Fallback version if package metadata is not found
|
|
4
10
|
|
|
5
11
|
# ANSI Color Codes
|
|
6
12
|
class Colors:
|
|
@@ -12,6 +18,32 @@ class Colors:
|
|
|
12
18
|
RESET = '\033[0m'
|
|
13
19
|
MAGENTA = '\033[95m'
|
|
14
20
|
|
|
21
|
+
|
|
22
|
+
def print_about():
|
|
23
|
+
"""Prints the about message for the tool."""
|
|
24
|
+
about_text = f"""
|
|
25
|
+
ERROR TRANSLATOR CLI
|
|
26
|
+
=====================
|
|
27
|
+
A lightning-fast, offline tool that translates raw Python tracebacks
|
|
28
|
+
into human-readable explanations with actionable fixes.
|
|
29
|
+
|
|
30
|
+
Authors: Gourabananda Datta
|
|
31
|
+
Repository: https://github.com/gourabanandad/error-translator-cli-v2
|
|
32
|
+
Usage:
|
|
33
|
+
1. Run a script and translate its errors:
|
|
34
|
+
explain-error run your_script.py
|
|
35
|
+
2. Translate an error message directly:
|
|
36
|
+
explain-error "TypeError: unsupported operand type(s) for +: 'int' and 'str'"
|
|
37
|
+
3. Pipe an error log:
|
|
38
|
+
cat error.log | explain-error
|
|
39
|
+
4. Get help:
|
|
40
|
+
explain-error --help
|
|
41
|
+
5. About:
|
|
42
|
+
explain-error --about
|
|
43
|
+
"""
|
|
44
|
+
print(f"\033[96m{about_text}\033[0m")
|
|
45
|
+
|
|
46
|
+
|
|
15
47
|
def print_result(result: dict):
|
|
16
48
|
"""Prints the translated error to the terminal with colors."""
|
|
17
49
|
print(f"\n{Colors.RED}{Colors.BOLD} Error Detected:{Colors.RESET}")
|
|
@@ -68,9 +100,25 @@ def run_script(script_name: str):
|
|
|
68
100
|
# Entry point of the program
|
|
69
101
|
def main():
|
|
70
102
|
parser = argparse.ArgumentParser(
|
|
71
|
-
|
|
103
|
+
prog="explain-error",
|
|
104
|
+
description="Translate Python error messages into simple English.",
|
|
105
|
+
epilog="Examples:\n explain-error run script.py\n explain-error \"NameError: name 'x' is not defined\"\n cat error.log | explain-error",
|
|
106
|
+
formatter_class=argparse.RawTextHelpFormatter
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
parser.add_argument(
|
|
110
|
+
"-a",
|
|
111
|
+
"--about",
|
|
112
|
+
action="store_true",
|
|
113
|
+
help="Display information about the tool."
|
|
72
114
|
)
|
|
73
115
|
|
|
116
|
+
parser.add_argument(
|
|
117
|
+
"-v",
|
|
118
|
+
"--version",
|
|
119
|
+
action="store_true",
|
|
120
|
+
help="Show the current version of the tool."
|
|
121
|
+
)
|
|
74
122
|
# Allow multiple arguments so we can accept "run script.py" or a long error string
|
|
75
123
|
parser.add_argument(
|
|
76
124
|
"args",
|
|
@@ -80,6 +128,14 @@ def main():
|
|
|
80
128
|
|
|
81
129
|
parsed_args = parser.parse_args()
|
|
82
130
|
|
|
131
|
+
if parsed_args.about:
|
|
132
|
+
print_about()
|
|
133
|
+
sys.exit(0)
|
|
134
|
+
|
|
135
|
+
if parsed_args.version:
|
|
136
|
+
print(f"Error Translator CLI Version: {Colors.GREEN}{VERSION}{Colors.RESET}")
|
|
137
|
+
sys.exit(0)
|
|
138
|
+
|
|
83
139
|
# 1. Handle Piped Input (e.g., cat error.log | explain-error)
|
|
84
140
|
if not sys.stdin.isatty():
|
|
85
141
|
error_input = sys.stdin.read()
|
|
@@ -92,15 +148,18 @@ def main():
|
|
|
92
148
|
parser.print_help()
|
|
93
149
|
sys.exit(1)
|
|
94
150
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
151
|
+
if parsed_args.args:
|
|
152
|
+
# 3. Check if the user used the "run" command
|
|
153
|
+
if parsed_args.args[0] == "run" and len(parsed_args.args) > 1:
|
|
154
|
+
script_name = parsed_args.args[1]
|
|
155
|
+
run_script(script_name)
|
|
156
|
+
|
|
157
|
+
# 4. Fallback: Treat the input as a raw error string
|
|
158
|
+
else:
|
|
159
|
+
error_input = " ".join(parsed_args.args)
|
|
160
|
+
print_result(translate_error(error_input))
|
|
101
161
|
else:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
162
|
+
parser.print_help()
|
|
163
|
+
sys.exit(1)
|
|
105
164
|
if __name__ == "__main__":
|
|
106
165
|
main()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: error-translator-cli-v2
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.3
|
|
4
4
|
Summary: A CLI tool that explains Python errors in simple human language.
|
|
5
5
|
Author-email: Gourabananda Datta <gourabanandadatta@zohomail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/gourabanandad/error-translator
|
|
@@ -34,6 +34,12 @@ Built for local-first developer workflows: CLI, import-hook auto mode, Python AP
|
|
|
34
34
|
```bash
|
|
35
35
|
pip install error-translator-cli-v2
|
|
36
36
|
```
|
|
37
|
+
### Check if the CLI is working:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
explain-error --version
|
|
41
|
+
```
|
|
42
|
+
|
|
37
43
|
|
|
38
44
|
### Local development setup
|
|
39
45
|
|
{error_translator_cli_v2-1.1.2 → error_translator_cli_v2-1.1.3}/error_translator/__init__.py
RENAMED
|
File without changes
|
{error_translator_cli_v2-1.1.2 → error_translator_cli_v2-1.1.3}/error_translator/ast_handlers.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|