Metadata-Version: 2.4
Name: pybughunt
Version: 0.1.1
Summary: A Python library for detecting logical and syntactical errors in Python code
Home-page: https://github.com/Preksha-7/pybughunt
Author: Preksha Upadhyay
Author-email: Preksha Upadhyay <prekshaupadhyay03@gmail.com>
License: MIT
Keywords: code,python,error,detection,static analysis
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Dynamic: author
Dynamic: home-page
Dynamic: requires-python

# Code Error Detector

A Python library for detecting logical and syntactical errors in Python code.

## Features

- Syntax error detection and analysis
- Logical error detection using pattern-based and machine learning approaches
- Command-line interface for analyzing Python files
- Training capabilities for custom error detection models

## Installation

```bash
# Install from source
git clone https://github.com/Preksha-7/pybughunt.git
cd pybughunt
pip install -e .
```

## Usage

### Command Line

```bash
# Analyze Python files
pybughunt analyze file1.py file2.py

# Analyze with custom model
pybughunt analyze file1.py --model path/to/model.pkl

# Output in JSON format
pybughunt analyze file1.py --format json --output results.json

# Train a new model
pybughunt train --dataset path/to/dataset --output path/to/model.pkl
```

### Python API

```python
from pybughunt import CodeErrorDetector

# Initialize the detector
detector = CodeErrorDetector()

# Analyze code
code = '''
def example():
    print("Hello, world!"
'''
results = detector.analyze(code)

# Get fix suggestions
if results["syntax_errors"] or results["logic_errors"]:
    errors = results["syntax_errors"] + results["logic_errors"]
    suggestions = detector.fix_suggestions(code, results)
    for error_key, suggestion in suggestions.items():
        print(f"Suggestion for {error_key}: {suggestion}")
```

## Supported Error Types

### Syntax Errors

- Missing parentheses, brackets, or braces
- Indentation errors
- Invalid syntax
- Unterminated string literals

### Logical Errors

- Infinite loops (while True without break)
- Unused variables
- Potential off-by-one errors
- Division by zero
- Unreachable code

## License

MIT
