error-translator-cli-v2 1.0.8__tar.gz → 1.0.9__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.
Files changed (19) hide show
  1. error_translator_cli_v2-1.0.9/PKG-INFO +148 -0
  2. error_translator_cli_v2-1.0.9/README.md +140 -0
  3. error_translator_cli_v2-1.0.9/error_translator_cli_v2.egg-info/PKG-INFO +148 -0
  4. {error_translator_cli_v2-1.0.8 → error_translator_cli_v2-1.0.9}/pyproject.toml +1 -1
  5. error_translator_cli_v2-1.0.8/PKG-INFO +0 -132
  6. error_translator_cli_v2-1.0.8/README.md +0 -124
  7. error_translator_cli_v2-1.0.8/error_translator_cli_v2.egg-info/PKG-INFO +0 -132
  8. {error_translator_cli_v2-1.0.8 → error_translator_cli_v2-1.0.9}/error_translator/__init__.py +0 -0
  9. {error_translator_cli_v2-1.0.8 → error_translator_cli_v2-1.0.9}/error_translator/ast_handlers.py +0 -0
  10. {error_translator_cli_v2-1.0.8 → error_translator_cli_v2-1.0.9}/error_translator/auto.py +0 -0
  11. {error_translator_cli_v2-1.0.8 → error_translator_cli_v2-1.0.9}/error_translator/cli.py +0 -0
  12. {error_translator_cli_v2-1.0.8 → error_translator_cli_v2-1.0.9}/error_translator/core.py +0 -0
  13. {error_translator_cli_v2-1.0.8 → error_translator_cli_v2-1.0.9}/error_translator/server.py +0 -0
  14. {error_translator_cli_v2-1.0.8 → error_translator_cli_v2-1.0.9}/error_translator_cli_v2.egg-info/SOURCES.txt +0 -0
  15. {error_translator_cli_v2-1.0.8 → error_translator_cli_v2-1.0.9}/error_translator_cli_v2.egg-info/dependency_links.txt +0 -0
  16. {error_translator_cli_v2-1.0.8 → error_translator_cli_v2-1.0.9}/error_translator_cli_v2.egg-info/entry_points.txt +0 -0
  17. {error_translator_cli_v2-1.0.8 → error_translator_cli_v2-1.0.9}/error_translator_cli_v2.egg-info/top_level.txt +0 -0
  18. {error_translator_cli_v2-1.0.8 → error_translator_cli_v2-1.0.9}/setup.cfg +0 -0
  19. {error_translator_cli_v2-1.0.8 → error_translator_cli_v2-1.0.9}/tests/test_core.py +0 -0
