crackerjack 0.19.7__tar.gz → 0.20.0__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.
- {crackerjack-0.19.7 → crackerjack-0.20.0}/PKG-INFO +95 -3
- {crackerjack-0.19.7 → crackerjack-0.20.0}/README.md +94 -2
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.gitignore +2 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.pre-commit-config.yaml +0 -1
- crackerjack-0.20.0/crackerjack/.ruff_cache/0.11.12/1867267426380906393 +0 -0
- crackerjack-0.20.0/crackerjack/.ruff_cache/0.11.12/4240757255861806333 +0 -0
- crackerjack-0.20.0/crackerjack/__init__.py +42 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/__main__.py +23 -3
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/crackerjack.py +295 -40
- crackerjack-0.20.0/crackerjack/errors.py +176 -0
- crackerjack-0.20.0/crackerjack/interactive.py +487 -0
- crackerjack-0.20.0/crackerjack/py313.py +221 -0
- crackerjack-0.20.0/crackerjack/pyproject.toml +239 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/pyproject.toml +2 -2
- {crackerjack-0.19.7 → crackerjack-0.20.0}/tests/test_crackerjack.py +80 -76
- crackerjack-0.20.0/tests/test_errors.py +171 -0
- crackerjack-0.20.0/tests/test_interactive.py +452 -0
- crackerjack-0.20.0/tests/test_interactive_run.py +162 -0
- crackerjack-0.20.0/tests/test_py313_advanced.py +162 -0
- crackerjack-0.20.0/tests/test_py313_features.py +175 -0
- crackerjack-0.20.0/tests/test_structured_errors.py +159 -0
- crackerjack-0.19.7/crackerjack/.ruff_cache/0.11.12/1867267426380906393 +0 -0
- crackerjack-0.19.7/crackerjack/__init__.py +0 -5
- crackerjack-0.19.7/crackerjack/pyproject.toml +0 -239
- {crackerjack-0.19.7 → crackerjack-0.20.0}/LICENSE +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.libcst.codemod.yaml +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.pdm.toml +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.pytest_cache/.gitignore +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.pytest_cache/CACHEDIR.TAG +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.pytest_cache/README.md +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.pytest_cache/v/cache/nodeids +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.pytest_cache/v/cache/stepwise +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/.gitignore +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.1.11/3256171999636029978 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.1.14/602324811142551221 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.1.4/10355199064880463147 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.1.6/15140459877605758699 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.1.7/1790508110482614856 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.1.9/17041001205004563469 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.11.11/18187162184424859798 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.11.12/16869036553936192448 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.11.12/4441409093023629623 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.11.2/4070660268492669020 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.11.3/9818742842212983150 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.11.4/9818742842212983150 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.11.6/3557596832929915217 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.11.7/10386934055395314831 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.11.7/3557596832929915217 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.11.8/530407680854991027 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.2.0/10047773857155985907 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.2.1/8522267973936635051 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.2.2/18053836298936336950 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.3.0/12548816621480535786 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.3.3/11081883392474770722 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.3.4/676973378459347183 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.3.5/16311176246009842383 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.5.7/1493622539551733492 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.5.7/6231957614044513175 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.5.7/9932762556785938009 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.6.0/11982804814124138945 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.6.0/12055761203849489982 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.6.2/1206147804896221174 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.6.4/1206147804896221174 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.6.5/1206147804896221174 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.6.7/3657366982708166874 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.6.9/285614542852677309 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.7.1/1024065805990144819 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.7.1/285614542852677309 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.7.3/16061516852537040135 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.8.4/16354268377385700367 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.9.10/12813592349865671909 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.9.10/923908772239632759 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.9.3/13948373885254993391 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.9.9/12813592349865671909 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/0.9.9/8843823720003377982 +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/crackerjack/.ruff_cache/CACHEDIR.TAG +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/tests/TESTING.md +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/tests/__init__.py +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/tests/conftest.py +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/tests/data/comments_sample.txt +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/tests/data/docstrings_sample.txt +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/tests/data/expected_comments_sample.txt +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/tests/data/init.py +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/tests/test_crackerjack_runner.py +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/tests/test_main.py +0 -0
- {crackerjack-0.19.7 → crackerjack-0.20.0}/tests/test_pytest_features.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: crackerjack
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.20.0
|
4
4
|
Summary: Crackerjack: code quality toolkit
|
5
5
|
Keywords: bandit,black,creosote,mypy,pyright,pytest,refurb,ruff
|
6
6
|
Author-Email: lesleslie <les@wedgwoodwebworks.com>
|
@@ -82,7 +82,7 @@ Crackerjack integrates powerful tools like Ruff, PDM, pre-commit, pytest, and mo
|
|
82
82
|
### Quick Start
|
83
83
|
|
84
84
|
If you're new to Crackerjack, follow these steps:
|
85
|
-
1. **Install Python 3.13:** Ensure you have Python 3.13 installed.
|
85
|
+
1. **Install Python 3.13:** Ensure you have Python 3.13 or higher installed.
|
86
86
|
2. **Install PDM:**
|
87
87
|
```
|
88
88
|
pipx install pdm
|
@@ -98,6 +98,11 @@ If you're new to Crackerjack, follow these steps:
|
|
98
98
|
python -m crackerjack
|
99
99
|
```
|
100
100
|
|
101
|
+
Or use the interactive Rich UI:
|
102
|
+
```
|
103
|
+
python -m crackerjack --rich-ui
|
104
|
+
```
|
105
|
+
|
101
106
|
---
|
102
107
|
|
103
108
|
## The Crackerjack Philosophy
|
@@ -137,9 +142,12 @@ Crackerjack is built on the following core principles:
|
|
137
142
|
|
138
143
|
### Developer Experience
|
139
144
|
- **Command-Line Interface:** Simple, intuitive CLI with comprehensive options
|
145
|
+
- **Interactive Rich UI:** Visual workflow with real-time task tracking, progress visualization, and interactive prompts
|
146
|
+
- **Structured Error Handling:** Clear error messages with error codes, detailed explanations, and recovery suggestions
|
140
147
|
- **Programmatic API:** Can be integrated into your own Python scripts and workflows
|
141
148
|
- **AI Agent Integration:** Structured output format for integration with AI assistants, with complete style rules available in [RULES.md](RULES.md) for AI tool customization
|
142
149
|
- **Verbose Mode:** Detailed output for debugging and understanding what's happening
|
150
|
+
- **Python 3.13+ Features:** Leverages the latest Python language features including PEP 695 type parameter syntax, Self type annotations, and structural pattern matching
|
143
151
|
|
144
152
|
## Pre-commit Hooks
|
145
153
|
|
@@ -217,7 +225,7 @@ python -m crackerjack -t --benchmark-regression --benchmark-regression-threshold
|
|
217
225
|
|
218
226
|
## Installation
|
219
227
|
|
220
|
-
1. **Python:** Ensure you have Python 3.13 installed.
|
228
|
+
1. **Python:** Ensure you have Python 3.13 or higher installed.
|
221
229
|
2. **PDM:** Install [PDM](https://pdm.fming.dev/) using `pipx`:
|
222
230
|
|
223
231
|
```
|
@@ -231,6 +239,11 @@ python -m crackerjack -t --benchmark-regression --benchmark-regression-threshold
|
|
231
239
|
python -m crackerjack
|
232
240
|
```
|
233
241
|
|
242
|
+
Or with the interactive Rich UI:
|
243
|
+
```
|
244
|
+
python -m crackerjack --rich-ui
|
245
|
+
```
|
246
|
+
|
234
247
|
## Usage
|
235
248
|
|
236
249
|
### Command Line
|
@@ -312,6 +325,7 @@ runner.process(MyOptions())
|
|
312
325
|
- `--benchmark-regression`: Fail tests if benchmarks regress beyond threshold.
|
313
326
|
- `--benchmark-regression-threshold`: Set threshold percentage for benchmark regression (default 5.0%).
|
314
327
|
- `-a`, `--all`: Run with `-x -t -p <micro|minor|major> -c` development options.
|
328
|
+
- `--rich-ui`: Enable the interactive Rich UI for a more user-friendly experience with visual progress tracking and interactive prompts.
|
315
329
|
- `--ai-agent`: Enable AI agent mode with structured output (see [AI Agent Integration](#ai-agent-integration)).
|
316
330
|
- `--help`: Display help.
|
317
331
|
|
@@ -387,6 +401,11 @@ runner.process(MyOptions())
|
|
387
401
|
python -m crackerjack -i
|
388
402
|
```
|
389
403
|
|
404
|
+
- **Rich Interactive Mode** - Run with the interactive Rich UI:
|
405
|
+
```bash
|
406
|
+
python -m crackerjack --rich-ui
|
407
|
+
```
|
408
|
+
|
390
409
|
- **AI Integration** - Run with structured output for AI tools:
|
391
410
|
```bash
|
392
411
|
python -m crackerjack --ai-agent --test
|
@@ -413,6 +432,79 @@ python -m crackerjack --ai-agent --test
|
|
413
432
|
|
414
433
|
For detailed information about using Crackerjack with AI agents, including the structured output format and programmatic usage, see [README-AI-AGENT.md](README-AI-AGENT.md).
|
415
434
|
|
435
|
+
## Interactive Rich UI
|
436
|
+
|
437
|
+
Crackerjack now offers an enhanced interactive experience through its Rich UI:
|
438
|
+
|
439
|
+
- **Visual Workflow:** See a visual representation of the entire task workflow with dependencies
|
440
|
+
- **Real-time Progress:** Track task progress with interactive progress bars and status indicators
|
441
|
+
- **Task Management:** Confirm tasks before execution and view detailed status information
|
442
|
+
- **Error Visualization:** Errors are presented in a structured, easy-to-understand format with recovery suggestions
|
443
|
+
- **File Selection:** Interactive file browser for operations that require selecting files
|
444
|
+
|
445
|
+
To use the Rich UI, run Crackerjack with the `--rich-ui` flag:
|
446
|
+
|
447
|
+
```bash
|
448
|
+
python -m crackerjack --rich-ui
|
449
|
+
```
|
450
|
+
|
451
|
+
This launches an interactive terminal interface where you can:
|
452
|
+
1. View all available tasks and their dependencies
|
453
|
+
2. Confirm each task before execution
|
454
|
+
3. Get detailed status information for running tasks
|
455
|
+
4. See a summary of completed, failed, and skipped tasks
|
456
|
+
5. Visualize error details with recovery suggestions
|
457
|
+
|
458
|
+
## Structured Error Handling
|
459
|
+
|
460
|
+
Crackerjack implements a comprehensive error handling system that provides:
|
461
|
+
|
462
|
+
- **Error Categories:** Errors are categorized by type (configuration, execution, testing, etc.)
|
463
|
+
- **Error Codes:** Each error has a unique numeric code for easy reference
|
464
|
+
- **Detailed Messages:** Clear, descriptive messages explain what went wrong
|
465
|
+
- **Recovery Suggestions:** Where possible, errors include recovery suggestions to help resolve issues
|
466
|
+
- **Rich Formatting:** Errors are presented with clear visual formatting (when using Rich UI or verbose mode)
|
467
|
+
|
468
|
+
Error types include:
|
469
|
+
- Configuration errors (1000-1999)
|
470
|
+
- Execution errors (2000-2999)
|
471
|
+
- Test errors (3000-3999)
|
472
|
+
- Publishing errors (4000-4999)
|
473
|
+
- Git errors (5000-5999)
|
474
|
+
- File operation errors (6000-6999)
|
475
|
+
- Code cleaning errors (7000-7999)
|
476
|
+
- Generic errors (9000-9999)
|
477
|
+
|
478
|
+
Use the `-v` or `--verbose` flag to see more detailed error information:
|
479
|
+
|
480
|
+
```bash
|
481
|
+
python -m crackerjack -v
|
482
|
+
```
|
483
|
+
|
484
|
+
For the most comprehensive error details with visual formatting, combine verbose mode with the Rich UI:
|
485
|
+
|
486
|
+
```bash
|
487
|
+
python -m crackerjack --rich-ui -v
|
488
|
+
```
|
489
|
+
|
490
|
+
## Python 3.13+ Features
|
491
|
+
|
492
|
+
Crackerjack is designed to leverage the latest Python 3.13+ language features:
|
493
|
+
|
494
|
+
- **Type Parameter Syntax (PEP 695):** Uses the new, more concise syntax for generic type parameters
|
495
|
+
- **Self Type:** Leverages the `Self` type for better method chaining and builder patterns
|
496
|
+
- **Structural Pattern Matching:** Uses pattern matching for cleaner code, especially in configuration and command processing
|
497
|
+
- **Enhanced Type Hints:** More precise type hints with union types using the pipe operator
|
498
|
+
- **Modern Dictionary Patterns:** Leverages structural pattern matching with dictionaries for cleaner data handling
|
499
|
+
|
500
|
+
These modern Python features contribute to:
|
501
|
+
- More readable and maintainable code
|
502
|
+
- Better static type checking with tools like pyright
|
503
|
+
- Cleaner, more concise implementations
|
504
|
+
- Enhanced error handling and pattern recognition
|
505
|
+
|
506
|
+
Crackerjack provides examples of these features in action, serving as a reference for modern Python development practices.
|
507
|
+
|
416
508
|
## Contributing
|
417
509
|
|
418
510
|
Crackerjack is an evolving project. Contributions are welcome! Please open a pull request or issue.
|
@@ -40,7 +40,7 @@ Crackerjack integrates powerful tools like Ruff, PDM, pre-commit, pytest, and mo
|
|
40
40
|
### Quick Start
|
41
41
|
|
42
42
|
If you're new to Crackerjack, follow these steps:
|
43
|
-
1. **Install Python 3.13:** Ensure you have Python 3.13 installed.
|
43
|
+
1. **Install Python 3.13:** Ensure you have Python 3.13 or higher installed.
|
44
44
|
2. **Install PDM:**
|
45
45
|
```
|
46
46
|
pipx install pdm
|
@@ -56,6 +56,11 @@ If you're new to Crackerjack, follow these steps:
|
|
56
56
|
python -m crackerjack
|
57
57
|
```
|
58
58
|
|
59
|
+
Or use the interactive Rich UI:
|
60
|
+
```
|
61
|
+
python -m crackerjack --rich-ui
|
62
|
+
```
|
63
|
+
|
59
64
|
---
|
60
65
|
|
61
66
|
## The Crackerjack Philosophy
|
@@ -95,9 +100,12 @@ Crackerjack is built on the following core principles:
|
|
95
100
|
|
96
101
|
### Developer Experience
|
97
102
|
- **Command-Line Interface:** Simple, intuitive CLI with comprehensive options
|
103
|
+
- **Interactive Rich UI:** Visual workflow with real-time task tracking, progress visualization, and interactive prompts
|
104
|
+
- **Structured Error Handling:** Clear error messages with error codes, detailed explanations, and recovery suggestions
|
98
105
|
- **Programmatic API:** Can be integrated into your own Python scripts and workflows
|
99
106
|
- **AI Agent Integration:** Structured output format for integration with AI assistants, with complete style rules available in [RULES.md](RULES.md) for AI tool customization
|
100
107
|
- **Verbose Mode:** Detailed output for debugging and understanding what's happening
|
108
|
+
- **Python 3.13+ Features:** Leverages the latest Python language features including PEP 695 type parameter syntax, Self type annotations, and structural pattern matching
|
101
109
|
|
102
110
|
## Pre-commit Hooks
|
103
111
|
|
@@ -175,7 +183,7 @@ python -m crackerjack -t --benchmark-regression --benchmark-regression-threshold
|
|
175
183
|
|
176
184
|
## Installation
|
177
185
|
|
178
|
-
1. **Python:** Ensure you have Python 3.13 installed.
|
186
|
+
1. **Python:** Ensure you have Python 3.13 or higher installed.
|
179
187
|
2. **PDM:** Install [PDM](https://pdm.fming.dev/) using `pipx`:
|
180
188
|
|
181
189
|
```
|
@@ -189,6 +197,11 @@ python -m crackerjack -t --benchmark-regression --benchmark-regression-threshold
|
|
189
197
|
python -m crackerjack
|
190
198
|
```
|
191
199
|
|
200
|
+
Or with the interactive Rich UI:
|
201
|
+
```
|
202
|
+
python -m crackerjack --rich-ui
|
203
|
+
```
|
204
|
+
|
192
205
|
## Usage
|
193
206
|
|
194
207
|
### Command Line
|
@@ -270,6 +283,7 @@ runner.process(MyOptions())
|
|
270
283
|
- `--benchmark-regression`: Fail tests if benchmarks regress beyond threshold.
|
271
284
|
- `--benchmark-regression-threshold`: Set threshold percentage for benchmark regression (default 5.0%).
|
272
285
|
- `-a`, `--all`: Run with `-x -t -p <micro|minor|major> -c` development options.
|
286
|
+
- `--rich-ui`: Enable the interactive Rich UI for a more user-friendly experience with visual progress tracking and interactive prompts.
|
273
287
|
- `--ai-agent`: Enable AI agent mode with structured output (see [AI Agent Integration](#ai-agent-integration)).
|
274
288
|
- `--help`: Display help.
|
275
289
|
|
@@ -345,6 +359,11 @@ runner.process(MyOptions())
|
|
345
359
|
python -m crackerjack -i
|
346
360
|
```
|
347
361
|
|
362
|
+
- **Rich Interactive Mode** - Run with the interactive Rich UI:
|
363
|
+
```bash
|
364
|
+
python -m crackerjack --rich-ui
|
365
|
+
```
|
366
|
+
|
348
367
|
- **AI Integration** - Run with structured output for AI tools:
|
349
368
|
```bash
|
350
369
|
python -m crackerjack --ai-agent --test
|
@@ -371,6 +390,79 @@ python -m crackerjack --ai-agent --test
|
|
371
390
|
|
372
391
|
For detailed information about using Crackerjack with AI agents, including the structured output format and programmatic usage, see [README-AI-AGENT.md](README-AI-AGENT.md).
|
373
392
|
|
393
|
+
## Interactive Rich UI
|
394
|
+
|
395
|
+
Crackerjack now offers an enhanced interactive experience through its Rich UI:
|
396
|
+
|
397
|
+
- **Visual Workflow:** See a visual representation of the entire task workflow with dependencies
|
398
|
+
- **Real-time Progress:** Track task progress with interactive progress bars and status indicators
|
399
|
+
- **Task Management:** Confirm tasks before execution and view detailed status information
|
400
|
+
- **Error Visualization:** Errors are presented in a structured, easy-to-understand format with recovery suggestions
|
401
|
+
- **File Selection:** Interactive file browser for operations that require selecting files
|
402
|
+
|
403
|
+
To use the Rich UI, run Crackerjack with the `--rich-ui` flag:
|
404
|
+
|
405
|
+
```bash
|
406
|
+
python -m crackerjack --rich-ui
|
407
|
+
```
|
408
|
+
|
409
|
+
This launches an interactive terminal interface where you can:
|
410
|
+
1. View all available tasks and their dependencies
|
411
|
+
2. Confirm each task before execution
|
412
|
+
3. Get detailed status information for running tasks
|
413
|
+
4. See a summary of completed, failed, and skipped tasks
|
414
|
+
5. Visualize error details with recovery suggestions
|
415
|
+
|
416
|
+
## Structured Error Handling
|
417
|
+
|
418
|
+
Crackerjack implements a comprehensive error handling system that provides:
|
419
|
+
|
420
|
+
- **Error Categories:** Errors are categorized by type (configuration, execution, testing, etc.)
|
421
|
+
- **Error Codes:** Each error has a unique numeric code for easy reference
|
422
|
+
- **Detailed Messages:** Clear, descriptive messages explain what went wrong
|
423
|
+
- **Recovery Suggestions:** Where possible, errors include recovery suggestions to help resolve issues
|
424
|
+
- **Rich Formatting:** Errors are presented with clear visual formatting (when using Rich UI or verbose mode)
|
425
|
+
|
426
|
+
Error types include:
|
427
|
+
- Configuration errors (1000-1999)
|
428
|
+
- Execution errors (2000-2999)
|
429
|
+
- Test errors (3000-3999)
|
430
|
+
- Publishing errors (4000-4999)
|
431
|
+
- Git errors (5000-5999)
|
432
|
+
- File operation errors (6000-6999)
|
433
|
+
- Code cleaning errors (7000-7999)
|
434
|
+
- Generic errors (9000-9999)
|
435
|
+
|
436
|
+
Use the `-v` or `--verbose` flag to see more detailed error information:
|
437
|
+
|
438
|
+
```bash
|
439
|
+
python -m crackerjack -v
|
440
|
+
```
|
441
|
+
|
442
|
+
For the most comprehensive error details with visual formatting, combine verbose mode with the Rich UI:
|
443
|
+
|
444
|
+
```bash
|
445
|
+
python -m crackerjack --rich-ui -v
|
446
|
+
```
|
447
|
+
|
448
|
+
## Python 3.13+ Features
|
449
|
+
|
450
|
+
Crackerjack is designed to leverage the latest Python 3.13+ language features:
|
451
|
+
|
452
|
+
- **Type Parameter Syntax (PEP 695):** Uses the new, more concise syntax for generic type parameters
|
453
|
+
- **Self Type:** Leverages the `Self` type for better method chaining and builder patterns
|
454
|
+
- **Structural Pattern Matching:** Uses pattern matching for cleaner code, especially in configuration and command processing
|
455
|
+
- **Enhanced Type Hints:** More precise type hints with union types using the pipe operator
|
456
|
+
- **Modern Dictionary Patterns:** Leverages structural pattern matching with dictionaries for cleaner data handling
|
457
|
+
|
458
|
+
These modern Python features contribute to:
|
459
|
+
- More readable and maintainable code
|
460
|
+
- Better static type checking with tools like pyright
|
461
|
+
- Cleaner, more concise implementations
|
462
|
+
- Enhanced error handling and pattern recognition
|
463
|
+
|
464
|
+
Crackerjack provides examples of these features in action, serving as a reference for modern Python development practices.
|
465
|
+
|
374
466
|
## Contributing
|
375
467
|
|
376
468
|
Crackerjack is an evolving project. Contributions are welcome! Please open a pull request or issue.
|
Binary file
|
Binary file
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import typing as t
|
2
|
+
|
3
|
+
from .crackerjack import Crackerjack, create_crackerjack_runner
|
4
|
+
from .errors import (
|
5
|
+
CleaningError,
|
6
|
+
ConfigError,
|
7
|
+
CrackerjackError,
|
8
|
+
ErrorCode,
|
9
|
+
ExecutionError,
|
10
|
+
FileError,
|
11
|
+
GitError,
|
12
|
+
PublishError,
|
13
|
+
TestError,
|
14
|
+
check_command_result,
|
15
|
+
check_file_exists,
|
16
|
+
handle_error,
|
17
|
+
)
|
18
|
+
|
19
|
+
try:
|
20
|
+
from importlib.metadata import version
|
21
|
+
|
22
|
+
__version__ = version("crackerjack")
|
23
|
+
except (ImportError, ModuleNotFoundError):
|
24
|
+
__version__ = "0.19.8"
|
25
|
+
|
26
|
+
__all__: t.Sequence[str] = [
|
27
|
+
"create_crackerjack_runner",
|
28
|
+
"Crackerjack",
|
29
|
+
"__version__",
|
30
|
+
"CrackerjackError",
|
31
|
+
"ConfigError",
|
32
|
+
"ExecutionError",
|
33
|
+
"TestError",
|
34
|
+
"PublishError",
|
35
|
+
"GitError",
|
36
|
+
"FileError",
|
37
|
+
"CleaningError",
|
38
|
+
"ErrorCode",
|
39
|
+
"handle_error",
|
40
|
+
"check_file_exists",
|
41
|
+
"check_command_result",
|
42
|
+
]
|
@@ -38,6 +38,7 @@ class Options(BaseModel):
|
|
38
38
|
ai_agent: bool = False
|
39
39
|
create_pr: bool = False
|
40
40
|
skip_hooks: bool = False
|
41
|
+
rich_ui: bool = False
|
41
42
|
|
42
43
|
@classmethod
|
43
44
|
@field_validator("publish", "bump", mode="before")
|
@@ -84,7 +85,7 @@ cli_options = {
|
|
84
85
|
False,
|
85
86
|
"-x",
|
86
87
|
"--clean",
|
87
|
-
help="Remove docstrings, line comments, and unnecessary whitespace.",
|
88
|
+
help="Remove docstrings, line comments, and unnecessary whitespace from source code (doesn't affect test files).",
|
88
89
|
),
|
89
90
|
"test": typer.Option(False, "-t", "--test", help="Run tests."),
|
90
91
|
"benchmark": typer.Option(
|
@@ -121,6 +122,11 @@ cli_options = {
|
|
121
122
|
"--pr",
|
122
123
|
help="Create a pull request to the upstream repository.",
|
123
124
|
),
|
125
|
+
"rich_ui": typer.Option(
|
126
|
+
False,
|
127
|
+
"--rich-ui",
|
128
|
+
help="Use the interactive Rich UI for a better experience.",
|
129
|
+
),
|
124
130
|
"ai_agent": typer.Option(
|
125
131
|
False,
|
126
132
|
"--ai-agent",
|
@@ -150,6 +156,7 @@ def main(
|
|
150
156
|
],
|
151
157
|
skip_hooks: bool = cli_options["skip_hooks"],
|
152
158
|
create_pr: bool = cli_options["create_pr"],
|
159
|
+
rich_ui: bool = cli_options["rich_ui"],
|
153
160
|
ai_agent: bool = cli_options["ai_agent"],
|
154
161
|
) -> None:
|
155
162
|
options = Options(
|
@@ -170,6 +177,7 @@ def main(
|
|
170
177
|
all=all,
|
171
178
|
ai_agent=ai_agent,
|
172
179
|
create_pr=create_pr,
|
180
|
+
rich_ui=rich_ui,
|
173
181
|
)
|
174
182
|
|
175
183
|
if ai_agent:
|
@@ -177,8 +185,20 @@ def main(
|
|
177
185
|
|
178
186
|
os.environ["AI_AGENT"] = "1"
|
179
187
|
|
180
|
-
|
181
|
-
|
188
|
+
if rich_ui:
|
189
|
+
from crackerjack.interactive import launch_interactive_cli
|
190
|
+
|
191
|
+
try:
|
192
|
+
from importlib.metadata import version
|
193
|
+
|
194
|
+
pkg_version = version("crackerjack")
|
195
|
+
except (ImportError, ModuleNotFoundError):
|
196
|
+
pkg_version = "0.19.8"
|
197
|
+
|
198
|
+
launch_interactive_cli(pkg_version)
|
199
|
+
else:
|
200
|
+
runner = create_crackerjack_runner(console=console)
|
201
|
+
runner.process(options)
|
182
202
|
|
183
203
|
|
184
204
|
if __name__ == "__main__":
|