Metadata-Version: 2.1
Name: libManager
Version: 0.1.1
Summary: A class providing more control over libraries using pip
Author: Kirill Sedykh
Author-email: kirill-10c@mail.ru
License: MIT
Description-Content-Type: text/markdown

# libManager

`libManager` is a Python class for managing project dependencies, including installation, information retrieval, dependency resolution, and creating a `requirements.txt` file.

## Overview

`libManager` simplifies dependency management in a project. This class enables:
- Checking installed libraries.
- Automatically installing required libraries.
- Automatically deleting libraries, **including their dependencies** _that **are not used** in **side-libraries**_.
- Retrieving information about libraries.
- Generating a `requirements.txt` file for dependency management.

## Requirements

- Python 3.x
- `pip` package manager installed

## Installation

Clone the repository and import the `libManager` class into your project.

```python
from lib_manager import libManager
```

## Usage

### 1. Initialization

Create an instance of the `libManager` class:

```python
manager = libManager()
```

### 2. Retrieving a List of Installed Libraries

Use the `get_installed_libs` method to retrieve a list of installed libraries:

```python
installed_libs = manager.get_installed_libs()
```

### 3. Installing Libraries

To install a set of required libraries, call the following method:

```python
manager = libManager()
manager.libraries_needed = {'numpy', 'pandas'}
manager.init_libs()
```

Or do it right at the initialization:

```python
#By default libManager will initialize the libraries after getting the set of libraries
manager = libManager({'numpy', 'pandas'})
```

### 4. Deleting Libraries

To delete all of the libraries that are stated `libraries_needed`, **including their dependencies**, call the `deinit_libs()` method:

```python
#Initialize libraries we need
manager = libManager({'numpy', 'pandas'})
import numpy
import pandas

#Work goes here

#Shall we clean up after hard work?
manager.deinit_libs()
```

**It should be noted that it deletes only those libraries that are not used in other side-libraries**.

### 5. Creating a requirements.txt File

To create a `requirements.txt` file, use `create_actual_requirements()`:

```python
manager = libManager()

manager.create_actual_requirements("*path_to_file*.py")
```

Thus, `libManager` will try to create `requirements.txt` based only on your project file.

However, if there are libraries that practically can not be got from the file, you can directly state them in `additional_libs` argument:

```python
manager.create_actual_requirements("*path_to_file,py*", additional_libs={"aiohttp"})
```

## Methods
- `get_installed_libs`: Returns a set of installed libraries. Can focribly get update of installed libraries via setting `update` argument to `True`
- `init_libs`: Installs specified libraries basing on `libraries_needed`.
- `deinit_libs`: Delets specified libraries **and their dependencies** basing on `libraries_needed`
- `create_actual_requirements`: Creates a requirements.txt file basing on target `file.py`.

## License
#### This project is licensed under the MIT License.