@@ -0,0 +1,148 @@
1
+ Metadata-Version: 2.4
2
+ Name: error-translator-cli-v2
3
+ Version: 1.0.9
4
+ Summary: A CLI tool that explains Python errors in simple human language.
5
+ Author-email: Gourabananda Datta <gourabanandadatta@zohomail.com>
6
+ Requires-Python: >=3.7
7
+ Description-Content-Type: text/markdown
8
+
9
+ # Error Translator
10
+
11
+ Error Translator is a Python toolkit that converts raw tracebacks into clear, actionable guidance. The project is designed for local use, deterministic output, and easy extension by contributors.
12
+
13
+ It can be used as:
14
+
15
+ - A CLI (`explain-error`) for direct translation and script execution.
16
+ - An import hook (`error_translator.auto`) for automatic translation of unhandled exceptions.
17
+ - A small FastAPI service (`error_translator.server`) for integrations.
18
+
19
+ ## Why this project exists
20
+
21
+ Python's default tracebacks are precise but can be difficult for beginners and occasional Python users to act on quickly. Error Translator narrows that gap by matching final traceback lines against a curated set of regex rules and returning:
22
+
23
+ - A plain-language explanation.
24
+ - A concrete suggested fix.
25
+ - Location/context metadata when available (`file`, `line`, `code`).
26
+ - Optional AST-based hints for selected error families.
27
+
28
+ ## Key capabilities
29
+
30
+ - **Local and deterministic**: no external API is required for normal translation.
31
+ - **Structured output**: returns a predictable dictionary for CLI, library, and API consumers.
32
+ - **Multiple entry points**: CLI, import hook, and HTTP API share the same core engine.
33
+ - **Contributor-friendly rule model**: behavior is primarily driven by `error_translator/rules.json`.
34
+
35
+ ## Installation
36
+
37
+ ### Install from package
38
+
39
+ ```bash
40
+ pip install error-translator-cli-v2
41
+ ```
42
+
43
+ ### Install for local development
44
+
45
+ ```bash
46
+ pip install -r requirements.txt
47
+ ```
48
+
49
+ ## Usage
50
+
51
+ ### 1) Automatic crash interception
52
+
53
+ ```python
54
+ import error_translator.auto
55
+
56
+ maximum_user_connections = 100
57
+ print(maximum_user_connectons)
58
+ ```
59
+
60
+ Importing `error_translator.auto` installs a custom `sys.excepthook`, so unhandled exceptions are translated automatically in that process.
61
+
62
+ ### 2) CLI mode
63
+
64
+ Run a script and translate any failure from `stderr`:
65
+
66
+ ```bash
67
+ explain-error run script.py
68
+ ```
69
+
70
+ Translate a single raw error string:
71
+
72
+ ```bash
73
+ explain-error "TypeError: unsupported operand type(s) for +: 'int' and 'str'"
74
+ ```
75
+
76
+ Pipe traceback text from a file:
77
+
78
+ ```bash
79
+ cat error.log | explain-error
80
+ ```
81
+
82
+ PowerShell:
83
+
84
+ ```bash
85
+ Get-Content error.log | explain-error
86
+ ```
87
+
88
+ ### 3) Programmatic usage
89
+
90
+ ```python
91
+ from error_translator.core import translate_error
92
+
93
+ result = translate_error(traceback_text)
94
+ print(result["explanation"])
95
+ ```
96
+
97
+ ### 4) HTTP API
98
+
99
+ Start the API:
100
+
101
+ ```bash
102
+ uvicorn error_translator.server:app --reload
103
+ ```
104
+
105
+ `POST /translate` expects:
106
+
107
+ ```json
108
+ {
109
+ "traceback_setting": "Traceback (most recent call last): ..."
110
+ }
111
+ ```
112
+
113
+ ## Response contract
114
+
115
+ `translate_error()` returns a dictionary with these fields when available:
116
+
117
+ - `explanation`
118
+ - `fix`
119
+ - `matched_error`
120
+ - `file`
121
+ - `line`
122
+ - `code`
123
+ - `ast_insight`
124
+
125
+ ## Repository structure
126
+
127
+ - `error_translator/core.py`: translation pipeline and rule matching.
128
+ - `error_translator/cli.py`: terminal interface (`explain-error`).
129
+ - `error_translator/auto.py`: automatic exception-hook integration.
130
+ - `error_translator/server.py`: FastAPI surface.
131
+ - `error_translator/ast_handlers.py`: optional contextual heuristics.
132
+ - `error_translator/rules.json`: primary rule database.
133
+ - `tests/test_core.py`: regression tests for translation behavior.
134
+
135
+ ## Contributing
136
+
137
+ We welcome contributions of all sizes. If you are new to the project:
138
+
139
+ 1. Start with one narrowly scoped improvement.
140
+ 2. Add or update tests for behavior changes.
141
+ 3. Run `pytest` before submitting.
142
+ 4. Keep user-facing docs aligned with implementation.
143
+
144
+ See `docs/CONTRIBUTING.md` for full contributor workflow and review standards.
145
+
146
+ ---
147
+
148
+ Maintained by Gourabananda Datta and contributors.
@@ -0,0 +1,140 @@
1
+ # Error Translator
2
+
3
+ Error Translator is a Python toolkit that converts raw tracebacks into clear, actionable guidance. The project is designed for local use, deterministic output, and easy extension by contributors.
4
+
5
+ It can be used as:
6
+
7
+ - A CLI (`explain-error`) for direct translation and script execution.
8
+ - An import hook (`error_translator.auto`) for automatic translation of unhandled exceptions.
9
+ - A small FastAPI service (`error_translator.server`) for integrations.
10
+
11
+ ## Why this project exists
12
+
13
+ Python's default tracebacks are precise but can be difficult for beginners and occasional Python users to act on quickly. Error Translator narrows that gap by matching final traceback lines against a curated set of regex rules and returning:
14
+
15
+ - A plain-language explanation.
16
+ - A concrete suggested fix.
17
+ - Location/context metadata when available (`file`, `line`, `code`).
18
+ - Optional AST-based hints for selected error families.
19
+
20
+ ## Key capabilities
21
+
22
+ - **Local and deterministic**: no external API is required for normal translation.
23
+ - **Structured output**: returns a predictable dictionary for CLI, library, and API consumers.
24
+ - **Multiple entry points**: CLI, import hook, and HTTP API share the same core engine.
25
+ - **Contributor-friendly rule model**: behavior is primarily driven by `error_translator/rules.json`.
26
+
27
+ ## Installation
28
+
29
+ ### Install from package
30
+
31
+ ```bash
32
+ pip install error-translator-cli-v2
33
+ ```
34
+
35
+ ### Install for local development
36
+
37
+ ```bash
38
+ pip install -r requirements.txt
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ ### 1) Automatic crash interception
44
+
45
+ ```python
46
+ import error_translator.auto
47
+
48
+ maximum_user_connections = 100
49
+ print(maximum_user_connectons)
50
+ ```
51
+
52
+ Importing `error_translator.auto` installs a custom `sys.excepthook`, so unhandled exceptions are translated automatically in that process.
53
+
54
+ ### 2) CLI mode
55
+
56
+ Run a script and translate any failure from `stderr`:
57
+
58
+ ```bash
59
+ explain-error run script.py
60
+ ```
61
+
62
+ Translate a single raw error string:
63
+
64
+ ```bash
65
+ explain-error "TypeError: unsupported operand type(s) for +: 'int' and 'str'"
66
+ ```
67
+
68
+ Pipe traceback text from a file:
69
+
70
+ ```bash
71
+ cat error.log | explain-error
72
+ ```
73
+
74
+ PowerShell:
75
+
76
+ ```bash
77
+ Get-Content error.log | explain-error
78
+ ```
79
+
80
+ ### 3) Programmatic usage
81
+
82
+ ```python
83
+ from error_translator.core import translate_error
84
+
85
+ result = translate_error(traceback_text)
86
+ print(result["explanation"])
87
+ ```
88
+
89
+ ### 4) HTTP API
90
+
91
+ Start the API:
92
+
93
+ ```bash
94
+ uvicorn error_translator.server:app --reload
95
+ ```
96
+
97
+ `POST /translate` expects:
98
+
99
+ ```json
100
+ {
101
+ "traceback_setting": "Traceback (most recent call last): ..."
102
+ }
103
+ ```
104
+
105
+ ## Response contract
106
+
107
+ `translate_error()` returns a dictionary with these fields when available:
108
+
109
+ - `explanation`
110
+ - `fix`
111
+ - `matched_error`
112
+ - `file`
113
+ - `line`
114
+ - `code`
115
+ - `ast_insight`
116
+
117
+ ## Repository structure
118
+
119
+ - `error_translator/core.py`: translation pipeline and rule matching.
120
+ - `error_translator/cli.py`: terminal interface (`explain-error`).
121
+ - `error_translator/auto.py`: automatic exception-hook integration.
122
+ - `error_translator/server.py`: FastAPI surface.
123
+ - `error_translator/ast_handlers.py`: optional contextual heuristics.
124
+ - `error_translator/rules.json`: primary rule database.
125
+ - `tests/test_core.py`: regression tests for translation behavior.
126
+
127
+ ## Contributing
128
+
129
+ We welcome contributions of all sizes. If you are new to the project:
130
+
131
+ 1. Start with one narrowly scoped improvement.
132
+ 2. Add or update tests for behavior changes.
133
+ 3. Run `pytest` before submitting.
134
+ 4. Keep user-facing docs aligned with implementation.
135
+
136
+ See `docs/CONTRIBUTING.md` for full contributor workflow and review standards.
137
+
138
+ ---
139
+
140
+ Maintained by Gourabananda Datta and contributors.
@@ -0,0 +1,148 @@
1
+ Metadata-Version: 2.4
2
+ Name: error-translator-cli-v2
3
+ Version: 1.0.9
4
+ Summary: A CLI tool that explains Python errors in simple human language.
5
+ Author-email: Gourabananda Datta <gourabanandadatta@zohomail.com>
6
+ Requires-Python: >=3.7
7
+ Description-Content-Type: text/markdown
8
+
9
+ # Error Translator
10
+
11
+ Error Translator is a Python toolkit that converts raw tracebacks into clear, actionable guidance. The project is designed for local use, deterministic output, and easy extension by contributors.
12
+
13
+ It can be used as:
14
+
15
+ - A CLI (`explain-error`) for direct translation and script execution.
16
+ - An import hook (`error_translator.auto`) for automatic translation of unhandled exceptions.
17
+ - A small FastAPI service (`error_translator.server`) for integrations.
18
+
19
+ ## Why this project exists
20
+
21
+ Python's default tracebacks are precise but can be difficult for beginners and occasional Python users to act on quickly. Error Translator narrows that gap by matching final traceback lines against a curated set of regex rules and returning:
22
+
23
+ - A plain-language explanation.
24
+ - A concrete suggested fix.
25
+ - Location/context metadata when available (`file`, `line`, `code`).
26
+ - Optional AST-based hints for selected error families.
27
+
28
+ ## Key capabilities
29
+
30
+ - **Local and deterministic**: no external API is required for normal translation.
31
+ - **Structured output**: returns a predictable dictionary for CLI, library, and API consumers.
32
+ - **Multiple entry points**: CLI, import hook, and HTTP API share the same core engine.
33
+ - **Contributor-friendly rule model**: behavior is primarily driven by `error_translator/rules.json`.
34
+
35
+ ## Installation
36
+
37
+ ### Install from package
38
+
39
+ ```bash
40
+ pip install error-translator-cli-v2
41
+ ```
42
+
43
+ ### Install for local development
44
+
45
+ ```bash
46
+ pip install -r requirements.txt
47
+ ```
48
+
49
+ ## Usage
50
+
51
+ ### 1) Automatic crash interception
52
+
53
+ ```python
54
+ import error_translator.auto
55
+
56
+ maximum_user_connections = 100
57
+ print(maximum_user_connectons)
58
+ ```
59
+
60
+ Importing `error_translator.auto` installs a custom `sys.excepthook`, so unhandled exceptions are translated automatically in that process.
61
+
62
+ ### 2) CLI mode
63
+
64
+ Run a script and translate any failure from `stderr`:
65
+
66
+ ```bash
67
+ explain-error run script.py
68
+ ```
69
+
70
+ Translate a single raw error string:
71
+
72
+ ```bash
73
+ explain-error "TypeError: unsupported operand type(s) for +: 'int' and 'str'"
74
+ ```
75
+
76
+ Pipe traceback text from a file:
77
+
78
+ ```bash
79
+ cat error.log | explain-error
80
+ ```
81
+
82
+ PowerShell:
83
+
84
+ ```bash
85
+ Get-Content error.log | explain-error
86
+ ```
87
+
88
+ ### 3) Programmatic usage
89
+
90
+ ```python
91
+ from error_translator.core import translate_error
92
+
93
+ result = translate_error(traceback_text)
94
+ print(result["explanation"])
95
+ ```
96
+
97
+ ### 4) HTTP API
98
+
99
+ Start the API:
100
+
101
+ ```bash
102
+ uvicorn error_translator.server:app --reload
103
+ ```
104
+
105
+ `POST /translate` expects:
106
+
107
+ ```json
108
+ {
109
+ "traceback_setting": "Traceback (most recent call last): ..."
110
+ }
111
+ ```
112
+
113
+ ## Response contract
114
+
115
+ `translate_error()` returns a dictionary with these fields when available:
116
+
117
+ - `explanation`
118
+ - `fix`
119
+ - `matched_error`
120
+ - `file`
121
+ - `line`
122
+ - `code`
123
+ - `ast_insight`
124
+
125
+ ## Repository structure
126
+
127
+ - `error_translator/core.py`: translation pipeline and rule matching.
128
+ - `error_translator/cli.py`: terminal interface (`explain-error`).
129
+ - `error_translator/auto.py`: automatic exception-hook integration.
130
+ - `error_translator/server.py`: FastAPI surface.
131
+ - `error_translator/ast_handlers.py`: optional contextual heuristics.
132
+ - `error_translator/rules.json`: primary rule database.
133
+ - `tests/test_core.py`: regression tests for translation behavior.
134
+
135
+ ## Contributing
136
+
137
+ We welcome contributions of all sizes. If you are new to the project:
138
+
139
+ 1. Start with one narrowly scoped improvement.
140
+ 2. Add or update tests for behavior changes.
141
+ 3. Run `pytest` before submitting.
142
+ 4. Keep user-facing docs aligned with implementation.
143
+
144
+ See `docs/CONTRIBUTING.md` for full contributor workflow and review standards.
145
+
146
+ ---
147
+
148
+ Maintained by Gourabananda Datta and contributors.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "error-translator-cli-v2"
7
- version = "1.0.8"
7
+ version = "1.0.9"
8
8
  description = "A CLI tool that explains Python errors in simple human language."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.7"
@@ -1,132 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: error-translator-cli-v2
3
- Version: 1.0.8
4
- Summary: A CLI tool that explains Python errors in simple human language.
5
- Author-email: Gourabananda Datta <gourabanandadatta@zohomail.com>
6
- Requires-Python: >=3.7
7
- Description-Content-Type: text/markdown
8
-
9
- # Error Translator CLI
10
-
11
- Error Translator CLI turns Python tracebacks into clear, actionable explanations. It is a local, rule-based tool that reads the final error line, matches it against a curated regex rule set, and returns a structured translation with the original file, line number, code context, and a suggested fix.
12
-
13
- ## Highlights
14
-
15
- - Runs locally with no model inference or external API calls during normal translation.
16
- - Supports three entry points: automatic crash interception, CLI execution, and direct traceback translation.
17
- - Extracts file and line information from standard Python tracebacks when available.
18
- - Includes optional AST-based insight hooks for a few error families.
19
- - Provides both machine-readable results and colorized terminal output.
20
-
21
- ## Installation
22
-
23
- Install the published package with pip:
24
-
25
- ```bash
26
- pip install error-translator-cli-v2
27
- ```
28
-
29
- For local development or running the project from source, install the repository dependencies instead:
30
-
31
- ```bash
32
- pip install -r requirements.txt
33
- ```
34
-
35
- ## Usage
36
-
37
- ### 1. Automatic crash interception
38
-
39
- Import `error_translator.auto` at the top of a script to replace Python's default exception hook with the translated output.
40
-
41
- This is the project's magic import: once imported, any unhandled exception in that process is intercepted and formatted by the translator before Python prints the default traceback.
42
-
43
- ```python
44
- import error_translator.auto
45
-
46
- maximum_user_connections = 100
47
- print(maximum_user_connectons)
48
- ```
49
-
50
- Use this when you want the translation to happen automatically without wrapping your code in a custom try/except block.
51
-
52
- ### 2. CLI execution
53
-
54
- Run a script through the CLI and let the tool translate crashes from `stderr`.
55
-
56
- ```bash
57
- explain-error run script.py
58
- ```
59
-
60
- You can also translate a raw traceback or error string directly:
61
-
62
- ```bash
63
- explain-error "TypeError: unsupported operand type(s) for +: 'int' and 'str'"
64
- ```
65
-
66
- If you want to pipe a saved traceback into the tool, use the shell syntax for your terminal:
67
-
68
- ```bash
69
- Get-Content error.log | explain-error
70
- ```
71
-
72
- ```bash
73
- cat error.log | explain-error
74
- ```
75
-
76
- ### 3. Programmatic use
77
-
78
- ```python
79
- from error_translator.core import translate_error
80
-
81
- result = translate_error(traceback_text)
82
- print(result["explanation"])
83
- ```
84
-
85
- ### 4. HTTP API
86
-
87
- Start the FastAPI app with Uvicorn:
88
-
89
- ```bash
90
- uvicorn error_translator.server:app --reload
91
- ```
92
-
93
- `POST /translate` expects JSON in the form:
94
-
95
- ```json
96
- {
97
- "traceback_setting": "Traceback (most recent call last): ..."
98
- }
99
- ```
100
-
101
- ## What the translator returns
102
-
103
- The translation engine returns a dictionary with these fields when available:
104
-
105
- - `explanation`
106
- - `fix`
107
- - `matched_error`
108
- - `file`
109
- - `line`
110
- - `code`
111
- - `ast_insight`
112
-
113
- ## Supported errors
114
-
115
- The bundled rule set covers many common Python runtime, syntax, indentation, import, OS, encoding, and networking errors. The full list lives in `error_translator/rules.json` and can be expanded over time without changing the runtime engine.
116
-
117
- ## Project layout
118
-
119
- - `error_translator/core.py` loads the rule set and performs the translation.
120
- - `error_translator/cli.py` provides the `explain-error` command.
121
- - `error_translator/auto.py` installs the automatic exception hook.
122
- - `error_translator/server.py` exposes the HTTP API.
123
- - `error_translator/ast_handlers.py` contains contextual suggestion hooks.
124
- - `error_translator/rules.json` stores the rule database.
125
-
126
- ## Development notes
127
-
128
- - `builder.py` can generate new rule drafts with Gemini when `GEMINI_API_KEY` is set.
129
- - `scraper.py` refreshes the scraped exception dataset from the official Python documentation.
130
- - `tests/test_core.py` contains the current regression coverage for the translation engine.
131
-
132
- Built by Gourabananda Datta.
@@ -1,124 +0,0 @@
1
- # Error Translator CLI
2
-
3
- Error Translator CLI turns Python tracebacks into clear, actionable explanations. It is a local, rule-based tool that reads the final error line, matches it against a curated regex rule set, and returns a structured translation with the original file, line number, code context, and a suggested fix.
4
-
5
- ## Highlights
6
-
7
- - Runs locally with no model inference or external API calls during normal translation.
8
- - Supports three entry points: automatic crash interception, CLI execution, and direct traceback translation.
9
- - Extracts file and line information from standard Python tracebacks when available.
10
- - Includes optional AST-based insight hooks for a few error families.
11
- - Provides both machine-readable results and colorized terminal output.
12
-
13
- ## Installation
14
-
15
- Install the published package with pip:
16
-
17
- ```bash
18
- pip install error-translator-cli-v2
19
- ```
20
-
21
- For local development or running the project from source, install the repository dependencies instead:
22
-
23
- ```bash
24
- pip install -r requirements.txt
25
- ```
26
-
27
- ## Usage
28
-
29
- ### 1. Automatic crash interception
30
-
31
- Import `error_translator.auto` at the top of a script to replace Python's default exception hook with the translated output.
32
-
33
- This is the project's magic import: once imported, any unhandled exception in that process is intercepted and formatted by the translator before Python prints the default traceback.
34
-
35
- ```python
36
- import error_translator.auto
37
-
38
- maximum_user_connections = 100
39
- print(maximum_user_connectons)
40
- ```
41
-
42
- Use this when you want the translation to happen automatically without wrapping your code in a custom try/except block.
43
-
44
- ### 2. CLI execution
45
-
46
- Run a script through the CLI and let the tool translate crashes from `stderr`.
47
-
48
- ```bash
49
- explain-error run script.py
50
- ```
51
-
52
- You can also translate a raw traceback or error string directly:
53
-
54
- ```bash
55
- explain-error "TypeError: unsupported operand type(s) for +: 'int' and 'str'"
56
- ```
57
-
58
- If you want to pipe a saved traceback into the tool, use the shell syntax for your terminal:
59
-
60
- ```bash
61
- Get-Content error.log | explain-error
62
- ```
63
-
64
- ```bash
65
- cat error.log | explain-error
66
- ```
67
-
68
- ### 3. Programmatic use
69
-
70
- ```python
71
- from error_translator.core import translate_error
72
-
73
- result = translate_error(traceback_text)
74
- print(result["explanation"])
75
- ```
76
-
77
- ### 4. HTTP API
78
-
79
- Start the FastAPI app with Uvicorn:
80
-
81
- ```bash
82
- uvicorn error_translator.server:app --reload
83
- ```
84
-
85
- `POST /translate` expects JSON in the form:
86
-
87
- ```json
88
- {
89
- "traceback_setting": "Traceback (most recent call last): ..."
90
- }
91
- ```
92
-
93
- ## What the translator returns
94
-
95
- The translation engine returns a dictionary with these fields when available:
96
-
97
- - `explanation`
98
- - `fix`
99
- - `matched_error`
100
- - `file`
101
- - `line`
102
- - `code`
103
- - `ast_insight`
104
-
105
- ## Supported errors
106
-
107
- The bundled rule set covers many common Python runtime, syntax, indentation, import, OS, encoding, and networking errors. The full list lives in `error_translator/rules.json` and can be expanded over time without changing the runtime engine.
108
-
109
- ## Project layout
110
-
111
- - `error_translator/core.py` loads the rule set and performs the translation.
112
- - `error_translator/cli.py` provides the `explain-error` command.
113
- - `error_translator/auto.py` installs the automatic exception hook.
114
- - `error_translator/server.py` exposes the HTTP API.
115
- - `error_translator/ast_handlers.py` contains contextual suggestion hooks.
116
- - `error_translator/rules.json` stores the rule database.
117
-
118
- ## Development notes
119
-
120
- - `builder.py` can generate new rule drafts with Gemini when `GEMINI_API_KEY` is set.
121
- - `scraper.py` refreshes the scraped exception dataset from the official Python documentation.
122
- - `tests/test_core.py` contains the current regression coverage for the translation engine.
123
-
124
- Built by Gourabananda Datta.
@@ -1,132 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: error-translator-cli-v2
3
- Version: 1.0.8
4
- Summary: A CLI tool that explains Python errors in simple human language.
5
- Author-email: Gourabananda Datta <gourabanandadatta@zohomail.com>
6
- Requires-Python: >=3.7
7
- Description-Content-Type: text/markdown
8
-
9
- # Error Translator CLI
10
-
11
- Error Translator CLI turns Python tracebacks into clear, actionable explanations. It is a local, rule-based tool that reads the final error line, matches it against a curated regex rule set, and returns a structured translation with the original file, line number, code context, and a suggested fix.
12
-
13
- ## Highlights
14
-
15
- - Runs locally with no model inference or external API calls during normal translation.
16
- - Supports three entry points: automatic crash interception, CLI execution, and direct traceback translation.
17
- - Extracts file and line information from standard Python tracebacks when available.
18
- - Includes optional AST-based insight hooks for a few error families.
19
- - Provides both machine-readable results and colorized terminal output.
20
-
21
- ## Installation
22
-
23
- Install the published package with pip:
24
-
25
- ```bash
26
- pip install error-translator-cli-v2
27
- ```
28
-
29
- For local development or running the project from source, install the repository dependencies instead:
30
-
31
- ```bash
32
- pip install -r requirements.txt
33
- ```
34
-
35
- ## Usage
36
-
37
- ### 1. Automatic crash interception
38
-
39
- Import `error_translator.auto` at the top of a script to replace Python's default exception hook with the translated output.
40
-
41
- This is the project's magic import: once imported, any unhandled exception in that process is intercepted and formatted by the translator before Python prints the default traceback.
42
-
43
- ```python
44
- import error_translator.auto
45
-
46
- maximum_user_connections = 100
47
- print(maximum_user_connectons)
48
- ```
49
-
50
- Use this when you want the translation to happen automatically without wrapping your code in a custom try/except block.
51
-
52
- ### 2. CLI execution
53
-
54
- Run a script through the CLI and let the tool translate crashes from `stderr`.
55
-
56
- ```bash
57
- explain-error run script.py
58
- ```
59
-
60
- You can also translate a raw traceback or error string directly:
61
-
62
- ```bash
63
- explain-error "TypeError: unsupported operand type(s) for +: 'int' and 'str'"
64
- ```
65
-
66
- If you want to pipe a saved traceback into the tool, use the shell syntax for your terminal:
67
-
68
- ```bash
69
- Get-Content error.log | explain-error
70
- ```
71
-
72
- ```bash
73
- cat error.log | explain-error
74
- ```
75
-
76
- ### 3. Programmatic use
77
-
78
- ```python
79
- from error_translator.core import translate_error
80
-
81
- result = translate_error(traceback_text)
82
- print(result["explanation"])
83
- ```
84
-
85
- ### 4. HTTP API
86
-
87
- Start the FastAPI app with Uvicorn:
88
-
89
- ```bash
90
- uvicorn error_translator.server:app --reload
91
- ```
92
-
93
- `POST /translate` expects JSON in the form:
94
-
95
- ```json
96
- {
97
- "traceback_setting": "Traceback (most recent call last): ..."
98
- }
99
- ```
100
-
101
- ## What the translator returns
102
-
103
- The translation engine returns a dictionary with these fields when available:
104
-
105
- - `explanation`
106
- - `fix`
107
- - `matched_error`
108
- - `file`
109
- - `line`
110
- - `code`
111
- - `ast_insight`
112
-
113
- ## Supported errors
114
-
115
- The bundled rule set covers many common Python runtime, syntax, indentation, import, OS, encoding, and networking errors. The full list lives in `error_translator/rules.json` and can be expanded over time without changing the runtime engine.
116
-
117
- ## Project layout
118
-
119
- - `error_translator/core.py` loads the rule set and performs the translation.
120
- - `error_translator/cli.py` provides the `explain-error` command.
121
- - `error_translator/auto.py` installs the automatic exception hook.
122
- - `error_translator/server.py` exposes the HTTP API.
123
- - `error_translator/ast_handlers.py` contains contextual suggestion hooks.
124
- - `error_translator/rules.json` stores the rule database.
125
-
126
- ## Development notes
127
-
128
- - `builder.py` can generate new rule drafts with Gemini when `GEMINI_API_KEY` is set.
129
- - `scraper.py` refreshes the scraped exception dataset from the official Python documentation.
130
- - `tests/test_core.py` contains the current regression coverage for the translation engine.
131
-
132
- Built by Gourabananda Datta.