# 🖥️ As a CLI See [example](https://github.com/basnijholt/unidep/tree/main/example/) for more information or check the output of `unidep -h` for the available sub commands: ```bash usage: unidep [-h] {merge,install,install-all,conda-lock,pixi-lock,pip-compile,pip,conda,version} ... Unified Conda and Pip requirements management. positional arguments: {merge,install,install-all,conda-lock,pixi-lock,pip-compile,pip,conda,version} Subcommands merge Combine multiple (or a single) `requirements.yaml` or `pyproject.toml` files into a single Conda installable `environment.yaml` file or Pixi installable `pixi.toml` file. install Automatically install all dependencies from one or more `requirements.yaml` or `pyproject.toml` files. This command first installs dependencies with Conda, then with Pip. Finally, it installs local packages (those containing the `requirements.yaml` or `pyproject.toml` files) using `pip install [-e] ./project`. install-all Install dependencies from all `requirements.yaml` or `pyproject.toml` files found in the current directory or specified directory. This command first installs dependencies using Conda, then Pip, and finally the local packages. conda-lock Generate a global `conda-lock.yml` file for a collection of `requirements.yaml` or `pyproject.toml` files. Additionally, create individual `conda- lock.yml` files for each `requirements.yaml` or `pyproject.toml` file consistent with the global lock file. pixi-lock Generate a global `pixi.lock` file for a collection of `requirements.yaml` or `pyproject.toml` files. Additionally, create individual `pixi.lock` files for each `requirements.yaml` or `pyproject.toml` file consistent with the global lock file. pip-compile Generate a fully pinned `requirements.txt` file from one or more `requirements.yaml` or `pyproject.toml` files using `pip-compile` from `pip-tools`. This command consolidates all pip dependencies defined in the `requirements.yaml` or `pyproject.toml` files and compiles them into a single `requirements.txt` file, taking into account the specific versions and dependencies of each package. pip Get the pip requirements for the current platform only. conda Get the conda requirements for the current platform only. version Print version information of unidep. options: -h, --help show this help message and exit ``` ## `unidep merge` Use `unidep merge` to scan directories for `requirements.yaml` file(s) and combine them into an `environment.yaml` file. See `unidep merge -h` for more information: ```bash usage: unidep merge [-h] [-o OUTPUT] [-n NAME] [--stdout] [--selector {sel,comment}] [--pixi] [-d DIRECTORY] [--depth DEPTH] [-v] [-p {linux-64,linux-aarch64,linux-ppc64le,osx-64,osx-arm64,win-64}] [--skip-dependency SKIP_DEPENDENCY] [--ignore-pin IGNORE_PIN] [--overwrite-pin OVERWRITE_PIN] Combine multiple (or a single) `requirements.yaml` or `pyproject.toml` files into a single Conda installable `environment.yaml` file or Pixi installable `pixi.toml` file. Example usage: `unidep merge --directory . --depth 1 --output environment.yaml` to search for `requirements.yaml` or `pyproject.toml` files in the current directory and its subdirectories and create `environment.yaml`. These are the defaults, so you can also just run `unidep merge`. options: -h, --help show this help message and exit -o, --output OUTPUT Output file for the conda environment, by default `environment.yaml` or `pixi.toml` if `--pixi` is used -n, --name NAME Name of the conda environment, by default `myenv` --stdout Output to stdout instead of a file --selector {sel,comment} The selector to use for the environment markers, if `sel` then `- numpy # [linux]` becomes `sel(linux): numpy`, if `comment` then it remains `- numpy # [linux]`, by default `sel` --pixi Generate a `pixi.toml` file instead of `environment.yaml` -d, --directory DIRECTORY Base directory to scan for `requirements.yaml` or `pyproject.toml` file(s), by default `.` --depth DEPTH Maximum depth to scan for `requirements.yaml` or `pyproject.toml` files, by default 1 -v, --verbose Print verbose output -p, --platform {linux-64,linux-aarch64,linux-ppc64le,osx-64,osx-arm64,win-64} The platform(s) to get the requirements for. Multiple platforms can be specified. By default, the current platform (`linux-64`) is used. --skip-dependency SKIP_DEPENDENCY Skip installing a specific dependency that is in one of the `requirements.yaml` or `pyproject.toml` files. This option can be used multiple times, each time specifying a different package to skip. For example, use `--skip-dependency pandas` to skip installing pandas. --ignore-pin IGNORE_PIN Ignore the version pin for a specific package, e.g., `--ignore-pin numpy`. This option can be repeated to ignore multiple packages. --overwrite-pin OVERWRITE_PIN Overwrite the version pin for a specific package, e.g., `--overwrite-pin 'numpy=1.19.2'`. This option can be repeated to overwrite the pins of multiple packages. ``` ## `unidep install` Use `unidep install` on one or more `requirements.yaml` files and install the dependencies on the current platform using conda, then install the remaining dependencies with pip, and finally install the current package with `pip install [-e] .`. See `unidep install -h` for more information: ```bash usage: unidep install [-h] [-v] [-e] [--skip-local] [--skip-pip] [--skip-conda] [--skip-dependency SKIP_DEPENDENCY] [--no-dependencies] [--conda-executable {conda,mamba,micromamba}] [-n CONDA_ENV_NAME | -p CONDA_ENV_PREFIX] [--dry-run] [--ignore-pin IGNORE_PIN] [--overwrite-pin OVERWRITE_PIN] [-f CONDA_LOCK_FILE] [--no-uv] files [files ...] Automatically install all dependencies from one or more `requirements.yaml` or `pyproject.toml` files. This command first installs dependencies with Conda, then with Pip. Finally, it installs local packages (those containing the `requirements.yaml` or `pyproject.toml` files) using `pip install [-e] ./project`. Example usage: `unidep install .` for a single project. For multiple projects: `unidep install ./project1 ./project2`. The command accepts both file paths and directories containing a `requirements.yaml` or `pyproject.toml` file. Use `--editable` or `-e` to install the local packages in editable mode. See `unidep install-all` to install all `requirements.yaml` or `pyproject.toml` files in and below the current folder. positional arguments: files The `requirements.yaml` or `pyproject.toml` file(s) to parse or folder(s) that contain those file(s), by default `.` options: -h, --help show this help message and exit -v, --verbose Print verbose output -e, --editable Install the project in editable mode --skip-local Skip installing local dependencies --skip-pip Skip installing pip dependencies from `requirements.yaml` or `pyproject.toml` --skip-conda Skip installing conda dependencies from `requirements.yaml` or `pyproject.toml` --skip-dependency SKIP_DEPENDENCY Skip installing a specific dependency that is in one of the `requirements.yaml` or `pyproject.toml` files. This option can be used multiple times, each time specifying a different package to skip. For example, use `--skip-dependency pandas` to skip installing pandas. --no-dependencies, --no-deps Skip installing dependencies from `requirements.yaml` or `pyproject.toml` file(s) and only install local package(s). Useful after installing a `conda-lock.yml` file because then all dependencies have already been installed. --conda-executable {conda,mamba,micromamba} The conda executable to use -n, --conda-env-name CONDA_ENV_NAME Name of the conda environment, if not provided, the currently active environment name is used, unless `--conda-env-prefix` is provided -p, --conda-env-prefix CONDA_ENV_PREFIX Path to the conda environment, if not provided, the currently active environment path is used, unless `--conda-env-name` is provided --dry-run, --dry Only print the commands that would be run --ignore-pin IGNORE_PIN Ignore the version pin for a specific package, e.g., `--ignore-pin numpy`. This option can be repeated to ignore multiple packages. --overwrite-pin OVERWRITE_PIN Overwrite the version pin for a specific package, e.g., `--overwrite-pin 'numpy=1.19.2'`. This option can be repeated to overwrite the pins of multiple packages. -f, --conda-lock-file CONDA_LOCK_FILE Path to the `conda-lock.yml` file to use for creating the new environment. Assumes that the lock file contains all dependencies. Must be used with `--conda- env-name` or `--conda-env-prefix`. --no-uv Disables the use of `uv` for pip install. By default, `uv` is used if it is available in the PATH. ``` ## `unidep install-all` Use `unidep install-all` on a folder with packages that contain `requirements.yaml` files and install the dependencies on the current platform using conda, then install the remaining dependencies with pip, and finally install the current package with `pip install [-e] ./package1 ./package2`. See `unidep install-all -h` for more information: ```bash usage: unidep install [-h] [-v] [-e] [--skip-local] [--skip-pip] [--skip-conda] [--skip-dependency SKIP_DEPENDENCY] [--no-dependencies] [--conda-executable {conda,mamba,micromamba}] [-n CONDA_ENV_NAME | -p CONDA_ENV_PREFIX] [--dry-run] [--ignore-pin IGNORE_PIN] [--overwrite-pin OVERWRITE_PIN] [-f CONDA_LOCK_FILE] [--no-uv] files [files ...] Automatically install all dependencies from one or more `requirements.yaml` or `pyproject.toml` files. This command first installs dependencies with Conda, then with Pip. Finally, it installs local packages (those containing the `requirements.yaml` or `pyproject.toml` files) using `pip install [-e] ./project`. Example usage: `unidep install .` for a single project. For multiple projects: `unidep install ./project1 ./project2`. The command accepts both file paths and directories containing a `requirements.yaml` or `pyproject.toml` file. Use `--editable` or `-e` to install the local packages in editable mode. See `unidep install-all` to install all `requirements.yaml` or `pyproject.toml` files in and below the current folder. positional arguments: files The `requirements.yaml` or `pyproject.toml` file(s) to parse or folder(s) that contain those file(s), by default `.` options: -h, --help show this help message and exit -v, --verbose Print verbose output -e, --editable Install the project in editable mode --skip-local Skip installing local dependencies --skip-pip Skip installing pip dependencies from `requirements.yaml` or `pyproject.toml` --skip-conda Skip installing conda dependencies from `requirements.yaml` or `pyproject.toml` --skip-dependency SKIP_DEPENDENCY Skip installing a specific dependency that is in one of the `requirements.yaml` or `pyproject.toml` files. This option can be used multiple times, each time specifying a different package to skip. For example, use `--skip-dependency pandas` to skip installing pandas. --no-dependencies, --no-deps Skip installing dependencies from `requirements.yaml` or `pyproject.toml` file(s) and only install local package(s). Useful after installing a `conda-lock.yml` file because then all dependencies have already been installed. --conda-executable {conda,mamba,micromamba} The conda executable to use -n, --conda-env-name CONDA_ENV_NAME Name of the conda environment, if not provided, the currently active environment name is used, unless `--conda-env-prefix` is provided -p, --conda-env-prefix CONDA_ENV_PREFIX Path to the conda environment, if not provided, the currently active environment path is used, unless `--conda-env-name` is provided --dry-run, --dry Only print the commands that would be run --ignore-pin IGNORE_PIN Ignore the version pin for a specific package, e.g., `--ignore-pin numpy`. This option can be repeated to ignore multiple packages. --overwrite-pin OVERWRITE_PIN Overwrite the version pin for a specific package, e.g., `--overwrite-pin 'numpy=1.19.2'`. This option can be repeated to overwrite the pins of multiple packages. -f, --conda-lock-file CONDA_LOCK_FILE Path to the `conda-lock.yml` file to use for creating the new environment. Assumes that the lock file contains all dependencies. Must be used with `--conda- env-name` or `--conda-env-prefix`. --no-uv Disables the use of `uv` for pip install. By default, `uv` is used if it is available in the PATH. ``` ## `unidep conda-lock` Use `unidep conda-lock` on one or multiple `requirements.yaml` files and output the conda-lock file. Optionally, when using a monorepo with multiple subpackages (with their own `requirements.yaml` files), generate a lock file for each subpackage. See `unidep conda-lock -h` for more information: ```bash usage: unidep conda-lock [-h] [--only-global] [--lockfile LOCKFILE] [--check-input-hash] [-d DIRECTORY] [--depth DEPTH] [-f FILE] [-v] [-p {linux-64,linux-aarch64,linux-ppc64le,osx-64,osx-arm64,win-64}] [--skip-dependency SKIP_DEPENDENCY] [--ignore-pin IGNORE_PIN] [--overwrite-pin OVERWRITE_PIN] ... Generate a global `conda-lock.yml` file for a collection of `requirements.yaml` or `pyproject.toml` files. Additionally, create individual `conda-lock.yml` files for each `requirements.yaml` or `pyproject.toml` file consistent with the global lock file. Example usage: `unidep conda-lock --directory ./projects` to generate conda-lock files for all `requirements.yaml` or `pyproject.toml` files in the `./projects` directory. Use `--only-global` to generate only the global lock file. The `--check-input- hash` option can be used to avoid regenerating lock files if the input hasn't changed. positional arguments: extra_flags Extra flags to pass to `conda-lock lock`. These flags are passed directly and should be provided in the format expected by `conda-lock lock`. For example, `unidep conda-lock -- --micromamba`. Note that the `--` is required to separate the flags for `unidep conda-lock` from the flags for `conda-lock lock`. options: -h, --help show this help message and exit --only-global Only generate the global lock file --lockfile LOCKFILE Specify a path for the global lockfile (default: `conda-lock.yml` in current directory). Path should be relative, e.g., `--lockfile ./locks/example.conda- lock.yml`. --check-input-hash Check existing input hashes in lockfiles before regenerating lock files. This flag is directly passed to `conda-lock`. -d, --directory DIRECTORY Base directory to scan for `requirements.yaml` or `pyproject.toml` file(s), by default `.` --depth DEPTH Maximum depth to scan for `requirements.yaml` or `pyproject.toml` files, by default 1 -f, --file FILE A single `requirements.yaml` or `pyproject.toml` file to use, or folder that contains that file. This is an alternative to using `--directory` which searches for all `requirements.yaml` or `pyproject.toml` files in the directory and its subdirectories. -v, --verbose Print verbose output -p, --platform {linux-64,linux-aarch64,linux-ppc64le,osx-64,osx-arm64,win-64} The platform(s) to get the requirements for. Multiple platforms can be specified. By default, the current platform (`linux-64`) is used. --skip-dependency SKIP_DEPENDENCY Skip installing a specific dependency that is in one of the `requirements.yaml` or `pyproject.toml` files. This option can be used multiple times, each time specifying a different package to skip. For example, use `--skip-dependency pandas` to skip installing pandas. --ignore-pin IGNORE_PIN Ignore the version pin for a specific package, e.g., `--ignore-pin numpy`. This option can be repeated to ignore multiple packages. --overwrite-pin OVERWRITE_PIN Overwrite the version pin for a specific package, e.g., `--overwrite-pin 'numpy=1.19.2'`. This option can be repeated to overwrite the pins of multiple packages. ``` ## `unidep pip-compile` Use `unidep pip-compile` on one or multiple `requirements.yaml` files and output a fully locked `requirements.txt` file using `pip-compile` from [`pip-tools`](https://pip-tools.readthedocs.io/en/latest/). See `unidep pip-compile -h` for more information: ```bash usage: unidep pip-compile [-h] [-o OUTPUT_FILE] [-d DIRECTORY] [--depth DEPTH] [-v] [-p {linux-64,linux-aarch64,linux-ppc64le,osx-64,osx-arm64,win-64}] [--skip-dependency SKIP_DEPENDENCY] [--ignore-pin IGNORE_PIN] [--overwrite-pin OVERWRITE_PIN] ... Generate a fully pinned `requirements.txt` file from one or more `requirements.yaml` or `pyproject.toml` files using `pip-compile` from `pip- tools`. This command consolidates all pip dependencies defined in the `requirements.yaml` or `pyproject.toml` files and compiles them into a single `requirements.txt` file, taking into account the specific versions and dependencies of each package. Example usage: `unidep pip-compile --directory ./projects` to generate a `requirements.txt` file for all `requirements.yaml` or `pyproject.toml` files in the `./projects` directory. Use `--output-file requirements.txt` to specify a different output file. positional arguments: extra_flags Extra flags to pass to `pip-compile`. These flags are passed directly and should be provided in the format expected by `pip-compile`. For example, `unidep pip- compile -- --generate-hashes --allow-unsafe`. Note that the `--` is required to separate the flags for `unidep pip-compile` from the flags for `pip-compile`. options: -h, --help show this help message and exit -o, --output-file OUTPUT_FILE Output file for the pip requirements, by default `requirements.txt` -d, --directory DIRECTORY Base directory to scan for `requirements.yaml` or `pyproject.toml` file(s), by default `.` --depth DEPTH Maximum depth to scan for `requirements.yaml` or `pyproject.toml` files, by default 1 -v, --verbose Print verbose output -p, --platform {linux-64,linux-aarch64,linux-ppc64le,osx-64,osx-arm64,win-64} The platform(s) to get the requirements for. Multiple platforms can be specified. By default, the current platform (`linux-64`) is used. --skip-dependency SKIP_DEPENDENCY Skip installing a specific dependency that is in one of the `requirements.yaml` or `pyproject.toml` files. This option can be used multiple times, each time specifying a different package to skip. For example, use `--skip-dependency pandas` to skip installing pandas. --ignore-pin IGNORE_PIN Ignore the version pin for a specific package, e.g., `--ignore-pin numpy`. This option can be repeated to ignore multiple packages. --overwrite-pin OVERWRITE_PIN Overwrite the version pin for a specific package, e.g., `--overwrite-pin 'numpy=1.19.2'`. This option can be repeated to overwrite the pins of multiple packages. ``` ## `unidep pip` Use `unidep pip` on a `requirements.yaml` file and output the pip installable dependencies on the current platform (default). See `unidep pip -h` for more information: ```bash usage: unidep pip [-h] [-f FILE] [-v] [-p {linux-64,linux-aarch64,linux-ppc64le,osx-64,osx-arm64,win-64}] [--skip-dependency SKIP_DEPENDENCY] [--ignore-pin IGNORE_PIN] [--overwrite-pin OVERWRITE_PIN] [--separator SEPARATOR] Get the pip requirements for the current platform only. Example usage: `unidep pip --file folder1 --file folder2/requirements.yaml --separator ' ' --platform linux-64` to extract all the pip dependencies specific to the linux-64 platform. Note that the `--file` argument can be used multiple times to specify multiple `requirements.yaml` or `pyproject.toml` files and that --file can also be a folder that contains a `requirements.yaml` or `pyproject.toml` file. options: -h, --help show this help message and exit -f, --file FILE The `requirements.yaml` or `pyproject.toml` file to parse, or folder that contains that file, by default `.` -v, --verbose Print verbose output -p, --platform {linux-64,linux-aarch64,linux-ppc64le,osx-64,osx-arm64,win-64} The platform(s) to get the requirements for. Multiple platforms can be specified. By default, the current platform (`linux-64`) is used. --skip-dependency SKIP_DEPENDENCY Skip installing a specific dependency that is in one of the `requirements.yaml` or `pyproject.toml` files. This option can be used multiple times, each time specifying a different package to skip. For example, use `--skip-dependency pandas` to skip installing pandas. --ignore-pin IGNORE_PIN Ignore the version pin for a specific package, e.g., `--ignore-pin numpy`. This option can be repeated to ignore multiple packages. --overwrite-pin OVERWRITE_PIN Overwrite the version pin for a specific package, e.g., `--overwrite-pin 'numpy=1.19.2'`. This option can be repeated to overwrite the pins of multiple packages. --separator SEPARATOR The separator between the dependencies, by default ` ` ``` ## `unidep conda` Use `unidep conda` on a `requirements.yaml` file and output the conda installable dependencies on the current platform (default). See `unidep conda -h` for more information: ```bash usage: unidep conda [-h] [-f FILE] [-v] [-p {linux-64,linux-aarch64,linux-ppc64le,osx-64,osx-arm64,win-64}] [--skip-dependency SKIP_DEPENDENCY] [--ignore-pin IGNORE_PIN] [--overwrite-pin OVERWRITE_PIN] [--separator SEPARATOR] Get the conda requirements for the current platform only. Example usage: `unidep conda --file folder1 --file folder2/requirements.yaml --separator ' ' --platform linux-64` to extract all the conda dependencies specific to the linux-64 platform. Note that the `--file` argument can be used multiple times to specify multiple `requirements.yaml` or `pyproject.toml` files and that --file can also be a folder that contains a `requirements.yaml` or `pyproject.toml` file. options: -h, --help show this help message and exit -f, --file FILE The `requirements.yaml` or `pyproject.toml` file to parse, or folder that contains that file, by default `.` -v, --verbose Print verbose output -p, --platform {linux-64,linux-aarch64,linux-ppc64le,osx-64,osx-arm64,win-64} The platform(s) to get the requirements for. Multiple platforms can be specified. By default, the current platform (`linux-64`) is used. --skip-dependency SKIP_DEPENDENCY Skip installing a specific dependency that is in one of the `requirements.yaml` or `pyproject.toml` files. This option can be used multiple times, each time specifying a different package to skip. For example, use `--skip-dependency pandas` to skip installing pandas. --ignore-pin IGNORE_PIN Ignore the version pin for a specific package, e.g., `--ignore-pin numpy`. This option can be repeated to ignore multiple packages. --overwrite-pin OVERWRITE_PIN Overwrite the version pin for a specific package, e.g., `--overwrite-pin 'numpy=1.19.2'`. This option can be repeated to overwrite the pins of multiple packages. --separator SEPARATOR The separator between the dependencies, by default ` ` ```