crackerjack 0.24.8__tar.gz → 0.24.10__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.
Potentially problematic release.
This version of crackerjack might be problematic. Click here for more details.
- {crackerjack-0.24.8 → crackerjack-0.24.10}/CLAUDE.md +135 -13
- {crackerjack-0.24.8 → crackerjack-0.24.10}/PKG-INFO +47 -15
- {crackerjack-0.24.8 → crackerjack-0.24.10}/README.md +46 -14
- {crackerjack-0.24.8 → crackerjack-0.24.10}/crackerjack/pyproject.toml +1 -1
- {crackerjack-0.24.8 → crackerjack-0.24.10}/pyproject.toml +1 -1
- {crackerjack-0.24.8 → crackerjack-0.24.10}/uv.lock +1 -1
- crackerjack-0.24.8/.windsurfrules +0 -188
- {crackerjack-0.24.8 → crackerjack-0.24.10}/.envrc +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/.github/FUNDING.yml +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/.gitignore +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/.libcst.codemod.yaml +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/.pre-commit-config-ai.yaml +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/.pre-commit-config.yaml +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/LICENSE +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/README-AI-AGENT.md +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/RULES.md +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/crackerjack/.gitignore +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/crackerjack/.libcst.codemod.yaml +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/crackerjack/.pdm.toml +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/crackerjack/.pre-commit-config-ai.yaml +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/crackerjack/.pre-commit-config.yaml +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/crackerjack/__init__.py +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/crackerjack/__main__.py +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/crackerjack/crackerjack.py +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/crackerjack/errors.py +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/crackerjack/interactive.py +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/crackerjack/py313.py +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/tests/TESTING.md +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/tests/__init__.py +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/tests/conftest.py +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/tests/data/comments_sample.txt +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/tests/data/docstrings_sample.txt +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/tests/data/expected_comments_sample.txt +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/tests/data/init.py +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/tests/test_crackerjack.py +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/tests/test_crackerjack_runner.py +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/tests/test_errors.py +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/tests/test_interactive.py +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/tests/test_interactive_run.py +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/tests/test_main.py +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/tests/test_multiline_functions.py +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/tests/test_py313_advanced.py +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/tests/test_py313_features.py +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/tests/test_pytest_features.py +0 -0
- {crackerjack-0.24.8 → crackerjack-0.24.10}/tests/test_structured_errors.py +0 -0
|
@@ -16,6 +16,12 @@ pipx install uv
|
|
|
16
16
|
|
|
17
17
|
# Install project dependencies
|
|
18
18
|
uv sync
|
|
19
|
+
|
|
20
|
+
# Run individual tools through UV (ensures proper environment isolation)
|
|
21
|
+
uv run pytest
|
|
22
|
+
uv run pyright
|
|
23
|
+
uv run ruff check
|
|
24
|
+
uv run pre-commit run --all-files
|
|
19
25
|
```
|
|
20
26
|
|
|
21
27
|
### Running Crackerjack
|
|
@@ -120,25 +126,34 @@ Crackerjack is designed with modern Python principles and consists of several ke
|
|
|
120
126
|
1. **Crackerjack** (`crackerjack.py`): Main class that orchestrates the entire workflow
|
|
121
127
|
- Manages configuration updates
|
|
122
128
|
- Runs pre-commit hooks
|
|
123
|
-
- Handles code cleaning
|
|
124
|
-
- Executes tests
|
|
129
|
+
- Handles code cleaning (with enhanced error handling)
|
|
130
|
+
- Executes tests with dynamic parallelization
|
|
125
131
|
- Manages version bumping and publishing
|
|
126
132
|
- Handles Git operations
|
|
133
|
+
- Integrates with Rich console for status output
|
|
127
134
|
|
|
128
135
|
2. **CodeCleaner**: Responsible for cleaning code
|
|
129
|
-
- Removes docstrings
|
|
136
|
+
- Removes docstrings (with syntax-aware pass statement insertion)
|
|
130
137
|
- Removes line comments
|
|
131
138
|
- Removes extra whitespace
|
|
132
139
|
- Reformats code using Ruff
|
|
140
|
+
- Handles file encoding issues gracefully
|
|
133
141
|
|
|
134
142
|
3. **ConfigManager**: Handles configuration file management
|
|
135
143
|
- Updates pyproject.toml settings
|
|
136
144
|
- Manages configuration files (.gitignore, .pre-commit-config.yaml)
|
|
145
|
+
- Supports dynamic configuration based on project size
|
|
137
146
|
|
|
138
147
|
4. **ProjectManager**: Manages project-level operations
|
|
139
148
|
- Runs pre-commit hooks
|
|
140
149
|
- Updates package configurations
|
|
141
150
|
- Runs interactive hooks
|
|
151
|
+
- Detects project size for optimization
|
|
152
|
+
|
|
153
|
+
5. **ErrorHandler** (`errors.py`): Structured error handling system
|
|
154
|
+
- Provides consistent error codes and messages
|
|
155
|
+
- Handles graceful degradation on failures
|
|
156
|
+
- Supports both fatal and non-fatal error patterns
|
|
142
157
|
|
|
143
158
|
### Key Design Patterns
|
|
144
159
|
|
|
@@ -150,14 +165,15 @@ Crackerjack is designed with modern Python principles and consists of several ke
|
|
|
150
165
|
|
|
151
166
|
Crackerjack has a robust testing setup with:
|
|
152
167
|
|
|
153
|
-
- **Test Configuration**: Customizes pytest through conftest.py
|
|
154
|
-
- **Benchmark Support**: Special handling for benchmark tests
|
|
168
|
+
- **Test Configuration**: Customizes pytest through conftest.py with asyncio_mode="auto"
|
|
169
|
+
- **Benchmark Support**: Special handling for benchmark tests (disabled in parallel execution)
|
|
155
170
|
- **Smart Parallelization**: Adjusts the number of workers based on project size
|
|
156
171
|
- **Project Size Detection**: Automatically detects project size to optimize test execution
|
|
157
|
-
- **Timeout Protection**: Tests have dynamic timeouts based on project size
|
|
172
|
+
- **Timeout Protection**: Tests have dynamic timeouts based on project size (default 300s)
|
|
158
173
|
- **Deadlock Prevention**: Advanced threading techniques to prevent deadlocks
|
|
159
174
|
- **Progress Tracking**: Shows periodic heartbeat messages for long-running tests
|
|
160
175
|
- **AI Agent Integration**: Generates structured output files (JUnit XML, JSON coverage, benchmark JSON) when `--ai-agent` flag is used
|
|
176
|
+
- **Async Testing**: Configured for asyncio-based tests with automatic mode detection
|
|
161
177
|
|
|
162
178
|
### Interactive Mode
|
|
163
179
|
|
|
@@ -181,6 +197,24 @@ The interactive mode runs a predefined workflow with tasks:
|
|
|
181
197
|
|
|
182
198
|
Access interactive mode with: `python -m crackerjack -i`
|
|
183
199
|
|
|
200
|
+
## Module Organization
|
|
201
|
+
|
|
202
|
+
Crackerjack follows a single-file architecture for simplicity and maintainability:
|
|
203
|
+
|
|
204
|
+
### File Structure
|
|
205
|
+
- `crackerjack.py` - Main module (~3000 lines) containing all core functionality
|
|
206
|
+
- `errors.py` - Structured error handling system
|
|
207
|
+
- `interactive.py` - Rich-based interactive UI implementation
|
|
208
|
+
- `py313.py` - Python 3.13+ specific feature detection
|
|
209
|
+
- `__main__.py` - Entry point for `python -m crackerjack`
|
|
210
|
+
|
|
211
|
+
### Key Implementation Details
|
|
212
|
+
- **Single-file Design**: Most functionality concentrated in `crackerjack.py` for easier maintenance
|
|
213
|
+
- **Type Safety**: Extensive use of protocols and type hints throughout
|
|
214
|
+
- **Error Handling**: Comprehensive error handling with structured error codes
|
|
215
|
+
- **Dynamic Configuration**: Project size detection affects worker count, timeouts, and other settings
|
|
216
|
+
- **Rich Integration**: All console output uses Rich for enhanced terminal UI
|
|
217
|
+
|
|
184
218
|
## CLI Reference
|
|
185
219
|
|
|
186
220
|
### Core Options
|
|
@@ -218,23 +252,34 @@ Access interactive mode with: `python -m crackerjack -i`
|
|
|
218
252
|
|
|
219
253
|
## Development Guidelines
|
|
220
254
|
|
|
221
|
-
1. **Code Style**: Follow the Crackerjack style guide:
|
|
222
|
-
- Use
|
|
255
|
+
1. **Code Style**: Follow the Crackerjack style guide (see RULES.md):
|
|
256
|
+
- **Target Python 3.13+** - Use latest Python features
|
|
257
|
+
- Use static typing throughout with modern syntax (import typing as `t`)
|
|
223
258
|
- Use pathlib for file operations
|
|
224
259
|
- Prefer Protocol over ABC
|
|
225
|
-
- Use
|
|
260
|
+
- Use built-in collection types (`list[str]`, `dict[str, int]`) instead of typing equivalents
|
|
261
|
+
- Leverage Python 3.13+ performance and language improvements
|
|
226
262
|
|
|
227
263
|
2. **Testing Approach**:
|
|
228
264
|
- Write unit tests for all functionality
|
|
229
265
|
- Add benchmark tests for performance-critical code
|
|
230
266
|
- Tests are run in parallel by default
|
|
267
|
+
- **CRITICAL**: Use tempfile module for temporary files in tests (never create files directly on filesystem)
|
|
268
|
+
- Use pytest's `tmp_path` and `tmp_path_factory` fixtures
|
|
269
|
+
- Tests should be isolated and not affect the surrounding environment
|
|
231
270
|
|
|
232
271
|
3. **Dependencies**:
|
|
233
|
-
- UV for dependency management
|
|
272
|
+
- UV for dependency management and tool execution
|
|
234
273
|
- Ruff for linting and formatting
|
|
235
274
|
- Pytest for testing
|
|
275
|
+
- All tools should be run through UV for environment isolation
|
|
276
|
+
|
|
277
|
+
4. **Python Version**:
|
|
278
|
+
- **Target: Python 3.13+** - Crackerjack requires Python 3.13 or newer
|
|
279
|
+
- Use modern Python 3.13+ features and syntax
|
|
280
|
+
- Code must be compatible with Python 3.13+ only
|
|
236
281
|
|
|
237
|
-
|
|
282
|
+
5. **Version Management**:
|
|
238
283
|
- Version bumping is handled through UV
|
|
239
284
|
- Follows semantic versioning
|
|
240
285
|
|
|
@@ -242,7 +287,9 @@ Access interactive mode with: `python -m crackerjack -i`
|
|
|
242
287
|
|
|
243
288
|
When generating code, AI assistants MUST follow these standards to ensure compliance with Refurb and Bandit pre-commit hooks:
|
|
244
289
|
|
|
245
|
-
|
|
290
|
+
**IMPORTANT: Target Python 3.13+** - All code must be compatible with Python 3.13 or newer. Use the latest Python features and syntax.
|
|
291
|
+
|
|
292
|
+
### Refurb Standards (Modern Python Patterns up to 3.12)
|
|
246
293
|
|
|
247
294
|
**Use modern syntax and built-ins:**
|
|
248
295
|
- Use `pathlib.Path` instead of `os.path` operations
|
|
@@ -275,7 +322,7 @@ if config_file.exists():
|
|
|
275
322
|
if name.startswith("test_"):
|
|
276
323
|
name = name.removeprefix("test_")
|
|
277
324
|
|
|
278
|
-
# Good: Union types (Python 3.
|
|
325
|
+
# Good: Union types (Python 3.13+)
|
|
279
326
|
def process_data(data: str | bytes) -> dict[str, Any]:
|
|
280
327
|
pass
|
|
281
328
|
|
|
@@ -335,6 +382,81 @@ if not api_key:
|
|
|
335
382
|
cursor.execute("SELECT * FROM users WHERE id = %s", (user_id,))
|
|
336
383
|
```
|
|
337
384
|
|
|
385
|
+
### Pyright Type Safety Standards
|
|
386
|
+
|
|
387
|
+
**Always use explicit type annotations:**
|
|
388
|
+
- Function parameters must have type hints
|
|
389
|
+
- Function return types must be annotated
|
|
390
|
+
- Class attributes should have type annotations
|
|
391
|
+
- Use `from __future__ import annotations` for forward references
|
|
392
|
+
|
|
393
|
+
**Handle Optional types properly:**
|
|
394
|
+
- Use `str | None` instead of `Optional[str]` (required for Python 3.13+)
|
|
395
|
+
- Always check for None before using optional values
|
|
396
|
+
- Use explicit `assert` statements or type guards when narrowing types
|
|
397
|
+
|
|
398
|
+
**Generic types and collections:**
|
|
399
|
+
- Use `list[str]` instead of `List[str]` (required for Python 3.13+)
|
|
400
|
+
- Use `dict[str, Any]` instead of `Dict[str, Any]` (required for Python 3.13+)
|
|
401
|
+
- Properly type generic classes with `TypeVar` when needed
|
|
402
|
+
- Use `Sequence` or `Iterable` for function parameters when appropriate
|
|
403
|
+
|
|
404
|
+
**Protocol and ABC usage:**
|
|
405
|
+
- Prefer `typing.Protocol` over abstract base classes for duck typing
|
|
406
|
+
- Use `@runtime_checkable` when protocols need runtime checks
|
|
407
|
+
- Define clear interfaces with protocols
|
|
408
|
+
|
|
409
|
+
**Python 3.13+ specific features:**
|
|
410
|
+
- Leverage improved error messages and performance optimizations
|
|
411
|
+
- Use enhanced type system features available in 3.13+
|
|
412
|
+
- Take advantage of improved pathlib and asyncio features
|
|
413
|
+
- Use any new syntax or standard library improvements
|
|
414
|
+
|
|
415
|
+
**Import and module organization:**
|
|
416
|
+
- Import types in TYPE_CHECKING blocks when needed for forward references
|
|
417
|
+
- Use proper module-level `__all__` declarations
|
|
418
|
+
- Organize imports: standard library, third-party, local imports
|
|
419
|
+
|
|
420
|
+
**Example of proper typing:**
|
|
421
|
+
```python
|
|
422
|
+
from __future__ import annotations
|
|
423
|
+
|
|
424
|
+
from typing import TYPE_CHECKING, Protocol, runtime_checkable
|
|
425
|
+
from pathlib import Path
|
|
426
|
+
|
|
427
|
+
if TYPE_CHECKING:
|
|
428
|
+
from collections.abc import Sequence
|
|
429
|
+
|
|
430
|
+
@runtime_checkable
|
|
431
|
+
class Writable(Protocol):
|
|
432
|
+
def write(self, data: str) -> None: ...
|
|
433
|
+
|
|
434
|
+
def process_files(
|
|
435
|
+
paths: Sequence[Path],
|
|
436
|
+
output: Writable,
|
|
437
|
+
encoding: str = "utf-8",
|
|
438
|
+
) -> dict[str, int]:
|
|
439
|
+
"""Process files and return statistics."""
|
|
440
|
+
stats: dict[str, int] = {}
|
|
441
|
+
|
|
442
|
+
for path in paths:
|
|
443
|
+
if path.exists():
|
|
444
|
+
content = path.read_text(encoding=encoding)
|
|
445
|
+
stats[str(path)] = len(content)
|
|
446
|
+
output.write(f"Processed {path}\n")
|
|
447
|
+
|
|
448
|
+
return stats
|
|
449
|
+
|
|
450
|
+
# Good: Type narrowing with assertion
|
|
451
|
+
def validate_config(config: dict[str, str | None]) -> dict[str, str]:
|
|
452
|
+
"""Validate that all config values are non-None."""
|
|
453
|
+
validated: dict[str, str] = {}
|
|
454
|
+
for key, value in config.items():
|
|
455
|
+
assert value is not None, f"Config key {key} cannot be None"
|
|
456
|
+
validated[key] = value
|
|
457
|
+
return validated
|
|
458
|
+
```
|
|
459
|
+
|
|
338
460
|
### Integration with Pre-commit Hooks
|
|
339
461
|
|
|
340
462
|
These standards align with the project's pre-commit hooks:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crackerjack
|
|
3
|
-
Version: 0.24.
|
|
3
|
+
Version: 0.24.10
|
|
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
|
|
@@ -595,19 +595,51 @@ Crackerjack is designed with modern Python principles in mind:
|
|
|
595
595
|
|
|
596
596
|
## Acknowledgments
|
|
597
597
|
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
-
|
|
602
|
-
-
|
|
603
|
-
-
|
|
604
|
-
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
-
|
|
608
|
-
-
|
|
609
|
-
-
|
|
610
|
-
-
|
|
611
|
-
-
|
|
598
|
+
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
|
+
|
|
600
|
+
### Core Development Tools
|
|
601
|
+
- **[UV](https://docs.astral.sh/uv/)** - Next-generation Python package and project management
|
|
602
|
+
- **[Ruff](https://docs.astral.sh/ruff/)** - Lightning-fast Python linter and formatter written in Rust
|
|
603
|
+
- **[pyright](https://microsoft.github.io/pyright/)** - Fast, feature-rich static type checker for Python
|
|
604
|
+
- **[pytest](https://pytest.org/)** - Flexible and powerful testing framework
|
|
605
|
+
|
|
606
|
+
### Code Quality & Security
|
|
607
|
+
- **[pre-commit](https://pre-commit.com/)** - Multi-language pre-commit hooks framework
|
|
608
|
+
- **[bandit](https://bandit.readthedocs.io/)** - Security vulnerability scanner for Python
|
|
609
|
+
- **[vulture](https://github.com/jendrikseipp/vulture)** - Dead code detection tool
|
|
610
|
+
- **[refurb](https://github.com/dosisod/refurb)** - Code modernization and improvement suggestions
|
|
611
|
+
- **[codespell](https://github.com/codespell-project/codespell)** - Spelling mistake detection and correction
|
|
612
|
+
- **[detect-secrets](https://github.com/Yelp/detect-secrets)** - Prevention of secrets in repositories
|
|
613
|
+
|
|
614
|
+
### Dependencies & Project Management
|
|
615
|
+
- **[creosote](https://github.com/fredrikaverpil/creosote)** - Unused dependency detection
|
|
616
|
+
- **[autotyping](https://github.com/JelleZijlstra/autotyping)** - Automatic type hint generation
|
|
617
|
+
- **[complexipy](https://github.com/rohaquinlop/complexipy)** - Code complexity analysis
|
|
618
|
+
|
|
619
|
+
### CLI & User Interface
|
|
620
|
+
- **[Typer](https://typer.tiangolo.com/)** - Modern CLI framework for building command-line interfaces
|
|
621
|
+
- **[Rich](https://rich.readthedocs.io/)** - Rich text and beautiful formatting in the terminal
|
|
622
|
+
- **[click](https://click.palletsprojects.com/)** - Python package for creating command line interfaces
|
|
623
|
+
|
|
624
|
+
### Performance & Development Tools
|
|
625
|
+
- **[icecream](https://github.com/gruns/icecream)** - Sweet and creamy print debugging
|
|
626
|
+
- **[bevy](https://github.com/ZeroIntensity/bevy)** - Lightweight dependency injection framework
|
|
627
|
+
- **[msgspec](https://github.com/jcrist/msgspec)** - High-performance message serialization
|
|
628
|
+
- **[attrs](https://github.com/python-attrs/attrs)** - Classes without boilerplate
|
|
629
|
+
|
|
630
|
+
### Development Environment
|
|
631
|
+
- **[PyCharm](https://www.jetbrains.com/pycharm/)** - The premier Python IDE that powered the development of Crackerjack
|
|
632
|
+
- **[Claude Code](https://claude.ai/code)** - AI-powered development assistant that accelerated development and ensured code quality
|
|
633
|
+
|
|
634
|
+
### Legacy Inspiration
|
|
635
|
+
- **[PDM](https://pdm.fming.dev/)** - Original inspiration for modern Python dependency management patterns
|
|
636
|
+
|
|
637
|
+
### Special Recognition
|
|
638
|
+
|
|
639
|
+
We extend special thanks to the **Astral team** for their groundbreaking work on UV and Ruff, which have revolutionized Python tooling. Their commitment to performance, reliability, and developer experience has set new standards for the Python ecosystem.
|
|
640
|
+
|
|
641
|
+
The integration of these tools into Crackerjack's unified workflow demonstrates the power of the modern Python toolchain when thoughtfully combined. Each tool excels in its domain, and together they create a development experience that is both powerful and delightful.
|
|
642
|
+
|
|
643
|
+
We're honored to build upon this foundation and contribute to the Python community's continued evolution toward better development practices and tools.
|
|
612
644
|
|
|
613
645
|
---
|
|
@@ -551,19 +551,51 @@ Crackerjack is designed with modern Python principles in mind:
|
|
|
551
551
|
|
|
552
552
|
## Acknowledgments
|
|
553
553
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
-
|
|
558
|
-
-
|
|
559
|
-
-
|
|
560
|
-
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
-
|
|
564
|
-
-
|
|
565
|
-
-
|
|
566
|
-
-
|
|
567
|
-
-
|
|
554
|
+
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:
|
|
555
|
+
|
|
556
|
+
### Core Development Tools
|
|
557
|
+
- **[UV](https://docs.astral.sh/uv/)** - Next-generation Python package and project management
|
|
558
|
+
- **[Ruff](https://docs.astral.sh/ruff/)** - Lightning-fast Python linter and formatter written in Rust
|
|
559
|
+
- **[pyright](https://microsoft.github.io/pyright/)** - Fast, feature-rich static type checker for Python
|
|
560
|
+
- **[pytest](https://pytest.org/)** - Flexible and powerful testing framework
|
|
561
|
+
|
|
562
|
+
### Code Quality & Security
|
|
563
|
+
- **[pre-commit](https://pre-commit.com/)** - Multi-language pre-commit hooks framework
|
|
564
|
+
- **[bandit](https://bandit.readthedocs.io/)** - Security vulnerability scanner for Python
|
|
565
|
+
- **[vulture](https://github.com/jendrikseipp/vulture)** - Dead code detection tool
|
|
566
|
+
- **[refurb](https://github.com/dosisod/refurb)** - Code modernization and improvement suggestions
|
|
567
|
+
- **[codespell](https://github.com/codespell-project/codespell)** - Spelling mistake detection and correction
|
|
568
|
+
- **[detect-secrets](https://github.com/Yelp/detect-secrets)** - Prevention of secrets in repositories
|
|
569
|
+
|
|
570
|
+
### Dependencies & Project Management
|
|
571
|
+
- **[creosote](https://github.com/fredrikaverpil/creosote)** - Unused dependency detection
|
|
572
|
+
- **[autotyping](https://github.com/JelleZijlstra/autotyping)** - Automatic type hint generation
|
|
573
|
+
- **[complexipy](https://github.com/rohaquinlop/complexipy)** - Code complexity analysis
|
|
574
|
+
|
|
575
|
+
### CLI & User Interface
|
|
576
|
+
- **[Typer](https://typer.tiangolo.com/)** - Modern CLI framework for building command-line interfaces
|
|
577
|
+
- **[Rich](https://rich.readthedocs.io/)** - Rich text and beautiful formatting in the terminal
|
|
578
|
+
- **[click](https://click.palletsprojects.com/)** - Python package for creating command line interfaces
|
|
579
|
+
|
|
580
|
+
### Performance & Development Tools
|
|
581
|
+
- **[icecream](https://github.com/gruns/icecream)** - Sweet and creamy print debugging
|
|
582
|
+
- **[bevy](https://github.com/ZeroIntensity/bevy)** - Lightweight dependency injection framework
|
|
583
|
+
- **[msgspec](https://github.com/jcrist/msgspec)** - High-performance message serialization
|
|
584
|
+
- **[attrs](https://github.com/python-attrs/attrs)** - Classes without boilerplate
|
|
585
|
+
|
|
586
|
+
### Development Environment
|
|
587
|
+
- **[PyCharm](https://www.jetbrains.com/pycharm/)** - The premier Python IDE that powered the development of Crackerjack
|
|
588
|
+
- **[Claude Code](https://claude.ai/code)** - AI-powered development assistant that accelerated development and ensured code quality
|
|
589
|
+
|
|
590
|
+
### Legacy Inspiration
|
|
591
|
+
- **[PDM](https://pdm.fming.dev/)** - Original inspiration for modern Python dependency management patterns
|
|
592
|
+
|
|
593
|
+
### Special Recognition
|
|
594
|
+
|
|
595
|
+
We extend special thanks to the **Astral team** for their groundbreaking work on UV and Ruff, which have revolutionized Python tooling. Their commitment to performance, reliability, and developer experience has set new standards for the Python ecosystem.
|
|
596
|
+
|
|
597
|
+
The integration of these tools into Crackerjack's unified workflow demonstrates the power of the modern Python toolchain when thoughtfully combined. Each tool excels in its domain, and together they create a development experience that is both powerful and delightful.
|
|
598
|
+
|
|
599
|
+
We're honored to build upon this foundation and contribute to the Python community's continued evolution toward better development practices and tools.
|
|
568
600
|
|
|
569
601
|
---
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
# Windsurf AI Rules for Crackerjack Projects
|
|
2
|
-
|
|
3
|
-
## Project Context
|
|
4
|
-
This is a Crackerjack project - an opinionated Python project management tool that streamlines development workflow by combining best-in-class tools. When working on this codebase or projects that use Crackerjack, follow these rules strictly.
|
|
5
|
-
|
|
6
|
-
## Code Quality & Style
|
|
7
|
-
|
|
8
|
-
### Static Typing Requirements
|
|
9
|
-
- Always include comprehensive type hints for all functions, methods, and variables
|
|
10
|
-
- Import typing as `import typing as t` and prefix all typing references with `t.`
|
|
11
|
-
- Never import individual types directly from typing (avoid `from typing import List, Dict, Optional`)
|
|
12
|
-
- Use modern typing syntax with pipe operator (`|`) for unions instead of `Optional[T]`
|
|
13
|
-
- Use built-in collection types: `list[str]` not `t.List[str]`, `dict[str, int]` not `t.Dict[str, int]`
|
|
14
|
-
- Use `t.Protocol` instead of abstract base classes
|
|
15
|
-
- Apply `@t.runtime_checkable` decorator to protocols when runtime checking is needed
|
|
16
|
-
|
|
17
|
-
### Modern Python Standards
|
|
18
|
-
- Target Python 3.13+ features and syntax exclusively
|
|
19
|
-
- Use f-strings for all string formatting
|
|
20
|
-
- Prefer `pathlib.Path` over `os.path` for file operations
|
|
21
|
-
- Use dataclasses for structured data
|
|
22
|
-
- Adopt latest language features immediately
|
|
23
|
-
|
|
24
|
-
### Code Architecture
|
|
25
|
-
- Write modular functions that do one thing well
|
|
26
|
-
- Avoid unnecessary docstrings and line comments unless they explain "why" not "what"
|
|
27
|
-
- Choose clear, descriptive variable and function names
|
|
28
|
-
- Group related functionality into well-defined classes
|
|
29
|
-
- Structure projects with clear separation of concerns
|
|
30
|
-
|
|
31
|
-
## Tool Integration & Commands
|
|
32
|
-
|
|
33
|
-
### PDM Usage
|
|
34
|
-
- Always use `pdm run` to execute tools within the project's virtual environment
|
|
35
|
-
- Run pytest with `pdm run pytest` instead of calling pytest directly
|
|
36
|
-
- Execute all tools through PDM: `pdm run pyright`, `pdm run ruff`, `pdm run crackerjack`
|
|
37
|
-
- Install dependencies with `pdm install`
|
|
38
|
-
|
|
39
|
-
### Crackerjack Commands
|
|
40
|
-
- Run basic process: `python -m crackerjack`
|
|
41
|
-
- Clean, test, and commit: `python -m crackerjack -x -t -c`
|
|
42
|
-
- Auto bump and commit: `python -m crackerjack -a micro`
|
|
43
|
-
- Interactive mode: `python -m crackerjack -i`
|
|
44
|
-
- Test only: `python -m crackerjack -t`
|
|
45
|
-
- Skip pre-commit during testing: `python -m crackerjack -t -s`
|
|
46
|
-
- Optimize for large projects: `python -m crackerjack -t --test-workers=2 --test-timeout=300`
|
|
47
|
-
|
|
48
|
-
### Quality Validation
|
|
49
|
-
- Code is incomplete until it passes: `python -m crackerjack -x -t`
|
|
50
|
-
- This validates typing, formatting, linting, and test success
|
|
51
|
-
- Run `pre-commit run --all-files` during development
|
|
52
|
-
- All code must pass pre-commit checks before submission
|
|
53
|
-
|
|
54
|
-
## Testing Standards
|
|
55
|
-
|
|
56
|
-
### Test Environment
|
|
57
|
-
- Use pytest with asyncio_mode="auto" for async testing
|
|
58
|
-
- Never create files directly on filesystem in tests
|
|
59
|
-
- Always use `tempfile` module or pytest's `tmp_path` fixtures
|
|
60
|
-
- Tests must be isolated and not affect surrounding environment
|
|
61
|
-
- Avoid hard-coded paths pointing to real filesystem
|
|
62
|
-
|
|
63
|
-
### Test Configuration
|
|
64
|
-
- Write tests for behavior, not implementation details
|
|
65
|
-
- Focus on testing public interfaces rather than private functions
|
|
66
|
-
- Use parallel test execution when appropriate
|
|
67
|
-
- Add timeouts to prevent hanging tests
|
|
68
|
-
- Separate unit tests, integration tests, and benchmarks
|
|
69
|
-
- Aim for complete coverage of critical paths
|
|
70
|
-
|
|
71
|
-
### Benchmark Testing
|
|
72
|
-
- Run benchmarks: `python -m crackerjack -t --benchmark`
|
|
73
|
-
- Regression detection: `python -m crackerjack -t --benchmark-regression`
|
|
74
|
-
- Custom threshold: `python -m crackerjack -t --benchmark-regression --benchmark-regression-threshold=10.0`
|
|
75
|
-
|
|
76
|
-
## Error Handling & Output
|
|
77
|
-
|
|
78
|
-
### Exception Management
|
|
79
|
-
- Use structured exception handling with specific exception types
|
|
80
|
-
- Provide meaningful error messages with context
|
|
81
|
-
- Handle errors gracefully and provide actionable feedback
|
|
82
|
-
|
|
83
|
-
### Console Output
|
|
84
|
-
- Use Rich library for all console output
|
|
85
|
-
- Provide clear status indicators for operations
|
|
86
|
-
- Format output for readability and user experience
|
|
87
|
-
|
|
88
|
-
## Development Workflow
|
|
89
|
-
|
|
90
|
-
### Pre-commit Hooks
|
|
91
|
-
Configure comprehensive pre-commit hooks:
|
|
92
|
-
- Pyright for static type checking
|
|
93
|
-
- Ruff for linting and formatting
|
|
94
|
-
- Vulture for detecting unused code
|
|
95
|
-
- Creosote for identifying large files
|
|
96
|
-
- Flynt for string formatting conversion
|
|
97
|
-
- Codespell for spell checking
|
|
98
|
-
- Autotyping for type annotation
|
|
99
|
-
- Refurb for Python code modernization
|
|
100
|
-
- Bandit for security vulnerabilities
|
|
101
|
-
|
|
102
|
-
### Version Management
|
|
103
|
-
- Use semantic versioning
|
|
104
|
-
- Bump versions through Crackerjack: `-b micro|minor|major`
|
|
105
|
-
- Publish to PyPI: `-p micro|minor|major`
|
|
106
|
-
- Version bumping handled through PDM
|
|
107
|
-
|
|
108
|
-
### Git Operations
|
|
109
|
-
- Commit after pre-commit: `python -m crackerjack -c`
|
|
110
|
-
- Create pull requests: `python -m crackerjack -r`
|
|
111
|
-
- Never commit changes unless explicitly requested
|
|
112
|
-
|
|
113
|
-
## Dependency Management
|
|
114
|
-
|
|
115
|
-
### Package Management
|
|
116
|
-
- Use PDM with uv for dependency management
|
|
117
|
-
- Keep external dependencies minimal
|
|
118
|
-
- Pin exact versions in lockfiles
|
|
119
|
-
- Use range specifications in pyproject.toml
|
|
120
|
-
- Regularly audit dependencies for security
|
|
121
|
-
- Prefer standard library solutions when reasonable
|
|
122
|
-
|
|
123
|
-
### Configuration
|
|
124
|
-
- Use pyproject.toml for all project configuration
|
|
125
|
-
- Follow standard package layout conventions
|
|
126
|
-
- Configure all tools through pyproject.toml when possible
|
|
127
|
-
|
|
128
|
-
## Performance & Optimization
|
|
129
|
-
|
|
130
|
-
### Code Performance
|
|
131
|
-
- Use profiling tools for critical code paths
|
|
132
|
-
- Benchmark alternative implementations
|
|
133
|
-
- Favor readability over micro-optimizations
|
|
134
|
-
- Document non-obvious optimizations with rationale
|
|
135
|
-
|
|
136
|
-
### Test Performance
|
|
137
|
-
- Adjust test workers based on project size
|
|
138
|
-
- Use appropriate timeouts for test execution
|
|
139
|
-
- Implement deadlock prevention for threading
|
|
140
|
-
- Show progress tracking for long-running tests
|
|
141
|
-
|
|
142
|
-
## Documentation Philosophy
|
|
143
|
-
|
|
144
|
-
### Minimalist Approach
|
|
145
|
-
- Focus documentation on "why" rather than "what"
|
|
146
|
-
- Document APIs at module/class level, not individual functions
|
|
147
|
-
- Use type hints to replace parameter documentation
|
|
148
|
-
- Create examples for complex functionality
|
|
149
|
-
- Avoid verbose explanations
|
|
150
|
-
|
|
151
|
-
## Security & Best Practices
|
|
152
|
-
|
|
153
|
-
### Security Standards
|
|
154
|
-
- Never expose or log secrets and keys
|
|
155
|
-
- Never commit secrets to repository
|
|
156
|
-
- Use Bandit for security vulnerability scanning
|
|
157
|
-
- Follow security best practices consistently
|
|
158
|
-
|
|
159
|
-
### Code Review
|
|
160
|
-
- All code must be reviewed before merging
|
|
161
|
-
- Automate style checks to focus reviews on substance
|
|
162
|
-
- Look for edge cases and error handling
|
|
163
|
-
- Ensure tests adequately cover changes
|
|
164
|
-
|
|
165
|
-
## Project-Specific Guidelines
|
|
166
|
-
|
|
167
|
-
### For Crackerjack Core Development
|
|
168
|
-
- Maintain the opinionated nature of the tool
|
|
169
|
-
- Enforce single correct way to accomplish tasks
|
|
170
|
-
- Remove unnecessary flexibility that leads to inconsistency
|
|
171
|
-
- Value clarity over brevity
|
|
172
|
-
|
|
173
|
-
### For Projects Using Crackerjack
|
|
174
|
-
- Follow all Crackerjack style rules
|
|
175
|
-
- Use Crackerjack for all development workflow tasks
|
|
176
|
-
- Configure projects to pass `python -m crackerjack -x -t`
|
|
177
|
-
- Adopt Crackerjack's opinionated choices consistently
|
|
178
|
-
|
|
179
|
-
## AI Assistant Instructions
|
|
180
|
-
|
|
181
|
-
When working on Crackerjack or projects using Crackerjack:
|
|
182
|
-
1. Always check code against these rules before suggesting changes
|
|
183
|
-
2. Run appropriate Crackerjack commands to validate changes
|
|
184
|
-
3. Ensure all code follows the typing and style guidelines
|
|
185
|
-
4. Use PDM for all tool execution
|
|
186
|
-
5. Test changes thoroughly with appropriate timeouts
|
|
187
|
-
6. Never compromise on code quality standards
|
|
188
|
-
7. Maintain the opinionated, high-quality nature of the project
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|