# :rocket: `conda-join` - Unified Conda and Pip Requirements Management :rocket:

[![PyPI](https://img.shields.io/pypi/v/conda_join.svg)](https://pypi.python.org/pypi/conda_join)
[![Build Status](https://github.com/basnijholt/conda_join/actions/workflows/pytest.yml/badge.svg)](https://github.com/basnijholt/conda_join/actions/workflows/pytest.yml)
[![CodeCov](https://codecov.io/gh/basnijholt/conda_join/branch/main/graph/badge.svg)](https://codecov.io/gh/basnijholt/conda_join)

`conda_join` is a Python package designed to streamline the management and combination of multiple `requirements.yaml` files into a single Conda `environment.yaml`. This tool is ideal for projects with multiple subcomponents, each having its own dependencies, simplifying the process of creating a unified Conda environment. 🖥️🔥

## :books: Table of Contents

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [:package: Installation](#package-installation)
- [:memo: Usage](#memo-usage)
- [:wrench: Advanced Configuration](#wrench-advanced-configuration)
- [:scroll: Output Options](#scroll-output-options)
- [:warning: Limitations](#warning-limitations)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->


## :package: Installation

To install `conda_join`, run the following command:

```bash
pip install -U conda_join
```

Or just copy the script to your computer:
```bash
wget https://raw.githubusercontent.com/basnijholt/requirements.yaml/main/conda_join.py
```

## :memo: Usage

After installation, you can use `conda_join` to scan directories for `requirements.yaml` files and combine them into an `environment.yaml` file. Basic usage is as follows:

```bash
conda_join -d [DIRECTORY] --depth [DEPTH] -o [OUTPUT_FILE]
```

- `-d` or `--directory`: Specify the base directory to scan (default is current directory).
- `--depth`: Specify the depth for scanning subdirectories (default is 1).
- `-o` or `--output`: Specify the output file for the combined environment (default is `environment.yaml`).

For more options, use:

<!-- CODE:BASH:START -->
<!-- echo '```bash' -->
<!-- conda-join -h -->
<!-- echo '```' -->
<!-- CODE:END -->
<!-- OUTPUT:START -->
<!-- ⚠️ This content is auto-generated by `markdown-code-runner`. -->
```bash
usage: conda-join [-h] [-d DIRECTORY] [--depth DEPTH] [-o OUTPUT] [-v]
                  [--stdout]

Unified Conda and Pip requirements management.

options:
  -h, --help            show this help message and exit
  -d DIRECTORY, --directory DIRECTORY
                        Base directory to scan for requirements.yaml files, by
                        default `.`
  --depth DEPTH         Depth to scan for requirements.yaml files, by default
                        1
  -o OUTPUT, --output OUTPUT
                        Output file for the conda environment, by default
                        `environment.yaml`
  -v, --verbose         Print verbose output
  --stdout              Output to stdout instead of a file
```

<!-- OUTPUT:END -->


## :wrench: Advanced Configuration

`conda_join` allows advanced configurations such as verbose output and printing to `stdout` instead of a file.

- To enable verbose output, use the `-v` or `--verbose` flag.
- To print the combined environment to `stdout` instead of saving to a file, use the `--stdout` flag.

Example with advanced options:

```bash
conda_join -d src --depth 2 -o dev_environment.yaml --verbose
```

## :scroll: Output Options

- The output `environment.yaml` file will contain a unified list of dependencies from all scanned `requirements.yaml` files.
- If the `--stdout` flag is used, the combined environment will be printed to the console.

## :warning: Limitations

- The current version of `conda_join` does not support conflict resolution between different versions of the same package in multiple `requirements.yaml` files.
- Designed primarily for use with Conda environments; may not fully support other package management systems.

* * *

Try `conda_join` today for a streamlined approach to managing your Conda environment dependencies across multiple projects! 🎉👏
