Metadata-Version: 2.4
Name: pyreqify
Version: 0.0.11
Summary: A module to extract Python dependencies packages from .py and .ipynb
Project-URL: Homepage, https://github.com/ammaryasirnaich/PyReqify
Project-URL: Documentation, https://github.com/ammaryasirnaich/PyReqify
Project-URL: Source Code, https://github.com/ammaryasirnaich/PyReqify
Author-email: Ammar Yasir Naich <ammar.naich@gmail.com>
License: MIT License
        
        Copyright (c) 2024 Ammar Yasir Naich
        
        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.
License-File: LICENSE.txt
Keywords: Python modules,automation,dependency management,requirements,requirements.txt
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Requires-Dist: nbformat
Description-Content-Type: text/markdown

# PyReqify

[![Python](https://img.shields.io/badge/Python-3.8%2B-blue)](https://www.python.org/)  
[![License](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![GitHub Badge](https://img.shields.io/badge/GitHub-Repo-blue.svg)](https://github.com/ammaryasirnaich/PyReqify)


A lightweight Python module for `requirements.txt generation`. It efficiently extracts imported modules and generates a `requirements.txt` file with module versions for `.py` and `.ipynb` files in a given directory. Simplify dependency management for your projects!


## Features

- 📦 **Automatic Module Extraction**: Scans `.py` and `.ipynb` files in a directory to find all imported modules.
- 🔍 **Version Detection**: Fetches installed versions of imported modules (maps common aliases to official package names). It also gives the option to includes fetch `source python version` too.
- 📝 **Requirements Generation**: Creates a `requirements.txt` file with all extracted dependencies and the current Python version.


## Installation

Clone this repository and install the requirements.

```bash
pip install pyreqify
```


# ExtractPackages

## Usage
To use the `pyreqify` function and automatically create a `requirements.txt` file:

1. Place all `.py` and `.ipynb` files in a folder (e.g., `project`).
2. Run the function to generate a `requirements.txt` in the current directory with all extracted dependencies.
```python
pyreqify <source_folder> <destination folder> --include-source-pyversion
```

##### generated requirement.txt file
```

scikit-learn==1.5.1
keras==3.6.0
numpy==2.0.1
pandas==2.2.2
open3d==0.16.1
webcolors==24.8.0
nbformat==5.10.4
matplotlib==3.9.1
typing==3.7.4.3
torch==2.2.2
python==3.10.14
```


#### Examples
Example 1: Generate `requirements.txt` in the current working folder `without the Python version`.
```python
pyreqify ~/Workspace/project .
```

Example 2: Generate `requirements.txt` in the `deploy folder`, including the `Python module versions` and `Python version` in the file.
```python
pyreqify ~/Workspace/project ~/Workspace/project/deploy --include-module-version --include-source-pyversion
```

