crackerjack 0.24.10__py3-none-any.whl → 0.26.0__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 crackerjack might be problematic. Click here for more details.

@@ -66,6 +66,13 @@ repos:
66
66
  - id: ruff-format
67
67
  verbose: true
68
68
 
69
+ - repo: https://github.com/executablebooks/mdformat
70
+ rev: 0.7.18
71
+ hooks:
72
+ - id: mdformat
73
+ additional_dependencies:
74
+ - mdformat-ruff
75
+
69
76
  # Code quality tier 2 - analysis
70
77
  - repo: https://github.com/jendrikseipp/vulture
71
78
  rev: 'v2.14'
@@ -22,7 +22,7 @@ repos:
22
22
 
23
23
  # Package management - once structure is valid
24
24
  - repo: https://github.com/astral-sh/uv-pre-commit
25
- rev: 0.7.20
25
+ rev: 0.7.21
26
26
  hooks:
27
27
  - id: uv-lock
28
28
  files: ^pyproject\.toml$
@@ -48,6 +48,13 @@ repos:
48
48
  - id: ruff-check
49
49
  - id: ruff-format
50
50
 
51
+ - repo: https://github.com/executablebooks/mdformat
52
+ rev: 0.7.22
53
+ hooks:
54
+ - id: mdformat
55
+ additional_dependencies:
56
+ - mdformat-ruff
57
+
51
58
  # Code quality tier 2 - analysis
52
59
  - repo: https://github.com/jendrikseipp/vulture
53
60
  rev: 'v2.14'
@@ -634,7 +634,7 @@ class CodeCleaner(BaseModel, arbitrary_types_allowed=True):
634
634
  temp_path.write_text(code)
635
635
  try:
636
636
  result = subprocess.run(
637
- ["ruff", "format", str(temp_path)],
637
+ ["uv", "run", "ruff", "format", str(temp_path)],
638
638
  check=False,
639
639
  capture_output=True,
640
640
  text=True,
@@ -887,7 +887,7 @@ class ProjectManager(BaseModel, arbitrary_types_allowed=True):
887
887
  self.execute_command(["git", "branch", "-m", "main"])
888
888
  self.execute_command(["git", "add", "pyproject.toml", "uv.lock"])
889
889
  self.execute_command(["git", "config", "advice.addIgnoredFile", "false"])
890
- install_cmd = ["pre-commit", "install"]
890
+ install_cmd = ["uv", "run", "pre-commit", "install"]
891
891
  if hasattr(self, "options") and getattr(self.options, "ai_agent", False):
892
892
  install_cmd.extend(["-c", ".pre-commit-config-ai.yaml"])
893
893
  self.execute_command(install_cmd)
@@ -899,7 +899,7 @@ class ProjectManager(BaseModel, arbitrary_types_allowed=True):
899
899
  "[bold bright_cyan]🔍 HOOKS[/bold bright_cyan] [bold bright_white]Running code quality checks[/bold bright_white]"
900
900
  )
901
901
  self.console.print("-" * 60 + "\n")
902
- cmd = ["pre-commit", "run", "--all-files"]
902
+ cmd = ["uv", "run", "pre-commit", "run", "--all-files"]
903
903
  if hasattr(self, "options") and getattr(self.options, "ai_agent", False):
904
904
  cmd.extend(["-c", ".pre-commit-config-ai.yaml"])
905
905
  check_all = self.execute_command(cmd)
@@ -990,7 +990,7 @@ class Crackerjack(BaseModel, arbitrary_types_allowed=True):
990
990
 
991
991
  def _update_precommit(self, options: t.Any) -> None:
992
992
  if self.pkg_path.stem == "crackerjack" and options.update_precommit:
993
- update_cmd = ["pre-commit", "autoupdate"]
993
+ update_cmd = ["uv", "run", "pre-commit", "autoupdate"]
994
994
  if options.ai_agent:
995
995
  update_cmd.extend(["-c", ".pre-commit-config-ai.yaml"])
996
996
  self.execute_command(update_cmd)
@@ -1076,7 +1076,7 @@ class Crackerjack(BaseModel, arbitrary_types_allowed=True):
1076
1076
  test.append("-xvs")
1077
1077
 
1078
1078
  def _prepare_pytest_command(self, options: OptionsProtocol) -> list[str]:
1079
- test = ["pytest"]
1079
+ test = ["uv", "run", "pytest"]
1080
1080
  project_size = self._detect_project_size()
1081
1081
  test_timeout = self._get_test_timeout(options, project_size)
1082
1082
  if getattr(options, "ai_agent", False):
@@ -4,7 +4,7 @@ requires = [ "hatchling" ]
4
4
 
5
5
  [project]
6
6
  name = "crackerjack"
7
- version = "0.24.9"
7
+ version = "0.25.0"
8
8
  description = "Crackerjack: code quality toolkit"
9
9
  readme = "README.md"
