# Intro
dv-requirements-merter is a simple tool to merge multiple `requirements.txt` files into a single file.

## Installation
To use this tool, you need to have Python 3 installed. You can then clone this repository and install the dependencies:

```bash
git clone https://github.com/doovate/dv-requirements-merger.git
cd dv-requirements-merger
```

You will need to install the dependencies from the pyproject.toml file

## Usage
To use the tool, you can run the `merge_req.py` script with a list of `requirements.txt` files to merge. The merged
requirements will be saved in a file called `merged_requirements.txt` by default.

```bash
python merge_req.py requirements1.txt requirements2.txt requirements3.txt
```

You can also specify a different output file using the `-o` or `--output` option:

```bash
python merge_req.py requirements1.txt requirements2.txt -o merged.txt
```

Additionally, you can specify the '--strategy' option to choose the merge strategy (default is none), the options are:
- latest: merge the latest version of each package
- oldest: merge the oldest version of each package
- none: do not merge packages

## Example

Let's say you have two `requirements.txt` files:

**requirements1.txt**

```
numpy==1.22.0
pandas==1.4.2
```

**requirements2.txt**

```
numpy==1.23.0
matplotlib>=3.5.0
```

After running the tool, the `merged_requirements.txt` file will contain the following:

```
# CONFLICT: Found multiple versions for numpy: ==1.22.0 and ==1.23.0
# numpy==1.22.0
# numpy==1.23.0
matplotlib>=3.5.0
pandas==1.4.2
```