Metadata-Version: 2.2
Name: ImportNinja
Version: 0.1.0
Summary: A CLI tool to scan Python projects for dependencies and unused imports.
Author: linustg
License: MIT License
        
        Copyright (c) 2024 ImportNinja
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/linustg/ImportNinja
Project-URL: Bug Tracker, https://github.com/linustg/ImportNinja/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE

# ImportNinja

![Build Status](https://github.com/yourusername/ImportNinja/actions/workflows/python-app.yml/badge.svg)
![PyPI version](https://badge.fury.io/py/ImportNinja.svg)
![License](https://img.shields.io/badge/license-MIT-blue.svg)

**ImportNinja** is a Python CLI tool designed to scan your projects for dependencies, detect unused imports, and help keep your `requirements.txt` file clean and up-to-date. Simplify your dependency management with lightning-fast scans and detailed reports.

---

## Features

- **Recursive Scanning**: Scans all `.py` files in your project.
- **Detects Unused Imports**: Identifies libraries that are imported but never used.
- **Requirements Analysis**: Checks if your `requirements.txt` is up to date.
- **Automatic Updates**: Optionally writes missing dependencies to `requirements.txt`.
- **Fast & Lightweight**: Built using Python's `ast` for efficient parsing.

---

## Installation

Install ImportNinja directly from PyPI:

```bash
pip install ImportNinja
```

---

## Usage

### Basic Command

```bash
import-ninja /path/to/your/project
```

This will scan the project directory and list all detected dependencies and unused imports.

### With Requirements File

```bash
import-ninja /path/to/your/project -r requirements.txt
```

- **`-r` or `--requirements`**: Specify the `requirements.txt` file to compare with detected imports. ImportNinja will analyze and suggest updates.

### Example Output

```
Scanning for imports...
Total Python Files Scanned: 6
Total Import Statements: 9
Unique Libraries Imported: 8
Total Unused Imports: 6

Unused Imports:
- setup.py:
  - setuptools
- ImportNinja\analyzer.py:
  - pathlib
- ImportNinja\cli.py:
  - ImportNinja.scanner
  - ImportNinja.utils
  - ImportNinja.analyzer
- ImportNinja\scanner.py:
  - pathlib

Requirements file analysis:

Imports missing in requirements.txt:
- sys
- ast
- argparse
- pathlib

Dependencies:
- argparse
- ast
- pathlib
- setuptools
- sys

Requirements saved to requirements.txt
```

---

## Contributing

We welcome contributions! To get started:

1. Fork the repository.
2. Create a new branch: `git checkout -b feature/your-feature-name`.
3. Make your changes.
4. Run tests to ensure everything works.
5. Submit a pull request!

---

## License

This project is licensed under the [MIT License](LICENSE).

---

## Links

- **PyPI**: [https://pypi.org/project/ImportNinja/](https://pypi.org/project/ImportNinja/)
- **GitHub**: [https://github.com/yourusername/ImportNinja](https://github.com/linustg/ImportNinja)

---

## Contact

For questions or support, feel free to reach out:

[GitHub](https://github.com/linustg)