10
10
  keywords = [
@@ -46,6 +46,7 @@ dependencies = [
46
46
  "keyring>=25.6",
47
47
  "pre-commit>=4.2",
48
48
  "pydantic>=2.11.7",
49
+ "pyleak>=0.1.14",
49
50
  "pytest>=8.4.1",
50
51
  "pytest-asyncio>=1",
51
52
  "pytest-benchmark>=5.1",
@@ -128,6 +129,7 @@ markers = [
128
129
  "unit: marks test as a unit test",
129
130
  "benchmark: mark test as a benchmark (disables parallel execution)",
130
131
  "integration: marks test as an integration test",
132
+ "no_leaks: detect asyncio task leaks, thread leaks, and event loop blocking",
131
133
  ]
132
134
 
133
135
  # Default timeout settings
@@ -237,6 +239,7 @@ exclude-deps = [
237
239
  "keyring",
238
240
  "inflection",
239
241
  "pydantic-settings",
242
+ "pyleak",
240
243
  ]
241
244
 
242
245
  [tool.refurb]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crackerjack
3
- Version: 0.24.10
3
+ Version: 0.26.0
4
4
  Summary: Crackerjack: code quality toolkit
5
5
  Project-URL: documentation, https://github.com/lesleslie/crackerjack
6
6
  Project-URL: homepage, https://github.com/lesleslie/crackerjack
@@ -28,6 +28,7 @@ Requires-Dist: hatchling>=1.25
28
28
  Requires-Dist: keyring>=25.6
29
29
  Requires-Dist: pre-commit>=4.2
30
30
  Requires-Dist: pydantic>=2.11.7
31
+ Requires-Dist: pyleak>=0.1.14
31
32
  Requires-Dist: pytest-asyncio>=1
32
33
  Requires-Dist: pytest-benchmark>=5.1
33
34
  Requires-Dist: pytest-cov>=6.2.1
@@ -63,68 +64,80 @@ Crackerjack is an opinionated Python project management tool that streamlines th
63
64
  Crackerjack solves three critical challenges in Python development:
64
65
 
65
66
  1. **Project Setup & Configuration**
67
+
66
68
  - **Challenge**: Setting up Python projects with best practices requires knowledge of numerous tools and configurations
67
69
  - **Solution**: Crackerjack automates project initialization with pre-configured templates and industry best practices
68
70
 
69
- 2. **Code Quality & Consistency**
71
+ 1. **Code Quality & Consistency**
72
+
70
73
  - **Challenge**: Maintaining consistent code quality across a project and team requires constant vigilance
71
74
  - **Solution**: Crackerjack enforces a unified style through integrated linting, formatting, and pre-commit hooks
72
75
 
73
- 3. **Streamlined Publishing**
76
+ 1. **Streamlined Publishing**
77
+
74
78
  - **Challenge**: Publishing Python packages involves many manual, error-prone steps
75
79
  - **Solution**: Crackerjack automates the entire release process from testing to version bumping to publishing
76
80
 
77
81
  Crackerjack integrates powerful tools like Ruff, UV, pre-commit, pytest, and more into a cohesive system that ensures code quality, consistency, and reliability. It's designed for developers who value both productivity and excellence.
78
82
 
79
- ---
83
+ ______________________________________________________________________
80
84
 
81
85
  ## Getting Started
82
86
 
83
87
  ### Quick Start
84
88
 
85
89
  If you're new to Crackerjack, follow these steps:
90
+
86
91
  1. **Install Python 3.13:** Ensure you have Python 3.13 or higher installed.
87
- 2. **Install UV:**
88
- ```
89
- pipx install uv
90
- ```
91
- 3. **Install Crackerjack:**
92
- ```
93
- pip install crackerjack
94
- ```
95
-
96
- 4. **Initialize a New Project:**
97
- Navigate to your project's root directory and run:
98
- ```
99
- python -m crackerjack
100
- ```
101
-
102
- Or use the interactive Rich UI:
103
- ```
104
- python -m crackerjack -i
105
- ```
106
-
107
- ---
92
+
93
+ 1. **Install UV:**
94
+
95
+ ```
96
+ pipx install uv
97
+ ```
98
+
99
+ 1. **Install Crackerjack:**
100
+
101
+ ```
102
+ pip install crackerjack
103
+ ```
104
+
105
+ 1. **Initialize a New Project:**
106
+ Navigate to your project's root directory and run:
107
+
108
+ ```
109
+ python -m crackerjack
110
+ ```
111
+
112
+ Or use the interactive Rich UI:
113
+
114
+ ```
115
+ python -m crackerjack -i
116
+ ```
117
+
118
+ ______________________________________________________________________
108
119
 
109
120
  ## The Crackerjack Philosophy
110
121
 
111
122
  Crackerjack is built on the following core principles:
112
123
 
113
- - **Code Clarity:** Code should be easy to read, understand, and maintain.
114
- - **Automation:** Tedious tasks should be automated, allowing developers to focus on solving problems.
115
- - **Consistency:** Code style, formatting, and project structure should be consistent across projects.
116
- - **Reliability:** Tests are essential, and code should be checked rigorously.
117
- - **Tool Integration:** Leverage powerful existing tools instead of reinventing the wheel.
118
- - **Static Typing:** Static typing is essential for all development.
124
+ - **Code Clarity:** Code should be easy to read, understand, and maintain.
125
+ - **Automation:** Tedious tasks should be automated, allowing developers to focus on solving problems.
126
+ - **Consistency:** Code style, formatting, and project structure should be consistent across projects.
127
+ - **Reliability:** Tests are essential, and code should be checked rigorously.
128
+ - **Tool Integration:** Leverage powerful existing tools instead of reinventing the wheel.
129
+ - **Static Typing:** Static typing is essential for all development.
119
130
 
120
131
  ## Key Features
121
132
 
122
133
  ### Project Management
134
+
123
135
  - **Effortless Project Setup:** Initializes new Python projects with a standard directory structure, `pyproject.toml`, and essential configuration files
124
136
  - **UV Integration:** Manages dependencies and virtual environments using [UV](https://github.com/astral-sh/uv) for lightning-fast package operations
125
137
  - **Dependency Management:** Automatically detects and manages project dependencies
126
138
 
127
139
  ### Code Quality
140
+
128
141
  - **Automated Code Cleaning:** Removes unnecessary docstrings, line comments, and trailing whitespace
129
142
  - **Consistent Code Formatting:** Enforces a unified style using [Ruff](https://github.com/astral-sh/ruff), the lightning-fast Python linter and formatter
130
143
  - **Comprehensive Pre-commit Hooks:** Installs and manages a robust suite of pre-commit hooks (see the "Pre-commit Hooks" section below)
@@ -132,16 +145,19 @@ Crackerjack is built on the following core principles:
132
145
  - **Static Type Checking:** Enforces type safety with Pyright integration
133
146
 
134
147
  ### Testing & Deployment
148
+
135
149
  - **Built-in Testing:** Automatically runs tests using `pytest`
136
150
  - **Easy Version Bumping:** Provides commands to bump the project version (patch, minor, or major)
137
151
  - **Simplified Publishing:** Automates publishing to PyPI via UV
138
152
 
139
153
  ### Git Integration
154
+
140
155
  - **Commit and Push:** Commits and pushes your changes with standardized commit messages
141
156
  - **Pull Request Creation:** Creates pull requests to upstream repositories on GitHub or GitLab
142
157
  - **Pre-commit Integration:** Ensures code quality before commits
143
158
 
144
159
  ### Developer Experience
160
+
145
161
  - **Command-Line Interface:** Simple, intuitive CLI with comprehensive options
146
162
  - **Interactive Rich UI:** Visual workflow with real-time task tracking, progress visualization, and interactive prompts
147
163
  - **Structured Error Handling:** Clear error messages with error codes, detailed explanations, and recovery suggestions
@@ -154,37 +170,37 @@ Crackerjack is built on the following core principles:
154
170
 
155
171
  Crackerjack automatically installs and manages these pre-commit hooks:
156
172
 
157
- 1. **uv-lock:** Ensures the `uv.lock` file is up to date.
158
- 2. **Core pre-commit-hooks:** Essential hooks from [pre-commit-hooks](https://github.com/pre-commit/pre-commit-hooks) (e.g., `trailing-whitespace`, `end-of-file-fixer`).
159
- 3. **Ruff:** [Ruff](https://github.com/astral-sh/ruff) for linting, code formatting, and general code style enforcement.
160
- 4. **Vulture:** [Vulture](https://github.com/jendrikseipp/vulture) to identify dead code.
161
- 5. **Creosote:** [Creosote](https://github.com/fredrikaverpil/creosote) to detect unused dependencies.
162
- 6. **Complexipy:** [Complexipy](https://github.com/rohaquinlop/complexipy-pre-commit) for analyzing code complexity.
163
- 7. **Codespell:** [Codespell](https://github.com/codespell-project/codespell) for correcting typos in the code.
164
- 8. **Autotyping:** [Autotyping](https://github.com/JelleZijlstra/autotyping) for adding type hints.
165
- 9. **Refurb:** [Refurb](https://github.com/dosisod/refurb) to suggest code improvements.
166
- 10. **Bandit:** [Bandit](https://github.com/PyCQA/bandit) to identify potential security vulnerabilities.
167
- 11. **Pyright:** [Pyright](https://github.com/RobertCraigie/pyright-python) for static type checking.
168
- 12. **Ruff (again):** A final Ruff pass to ensure all changes comply with the enforced style.
173
+ 1. **uv-lock:** Ensures the `uv.lock` file is up to date.
174
+ 1. **Core pre-commit-hooks:** Essential hooks from [pre-commit-hooks](https://github.com/pre-commit/pre-commit-hooks) (e.g., `trailing-whitespace`, `end-of-file-fixer`).
175
+ 1. **Ruff:** [Ruff](https://github.com/astral-sh/ruff) for linting, code formatting, and general code style enforcement.
176
+ 1. **Vulture:** [Vulture](https://github.com/jendrikseipp/vulture) to identify dead code.
177
+ 1. **Creosote:** [Creosote](https://github.com/fredrikaverpil/creosote) to detect unused dependencies.
178
+ 1. **Complexipy:** [Complexipy](https://github.com/rohaquinlop/complexipy-pre-commit) for analyzing code complexity.
179
+ 1. **Codespell:** [Codespell](https://github.com/codespell-project/codespell) for correcting typos in the code.
180
+ 1. **Autotyping:** [Autotyping](https://github.com/JelleZijlstra/autotyping) for adding type hints.
181
+ 1. **Refurb:** [Refurb](https://github.com/dosisod/refurb) to suggest code improvements.
182
+ 1. **Bandit:** [Bandit](https://github.com/PyCQA/bandit) to identify potential security vulnerabilities.
183
+ 1. **Pyright:** [Pyright](https://github.com/RobertCraigie/pyright-python) for static type checking.
184
+ 1. **Ruff (again):** A final Ruff pass to ensure all changes comply with the enforced style.
169
185
 
170
186
  ## The Crackerjack Style Guide
171
187
 
172
188
  Crackerjack projects adhere to these guidelines:
173
189
 
174
- - **Static Typing:** Use type hints consistently throughout your code.
175
- - **Modern Type Hints:** Use the pipe operator (`|`) for union types (e.g., `Path | None` instead of `Optional[Path]`).
176
- - **Explicit Naming:** Choose clear, descriptive names for classes, functions, variables, and other identifiers.
177
- - **Markdown for Documentation:** Use Markdown (`.md`) for all documentation, READMEs, etc.
178
- - **Pathlib:** Use `pathlib.Path` for handling file and directory paths instead of `os.path`.
179
- - **Consistent Imports:** Use `import typing as t` for type hinting and prefix all typing references with `t.`.
180
- - **Protocol-Based Design:** Use `t.Protocol` for interface definitions instead of abstract base classes.
181
- - **Constants and Config:** Do not use all-caps for constants or configuration settings.
182
- - **Path Parameters:** Functions that handle file operations should accept `pathlib.Path` objects as parameters.
183
- - **Dependency Management:** Use UV for dependency management, package building, and publishing.
184
- - **Testing:** Use pytest as your testing framework.
185
- - **Python Version:** Crackerjack projects target Python 3.13+ and use the latest language features.
186
- - **Clear Code:** Avoid overly complex code.
187
- - **Modular:** Functions should do one thing well.
190
+ - **Static Typing:** Use type hints consistently throughout your code.
191
+ - **Modern Type Hints:** Use the pipe operator (`|`) for union types (e.g., `Path | None` instead of `Optional[Path]`).
192
+ - **Explicit Naming:** Choose clear, descriptive names for classes, functions, variables, and other identifiers.
193
+ - **Markdown for Documentation:** Use Markdown (`.md`) for all documentation, READMEs, etc.
194
+ - **Pathlib:** Use `pathlib.Path` for handling file and directory paths instead of `os.path`.
195
+ - **Consistent Imports:** Use `import typing as t` for type hinting and prefix all typing references with `t.`.
196
+ - **Protocol-Based Design:** Use `t.Protocol` for interface definitions instead of abstract base classes.
197
+ - **Constants and Config:** Do not use all-caps for constants or configuration settings.
198
+ - **Path Parameters:** Functions that handle file operations should accept `pathlib.Path` objects as parameters.
199
+ - **Dependency Management:** Use UV for dependency management, package building, and publishing.
200
+ - **Testing:** Use pytest as your testing framework.
201
+ - **Python Version:** Crackerjack projects target Python 3.13+ and use the latest language features.
202
+ - **Clear Code:** Avoid overly complex code.
203
+ - **Modular:** Functions should do one thing well.
188
204
 
189
205
  ## Testing Features
190
206
 
@@ -208,6 +224,7 @@ Crackerjack offers fine-grained control over test execution:
208
224
  - **Progress Tracking:** Shows periodic heartbeat messages for long-running tests
209
225
 
210
226
  Example test execution options:
227
+
211
228
  ```bash
212
229
  # Run tests with a single worker (no parallelization)
213
230
  python -m crackerjack -t --test-workers=1
@@ -233,12 +250,14 @@ Crackerjack includes benchmark testing capabilities:
233
250
  - **CI Integration:** Track performance across commits with benchmark history
234
251
 
235
252
  When benchmarks are run, Crackerjack:
253
+
236
254
  1. Disables parallel test execution (as pytest-benchmark is incompatible with pytest-xdist)
237
- 2. Configures the pytest-benchmark plugin with optimized settings
238
- 3. Compares benchmark results against previous runs when regression testing is enabled
239
- 4. Fails tests if performance decreases beyond the specified threshold
255
+ 1. Configures the pytest-benchmark plugin with optimized settings
256
+ 1. Compares benchmark results against previous runs when regression testing is enabled
257
+ 1. Fails tests if performance decreases beyond the specified threshold
240
258
 
241
259
  Example benchmark usage:
260
+
242
261
  ```bash
243
262
  # Run benchmarks
244
263
  python -m crackerjack -t --benchmark
@@ -252,24 +271,27 @@ python -m crackerjack -t --benchmark-regression --benchmark-regression-threshold
252
271
 
253
272
  ## Installation
254
273
 
255
- 1. **Python:** Ensure you have Python 3.13 or higher installed.
256
- 2. **UV:** Install [UV](https://github.com/astral-sh/uv) using `pipx`:
274
+ 1. **Python:** Ensure you have Python 3.13 or higher installed.
275
+
276
+ 1. **UV:** Install [UV](https://github.com/astral-sh/uv) using `pipx`:
257
277
 
258
- ```
259
- pipx install uv
260
- ```
278
+ ```
279
+ pipx install uv
280
+ ```
261
281
 
262
- 3. **Crackerjack:** Install Crackerjack and initialize in your project root using:
263
- ```
264
- pip install crackerjack
265
- cd your_project_root
266
- python -m crackerjack
267
- ```
282
+ 1. **Crackerjack:** Install Crackerjack and initialize in your project root using:
268
283
 
269
- Or with the interactive Rich UI:
270
- ```
271
- python -m crackerjack -i
272
- ```
284
+ ```
285
+ pip install crackerjack
286
+ cd your_project_root
287
+ python -m crackerjack
288
+ ```
289
+
290
+ Or with the interactive Rich UI:
291
+
292
+ ```
293
+ python -m crackerjack -i
294
+ ```
273
295
 
274
296
  ## Usage
275
297
 
@@ -277,7 +299,9 @@ python -m crackerjack -t --benchmark-regression --benchmark-regression-threshold
277
299
 
278
300
  Run Crackerjack from the root of your Python project using:
279
301
 
280
- python -m crackerjack
302
+ ```
303
+ python -m crackerjack
304
+ ```
281
305
 
282
306
  ### Programmatic API
283
307
 
@@ -289,89 +313,96 @@ from pathlib import Path
289
313
  from rich.console import Console
290
314
  from crackerjack import create_crackerjack_runner
291
315
 
316
+
292
317
  # Create a custom options object
293
318
  class MyOptions:
294
319
  def __init__(self):
295
320
  # Core options
296
- self.commit = False # Commit changes to Git
297
- self.interactive = True # Run pre-commit hooks interactively
298
- self.verbose = True # Enable verbose output
321
+ self.commit = False # Commit changes to Git
322
+ self.interactive = True # Run pre-commit hooks interactively
323
+ self.verbose = True # Enable verbose output
299
324
 
300
325
  # Configuration options
301
326
  self.no_config_updates = False # Skip updating config files
302
- self.update_precommit = False # Update pre-commit hooks
327
+ self.update_precommit = False # Update pre-commit hooks
303
328
 
304
329
  # Process options
305
- self.clean = True # Clean code (remove docstrings, comments, etc.)
306
- self.test = True # Run tests using pytest
307
- self.skip_hooks = False # Skip running pre-commit hooks
330
+ self.clean = True # Clean code (remove docstrings, comments, etc.)
331
+ self.test = True # Run tests using pytest
332
+ self.skip_hooks = False # Skip running pre-commit hooks
308
333
 
309
334
  # Test execution options
310
- self.test_workers = 2 # Number of parallel workers (0 = auto-detect, 1 = disable parallelization)
311
- self.test_timeout = 120 # Timeout in seconds for individual tests (0 = use default based on project size)
335
+ self.test_workers = 2 # Number of parallel workers (0 = auto-detect, 1 = disable parallelization)
336
+ self.test_timeout = 120 # Timeout in seconds for individual tests (0 = use default based on project size)
312
337
 
313
338
  # Benchmark options
314
- self.benchmark = False # Run tests in benchmark mode
315
- self.benchmark_regression = False # Fail tests if benchmarks regress beyond threshold
316
- self.benchmark_regression_threshold = 5.0 # Threshold percentage for benchmark regression
339
+ self.benchmark = False # Run tests in benchmark mode
340
+ self.benchmark_regression = (
341
+ False # Fail tests if benchmarks regress beyond threshold
342
+ )
343
+ self.benchmark_regression_threshold = (
344
+ 5.0 # Threshold percentage for benchmark regression
345
+ )
317
346
 
318
347
  # Version and publishing options
319
- self.publish = None # Publish to PyPI (patch, minor, major)
320
- self.bump = "patch" # Bump version (patch, minor, major)
321
- self.all = None # Run with -x -t -p <version> -c
348
+ self.publish = None # Publish to PyPI (patch, minor, major)
349
+ self.bump = "patch" # Bump version (patch, minor, major)
350
+ self.all = None # Run with -x -t -p <version> -c
322
351
 
323
352
  # Git options
324
- self.create_pr = False # Create a pull request
353
+ self.create_pr = False # Create a pull request
325
354
 
326
355
  # Integration options
327
- self.ai_agent = False # Enable AI agent structured output
356
+ self.ai_agent = False # Enable AI agent structured output
357
+
328
358
 
329
359
  # Create a Crackerjack runner with custom settings
330
360
  runner = create_crackerjack_runner(
331
361
  console=Console(force_terminal=True), # Rich console for pretty output
332
- pkg_path=Path.cwd(), # Path to your project
333
- python_version="3.13", # Target Python version
334
- dry_run=False # Set to True to simulate without changes
362
+ pkg_path=Path.cwd(), # Path to your project
363
+ python_version="3.13", # Target Python version
364
+ dry_run=False, # Set to True to simulate without changes
335
365
  )
336
366
 
337
367
  # Run Crackerjack with your options
338
368
  runner.process(MyOptions())
339
369
  ```
340
370
 
341
-
342
371
  ### Command-Line Options
343
372
 
344
- - `-c`, `--commit`: Commit changes to Git.
345
- - `-i`, `--interactive`: Run pre-commit hooks interactively when possible.
346
- - `-n`, `--no-config-updates`: Skip updating configuration files (e.g., `pyproject.toml`).
347
- - `-u`, `--update-precommit`: Update pre-commit hooks to the latest versions.
348
- - `-v`, `--verbose`: Enable verbose output.
349
- - `-p`, `--publish <patch|minor|major>`: Bump the project version and publish to PyPI using UV.
350
- - `-b`, `--bump <patch|minor|major>`: Bump the project version without publishing.
351
- - `-r`, `--pr`: Create a pull request to the upstream repository.
352
- - `-s`, `--skip-hooks`: Skip running pre-commit hooks (useful with `-t`).
353
- - `-x`, `--clean`: Clean code by removing docstrings, line comments, and extra whitespace.
354
- - `-t`, `--test`: Run tests using `pytest`.
355
- - `--test-workers`: Set the number of parallel workers for testing (0 = auto-detect, 1 = disable parallelization).
356
- - `--test-timeout`: Set the timeout in seconds for individual tests (0 = use default based on project size).
357
- - `--benchmark`: Run tests in benchmark mode (disables parallel execution).
358
- - `--benchmark-regression`: Fail tests if benchmarks regress beyond threshold.
359
- - `--benchmark-regression-threshold`: Set threshold percentage for benchmark regression (default 5.0%).
360
- - `-a`, `--all`: Run with `-x -t -p <patch|minor|major> -c` development options.
361
- - `-i`, `--interactive`: Enable the interactive Rich UI for a more user-friendly experience with visual progress tracking and interactive prompts.
362
- - `--ai-agent`: Enable AI agent mode with structured output (see [AI Agent Integration](#ai-agent-integration)).
363
- - `--help`: Display help.
373
+ - `-c`, `--commit`: Commit changes to Git.
374
+ - `-i`, `--interactive`: Run pre-commit hooks interactively when possible.
375
+ - `-n`, `--no-config-updates`: Skip updating configuration files (e.g., `pyproject.toml`).
376
+ - `-u`, `--update-precommit`: Update pre-commit hooks to the latest versions.
377
+ - `-v`, `--verbose`: Enable verbose output.
378
+ - `-p`, `--publish <patch|minor|major>`: Bump the project version and publish to PyPI using UV.
379
+ - `-b`, `--bump <patch|minor|major>`: Bump the project version without publishing.
380
+ - `-r`, `--pr`: Create a pull request to the upstream repository.
381
+ - `-s`, `--skip-hooks`: Skip running pre-commit hooks (useful with `-t`).
382
+ - `-x`, `--clean`: Clean code by removing docstrings, line comments, and extra whitespace.
383
+ - `-t`, `--test`: Run tests using `pytest`.
384
+ - `--test-workers`: Set the number of parallel workers for testing (0 = auto-detect, 1 = disable parallelization).
385
+ - `--test-timeout`: Set the timeout in seconds for individual tests (0 = use default based on project size).
386
+ - `--benchmark`: Run tests in benchmark mode (disables parallel execution).
387
+ - `--benchmark-regression`: Fail tests if benchmarks regress beyond threshold.
388
+ - `--benchmark-regression-threshold`: Set threshold percentage for benchmark regression (default 5.0%).
389
+ - `-a`, `--all`: Run with `-x -t -p <patch|minor|major> -c` development options.
390
+ - `-i`, `--interactive`: Enable the interactive Rich UI for a more user-friendly experience with visual progress tracking and interactive prompts.
391
+ - `--ai-agent`: Enable AI agent mode with structured output (see [AI Agent Integration](#ai-agent-integration)).
392
+ - `--help`: Display help.
364
393
 
365
394
  ### Example Workflows
366
395
 
367
396
  #### Development Workflows
368
397
 
369
398
  - **Quick Check** - Run basic checks on your code:
399
+
370
400
  ```bash
371
401
  python -m crackerjack
372
402
  ```
373
403
 
374
404
  - **Full Development Cycle** - Clean, test, bump version, publish, and commit:
405
+
375
406
  ```bash
376
407
  python -m crackerjack -a minor # All-in-one command
377
408
 
@@ -380,11 +411,13 @@ runner.process(MyOptions())
380
411
  ```
381
412
 
382
413
  - **Development with Tests** - Clean code, run checks, run tests, then commit:
414
+
383
415
  ```bash
384
416
  python -m crackerjack -c -x -t
385
417
  ```
386
418
 
387
419
  - **Fast Testing** - Run tests without running pre-commit hooks:
420
+
388
421
  ```bash
389
422
  python -m crackerjack -t -s
390
423
  ```
@@ -392,21 +425,25 @@ runner.process(MyOptions())
392
425
  #### Test Execution Options
393
426
 
394
427
  - **Single-Process Testing** - Run tests sequentially (no parallelization):
428
+
395
429
  ```bash
396
430
  python -m crackerjack -t --test-workers=1
397
431
  ```
398
432
 
399
433
  - **Customized Parallel Testing** - Run tests with a specific number of workers:
434
+
400
435
  ```bash
401
436
  python -m crackerjack -t --test-workers=4
402
437
  ```
403
438
 
404
439
  - **Long-Running Tests** - Increase test timeout for complex tests:
440
+
405
441
  ```bash
406
442
  python -m crackerjack -t --test-timeout=600
407
443
  ```
408
444
 
409
445
  - **Optimized for Large Projects** - Reduce workers and increase timeout for large codebases:
446
+
410
447
  ```bash
411
448
  python -m crackerjack -t --test-workers=2 --test-timeout=300
412
449
  ```
@@ -414,6 +451,7 @@ runner.process(MyOptions())
414
451
  #### Version Management
415
452
 
416
453
  - **Bump and Publish** - Bump version and publish to PyPI:
454
+
417
455
  ```bash
418
456
  python -m crackerjack -p patch # For patch version
419
457
  python -m crackerjack -p minor # For minor version
@@ -421,6 +459,7 @@ runner.process(MyOptions())
421
459
  ```
422
460
 
423
461
  - **Version Bump Only** - Bump version without publishing:
462
+
424
463
  ```bash
425
464
  python -m crackerjack -b major
426
465
  ```
@@ -428,11 +467,13 @@ runner.process(MyOptions())
428
467
  #### Configuration Management
429
468
 
430
469
  - **Skip Config Updates** - Run checks without updating configuration files:
470
+
431
471
  ```bash
432
472
  python -m crackerjack -n
433
473
  ```
434
474
 
435
475
  - **Update Hooks** - Update pre-commit hooks to latest versions:
476
+
436
477
  ```bash
437
478
  python -m crackerjack -u
438
479
  ```
@@ -440,11 +481,13 @@ runner.process(MyOptions())
440
481
  #### Git Operations
441
482
 
442
483
  - **Commit Changes** - Run checks and commit changes:
484
+
443
485
  ```bash
444
486
  python -m crackerjack -c
445
487
  ```
446
488
 
447
489
  - **Create PR** - Create a pull request to the upstream repository:
490
+
448
491
  ```bash
449
492
  python -m crackerjack -r
450
493
  ```
@@ -452,21 +495,25 @@ runner.process(MyOptions())
452
495
  #### Other Operations
453
496
 
454
497
  - **Interactive Mode** - Run pre-commit hooks interactively:
498
+
455
499
  ```bash
456
500
  python -m crackerjack -i
457
501
  ```
458
502
 
459
503
  - **Rich Interactive Mode** - Run with the interactive Rich UI:
504
+
460
505
  ```bash
461
506
  python -m crackerjack -i
462
507
  ```
463
508
 
464
509
  - **AI Integration** - Run with structured output for AI tools:
510
+
465
511
  ```bash
466
512
  python -m crackerjack --ai-agent --test
467
513
  ```
468
514
 
469
515
  - **Help** - Display command help:
516
+
470
517
  ```bash
471
518
  python -m crackerjack --help
472
519
  ```
@@ -504,11 +551,12 @@ python -m crackerjack -i
504
551
  ```
505
552
 
506
553
  This launches an interactive terminal interface where you can:
554
+
507
555
  1. View all available tasks and their dependencies
508
- 2. Confirm each task before execution
509
- 3. Get detailed status information for running tasks
510
- 4. See a summary of completed, failed, and skipped tasks
511
- 5. Visualize error details with recovery suggestions
556
+ 1. Confirm each task before execution
557
+ 1. Get detailed status information for running tasks
558
+ 1. See a summary of completed, failed, and skipped tasks
559
+ 1. Visualize error details with recovery suggestions
512
560
 
513
561
  ## Structured Error Handling
514
562
 
@@ -521,6 +569,7 @@ Crackerjack implements a comprehensive error handling system that provides:
521
569
  - **Rich Formatting:** Errors are presented with clear visual formatting (when using Rich UI or verbose mode)
522
570
 
523
571
  Error types include:
572
+
524
573
  - Configuration errors (1000-1999)
525
574
  - Execution errors (2000-2999)
526
575
  - Test errors (3000-3999)
@@ -553,6 +602,7 @@ Crackerjack is designed to leverage the latest Python 3.13+ language features:
553
602
  - **Modern Dictionary Patterns:** Leverages structural pattern matching with dictionaries for cleaner data handling
554
603
 
555
604
  These modern Python features contribute to:
605
+
556
606
  - More readable and maintainable code
557
607
  - Better static type checking with tools like pyright
558
608
  - Cleaner, more concise implementations
@@ -567,14 +617,16 @@ Crackerjack is an evolving project. Contributions are welcome! Please open a pul
567
617
  To contribute:
568
618
 
569
619
  1. Add Crackerjack as a development dependency to your project:
570
- ```
571
- uv add --dev crackerjack
572
- ```
620
+
621
+ ```
622
+ uv add --dev crackerjack
623
+ ```
573
624
 
574
625
  2. Run checks and tests before submitting:
575
- ```
576
- python -m crackerjack -x -t
577
- ```
626
+
627
+ ```
628
+ python -m crackerjack -x -t
629
+ ```
578
630
 
579
631
  This ensures your code meets all quality standards before submission.
580
632
 
@@ -598,12 +650,14 @@ Crackerjack is designed with modern Python principles in mind:
598
650
  Crackerjack stands on the shoulders of giants. We're grateful to the maintainers and contributors of these outstanding tools that make modern Python development possible:
599
651
 
600
652
  ### Core Development Tools
653
+
601
654
  - **[UV](https://docs.astral.sh/uv/)** - Next-generation Python package and project management
602
655
  - **[Ruff](https://docs.astral.sh/ruff/)** - Lightning-fast Python linter and formatter written in Rust
603
656
  - **[pyright](https://microsoft.github.io/pyright/)** - Fast, feature-rich static type checker for Python
604
657
  - **[pytest](https://pytest.org/)** - Flexible and powerful testing framework
605
658
 
606
659
  ### Code Quality & Security
660
+
607
661
  - **[pre-commit](https://pre-commit.com/)** - Multi-language pre-commit hooks framework
608
662
  - **[bandit](https://bandit.readthedocs.io/)** - Security vulnerability scanner for Python
609
663
  - **[vulture](https://github.com/jendrikseipp/vulture)** - Dead code detection tool
@@ -612,26 +666,31 @@ Crackerjack stands on the shoulders of giants. We're grateful to the maintainers
612
666
  - **[detect-secrets](https://github.com/Yelp/detect-secrets)** - Prevention of secrets in repositories
613
667
 
614
668
  ### Dependencies & Project Management
669
+
615
670
  - **[creosote](https://github.com/fredrikaverpil/creosote)** - Unused dependency detection
616
671
  - **[autotyping](https://github.com/JelleZijlstra/autotyping)** - Automatic type hint generation
617
672
  - **[complexipy](https://github.com/rohaquinlop/complexipy)** - Code complexity analysis
618
673
 
619
674
  ### CLI & User Interface
675
+
620
676
  - **[Typer](https://typer.tiangolo.com/)** - Modern CLI framework for building command-line interfaces
621
677
  - **[Rich](https://rich.readthedocs.io/)** - Rich text and beautiful formatting in the terminal
622
678
  - **[click](https://click.palletsprojects.com/)** - Python package for creating command line interfaces
623
679
 
624
680
  ### Performance & Development Tools
681
+
625
682
  - **[icecream](https://github.com/gruns/icecream)** - Sweet and creamy print debugging
626
683
  - **[bevy](https://github.com/ZeroIntensity/bevy)** - Lightweight dependency injection framework
627
684
  - **[msgspec](https://github.com/jcrist/msgspec)** - High-performance message serialization
628
685
  - **[attrs](https://github.com/python-attrs/attrs)** - Classes without boilerplate
629
686
 
630
687
  ### Development Environment
688
+
631
689
  - **[PyCharm](https://www.jetbrains.com/pycharm/)** - The premier Python IDE that powered the development of Crackerjack
632
690
  - **[Claude Code](https://claude.ai/code)** - AI-powered development assistant that accelerated development and ensured code quality
633
691
 
634
692
  ### Legacy Inspiration
693
+
635
694
  - **[PDM](https://pdm.fming.dev/)** - Original inspiration for modern Python dependency management patterns
636
695
 
637
696
  ### Special Recognition
@@ -642,4 +701,4 @@ The integration of these tools into Crackerjack's unified workflow demonstrates
642
701
 
643
702
  We're honored to build upon this foundation and contribute to the Python community's continued evolution toward better development practices and tools.
644
703
 
645
- ---
704
+ ______________________________________________________________________
@@ -0,0 +1,16 @@
1
+ crackerjack/.gitignore,sha256=n8cD6U16L3XZn__PvhYm_F7-YeFHFucHCyxWj2NZCGs,259
2
+ crackerjack/.libcst.codemod.yaml,sha256=a8DlErRAIPV1nE6QlyXPAzTOgkB24_spl2E9hphuf5s,772
3
+ crackerjack/.pdm.toml,sha256=dZe44HRcuxxCFESGG8SZIjmc-cGzSoyK3Hs6t4NYA8w,23
4
+ crackerjack/.pre-commit-config-ai.yaml,sha256=0TDQp0HIiRiy5q09H0ytJk3M6l3rLOdJNWHgkHIRCGA,3274
5
+ crackerjack/.pre-commit-config.yaml,sha256=gXFolNsl6aBeyAefmJ6igmwaNtUHjyfziocBDiulRwU,2642
6
+ crackerjack/__init__.py,sha256=8tBSPAru_YDuPpjz05cL7pNbZjYFoRT_agGd_FWa3gY,839
7
+ crackerjack/__main__.py,sha256=-h6Au8CGHS9QdzzbDMGzKHAlNEx7cYmzCrV4g4vV19k,6407
8
+ crackerjack/crackerjack.py,sha256=iYzhBdEvhCdyrqv-t0jQ862JNn3rwV15P2beaOzu3zs,49463
9
+ crackerjack/errors.py,sha256=Wcv0rXfzV9pHOoXYrhQEjyJd4kUUBbdiY-5M9nI8pDw,4050
10
+ crackerjack/interactive.py,sha256=pFItgRUyjOakABLCRz6nIp6_Ycx2LBSeojpYNiTelv0,16126
11
+ crackerjack/py313.py,sha256=buYE7LO11Q64ffowEhTZRFQoAGj_8sg3DTlZuv8M9eo,5890
12
+ crackerjack/pyproject.toml,sha256=twaeui2pJCQnpe92JN1ACxUEHJrGb4T6F6m2Jazc4JI,5401
13
+ crackerjack-0.26.0.dist-info/METADATA,sha256=m2Xb72Fq2Py8_QE_Lu61MccpxVMYZtspu75sZ4M7l00,28758
14
+ crackerjack-0.26.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
+ crackerjack-0.26.0.dist-info/licenses/LICENSE,sha256=fDt371P6_6sCu7RyqiZH_AhT1LdN3sN1zjBtqEhDYCk,1531
16
+ crackerjack-0.26.0.dist-info/RECORD,,
@@ -1,16 +0,0 @@
1
- crackerjack/.gitignore,sha256=n8cD6U16L3XZn__PvhYm_F7-YeFHFucHCyxWj2NZCGs,259
2
- crackerjack/.libcst.codemod.yaml,sha256=a8DlErRAIPV1nE6QlyXPAzTOgkB24_spl2E9hphuf5s,772
3
- crackerjack/.pdm.toml,sha256=dZe44HRcuxxCFESGG8SZIjmc-cGzSoyK3Hs6t4NYA8w,23
4
- crackerjack/.pre-commit-config-ai.yaml,sha256=kPAU41yuX8XU00HDl6Y2mX-L3aLMYTNo8fnFWEZE4mM,3112
5
- crackerjack/.pre-commit-config.yaml,sha256=KwzEBj84K5Vp09aYXlk2H7LFlMJl6jToOl8q4u3IxuU,2480
6
- crackerjack/__init__.py,sha256=8tBSPAru_YDuPpjz05cL7pNbZjYFoRT_agGd_FWa3gY,839
7
- crackerjack/__main__.py,sha256=-h6Au8CGHS9QdzzbDMGzKHAlNEx7cYmzCrV4g4vV19k,6407
8
- crackerjack/crackerjack.py,sha256=Awvebtc6IZ00FUcTb7fyCTlTDoX-XqNn21VrMQJSPYk,49398
9
- crackerjack/errors.py,sha256=Wcv0rXfzV9pHOoXYrhQEjyJd4kUUBbdiY-5M9nI8pDw,4050
10
- crackerjack/interactive.py,sha256=pFItgRUyjOakABLCRz6nIp6_Ycx2LBSeojpYNiTelv0,16126
11
- crackerjack/py313.py,sha256=buYE7LO11Q64ffowEhTZRFQoAGj_8sg3DTlZuv8M9eo,5890
12
- crackerjack/pyproject.toml,sha256=VdE3zYoNgCdHEVZRi6kfoLvk22zeo7no3XZbw7ZqfXU,5283
13
- crackerjack-0.24.10.dist-info/METADATA,sha256=1qzw5hiz4yGCbJ99Sbuxvr-93bhGecrbQeZZ4-dCqyo,28712
14
- crackerjack-0.24.10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
15
- crackerjack-0.24.10.dist-info/licenses/LICENSE,sha256=fDt371P6_6sCu7RyqiZH_AhT1LdN3sN1zjBtqEhDYCk,1531
16
- crackerjack-0.24.10.dist-info/RECORD,,