https://github.com/http-kennedy/dev_crawl
dev_crawl is a versatile Python debugging automation tool designed to simplify and streamline the debugging process for Python developers. It automatically injects debugging statements into Python scripts, including nested and interdependent scripts, ensuring a thorough and efficient debugging experience.
https://github.com/http-kennedy/dev_crawl
automation debugging logic-flow python workflow
Last synced: about 1 year ago
JSON representation
dev_crawl is a versatile Python debugging automation tool designed to simplify and streamline the debugging process for Python developers. It automatically injects debugging statements into Python scripts, including nested and interdependent scripts, ensuring a thorough and efficient debugging experience.
- Host: GitHub
- URL: https://github.com/http-kennedy/dev_crawl
- Owner: http-kennedy
- License: cc0-1.0
- Created: 2023-11-30T21:06:42.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-26T20:03:02.000Z (almost 2 years ago)
- Last Synced: 2025-03-28T08:11:27.089Z (about 1 year ago)
- Topics: automation, debugging, logic-flow, python, workflow
- Language: Python
- Homepage:
- Size: 1.21 MB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dev_crawl.py - Python Debugging Automation Tool
## Introduction
`dev_crawl.py` is a lightweight Python automation tool designed to streamline the debugging process by generating an output of logic flow during _debug script execution. It performs this by injecting debugging statements, managing debug logs, and intelligently handles nested scripts and their imports.
- **Main use of this tool is to create a visual representation of the logic flow of a python script, including the order in which functions were called and the number of times each function was called.**
- This can be useful for identifying performance bottlenecks or other issues.
## Key Features
- **Automated Debugging Statement Injection:** Automates the insertion of logic flow statements into Python scripts, extending support to nested and interdependent scripts.
- **Selective Import Modification:** Dynamically modifies import statements in scripts to include their debug-enhanced versions, but only for scripts specified in the same run.
- **Simultaneous Multiple Script Handling:** Efficiently processes multiple scripts in a single run, respecting their dependencies and nesting.
- **Versatile Debug Log Management:** Offers options for terminal output, debug.log output, custom debug log file, and log reformatting for enhanced readability or markdown conversion.
## Requirements
- Python 3.6 or later
- `astor` library
## Installation
Clone the repository from GitHub and install the dependency:
```bash
git clone https://github.com/http-kennedy/dev_crawl
cd dev_crawl
pip install -r requirements.txt
```
## Workflow and Usage
```bash
python dev_crawl.py --h
```
### Single and Multiple Script Modification
- **Single Script:**
```bash
python dev_crawl.py script1.py
```
- **Multiple Scripts:**
```bash
python dev_crawl.py script1.py script2.py
```
- **Hierarchical Dependencies:**
```bash
python dev_crawl.py script1.py script2.py /utils/script3.py
```
### Output Options
- **Default (Print to Terminal):**
- Outputs debug information to the terminal.
```bash
python dev_crawl.py script1.py
```
- **Using `--debug-to-file`:**
- Directs debug outputs to `debug.log` in the current working directory.
```bash
python dev_crawl.py --debug-to-file script1.py
```
- **Custom Log Location with `--output-file`:**
- Specifies a custom file path for the debug log.
```bash
python dev_crawl.py --debug-to-file --output-file /path/to/custom_log.log script1.py
```
- **Reformatting `debug.log`:**
- Converts `debug.log` to a readable format.
```bash
python dev_crawl.py --reformat-log /path/to/debug.log
```
- **Markdown Conversion:**
- Transforms `debug.log` into markdown format.
```bash
python dev_crawl.py --reformat-log-md /path/to/debug.log
```
### Overwrite Confirmation and Non-Interactive Mode
- **Overwrite Confirmation:**
- Prompts for confirmation before overwriting existing files.
- **Non-Interactive Mode with `--non-interactive`:**
- Automatically overwrites existing files without confirmation.
```bash
python dev_crawl.py --non-interactive --debug-to-file --output-file /path/to/debug.log script1.py
```
### Resetting `debug.log`
- **Default Reset:**
- Re-initializes `debug.log` in the current directory.
```bash
python dev_crawl.py --clear-debug-log
```
- **Custom Log Location**
- Resets a custom debug log file at the specified path.
```bash
python dev_crawl.py --clear-debug-log /path/to/debug.log
```
## Defaults for `debug.log`
- The following arguments default to current working directory for `debug.log`
- `--debug-to-file`
- `--reformat-log`
- `--reformat-log-md`
- `--clear-debug-log`
## Screenshots
Basic Debug Log (Click to Expand)
Basic Markdown Output (Click to Expand)
Full Markdown View (Click to Expand)
Detailed Execution Flow (Click to Expand)
## Intelligent Import Handling
`dev_crawl.py` intelligently adjusts import statements in scripts to refer to their debug versions, but only when an import name matches the script name passed to dev_crawl.py at the same modification execution. This ensures that debug modifications are applied consistently across interrelated scripts.
## Contributing
I welcome contributions to improve `dev_crawl.py`. Please submit pull requests or open issues for discussion.
## License
`dev_crawl.py` is released under the CC0-1.0 License. Please see the LICENSE file for full license details.
## Contact
For questions or feedback, please open an issue in the GitHub repository.