MCPcopy Index your code
hub / github.com/conda-incubator/unidep

github.com/conda-incubator/unidep @v3.4.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.4.2 ↗ · + Follow
959 symbols 4,223 edges 55 files 391 documented · 41% updated 12d agov3.4.2 · 2026-06-25★ 24420 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

UniDep - Unified Conda and Pip Dependency Management

PyPI Build Status CodeCov GitHub Repo stars Documentation Python Bytes

UniDep logo

UniDep streamlines Python project dependency management by unifying Conda and Pip packages in a single system. Learn when to use UniDep in our FAQ.

Handling dependencies in Python projects can be challenging, especially when juggling Python and non-Python packages. This often leads to confusion and inefficiency, as developers juggle between multiple dependency files.

  • 📝 Unified Dependency File: Use either requirements.yaml or pyproject.toml to manage both Conda and Pip dependencies in one place.
  • ⚙️ Build System Integration: Integrates with Setuptools and Hatchling for automatic dependency handling during pip install ./your-package.
  • 💻 One-Command Installation: unidep install handles Conda, Pip, and local dependencies effortlessly.
  • ⚡️ Fast Pip Operations: Leverages uv (if installed) for faster pip installations.
  • 🏢 Monorepo-Friendly: Render (multiple) requirements.yaml or pyproject.toml files into one Conda environment.yaml file and maintain fully consistent global and per sub package conda-lock files.
  • 🌍 Platform-Specific Support: Specify dependencies for different operating systems or architectures.
  • 🔧 pip-compile Integration: Generate fully pinned requirements.txt files from requirements.yaml or pyproject.toml files using pip-compile.
  • 🔒 Integration with conda-lock: Generate fully pinned conda-lock.yml files from (multiple) requirements.yaml or pyproject.toml file(s), leveraging conda-lock.
  • 🥧 Pixi Support: Generate pixi.toml files from your dependency files, enabling Pixi-based workflows while keeping UniDep as the single source of truth.
  • 🤓 Nerd stats: written in Python, 100% test coverage, fully-typed, all Ruff's rules enabled, easily extensible, and minimal dependencies

unidep is designed to make dependency management in Python projects as simple and efficient as possible. Try it now and streamline your development process!

[!TIP] Check out the example requirements.yaml and pyproject.toml below.

:books: Table of Contents

:rocket: Bootstrap from Scratch

To get started quickly with UniDep, run the following command. This will download and install micromamba (recommended for fast Conda environment management), uv (recommended for faster pip installations), and then install UniDep:

"${SHELL}" <(curl -LsSf raw.githubusercontent.com/conda-incubator/unidep/main/bootstrap.sh)

[!NOTE] Micromamba and uv are recommended to optimize your installation experience, but they are not required if you prefer to use your existing Conda and pip setup.

[!WARNING] NEVER! run scripts from the internet without understanding what they do. Always inspect the script first!

Pin the hash of the bootstrap script with:

"${SHELL}" <(curl -LsSf raw.githubusercontent.com/conda-incubator/unidep/8a4fa7f70063481164f3e630fd752a65cc7aaacb/bootstrap.sh)

:package: Installation

To install unidep, run one of the following commands that use pipx (recommended), pip, or conda:

pipx install "unidep[all]"  # Recommended (install as a standalone CLI)

or

pip install "unidep[all]"

or

conda install -c conda-forge unidep

:memo: requirements.yaml and pyproject.toml structure

unidep allows either using a 1. requirements.yaml file with a specific format (similar but not the same as a Conda environment.yaml file) or 2. pyproject.toml file with a [tool.unidep] section.

Both files contain the following keys:

  • name (Optional): For documentation, not used in the output.
  • channels: List of conda channels for packages, such as conda-forge.
  • dependencies: Mix of Conda and Pip packages.
  • local_dependencies (Optional): List of paths to other requirements.yaml or pyproject.toml files to include.
  • optional_dependencies (Optional): Dictionary with lists of optional dependencies.
  • platforms (Optional): List of platforms that are supported (used in conda-lock).
  • pip_indices (Optional): List of custom pip index URLs for private or alternative package repositories.
  • requires_unidep (Optional): Version specifier for the unidep version required to parse the file.

Whether you use a requirements.yaml or pyproject.toml file, the same information can be specified in either. Choose the format that works best for your project.

Example

Example requirements.yaml

Example of a requirements.yaml file:

name: example_environment
requires_unidep: ">=3.4.1"  # (Optional) require this unidep version or newer
channels:
  - conda-forge
dependencies:
  - numpy                   # same name on conda and pip
  - conda: python-graphviz  # When names differ between Conda and Pip
    pip: graphviz
  - pip: slurm-usage >=1.1.0,<2  # pip-only
  - conda: mumps                 # conda-only
  # Use platform selectors
  - conda: cuda-toolkit =11.8    # [linux64]
local_dependencies:
  - ../other-project-using-unidep     # include other projects that use unidep
  - ../common-requirements.yaml       # include other requirements.yaml files
  - ../project-not-managed-by-unidep  # 🚨 Skips its dependencies!
optional_dependencies:
  test:
    - pytest
  full:
    - ../other-local-dep[test]  # include its optional 'test' dependencies
platforms:  # (Optional) specify platforms that are supported (used in conda-lock)
  - linux-64
  - osx-arm64
pip_indices:  # (Optional) additional pip index URLs for private packages
  - https://pypi.org/simple/  # Main PyPI index (automatically included if not specified)
  - https://private.example.com/simple/  # Private index
  - https://${PIP_USER}:${PIP_PASSWORD}@private.example.com/simple/  # Authenticated index with env vars

[!IMPORTANT] unidep can process this during pip install and create a Conda installable environment.yaml or conda-lock.yml file, and more!

[!NOTE] For a more in-depth example containing multiple installable projects, see the example directory.

Example pyproject.toml

Alternatively, one can fully configure the dependencies in the pyproject.toml file in the [tool.unidep] section:

[tool.unidep]
requires_unidep = ">=3.4.1"  # (Optional) require this unidep version or newer
channels = ["conda-forge"]
dependencies = [
    "numpy",                                         # same name on conda and pip
    { conda = "python-graphviz", pip = "graphviz" }, # When names differ between Conda and Pip
    { pip = "slurm-usage >=1.1.0,<2" },              # pip-only
    { conda = "mumps" },                             # conda-only
    { conda = "cuda-toolkit =11.8:linux64" }         # Use platform selectors by appending `:linux64`
]
local_dependencies = [
    "../other-project-using-unidep",    # include other projects that use unidep
    "../common-requirements.yaml",      # include other requirements.yaml files
    "../project-not-managed-by-unidep"  # 🚨 Skips its dependencies!
]
optional_dependencies = {
    test = ["pytest"],
    full = ["../other-local-dep[test]"]  # include its optional 'test' dependencies
}
platforms = [ # (Optional) specify platforms that are supported (used in conda-lock)
    "linux-64",
    "osx-arm64"
]
pip_indices = [ # (Optional) additional pip index URLs for private packages
    "https://pypi.org/simple/",  # Main PyPI index (automatically included if not specified)
    "https://private.example.com/simple/",  # Private index
    "https://${PIP_USER}:${PIP_PASSWORD}@private.example.com/simple/"  # Authenticated index with env vars
]

This data structure is identical to the requirements.yaml format, with the exception of the name field and the platform selectors. In the requirements.yaml file, one can use e.g., # [linux64], which in the pyproject.toml file is :linux64 at the end of the package name.

See Build System Integration for more information on how to set up unidep with different build systems (Setuptools or Hatchling).

[!IMPORTANT] In these docs, we often menti

Core symbols most depended-on inside this repo

Shape

Function 805
Method 92
Class 50
Route 12

Languages

Python100%

Modules by API surface

tests/test_pixi.py103 symbols
tests/test_cli.py88 symbols
tests/test_doctor.py73 symbols
unidep/_doctor.py61 symbols
tests/test_unidep.py59 symbols
unidep/_cli.py49 symbols
unidep/_dependency_selection.py40 symbols
unidep/_dependencies_parsing.py37 symbols
tests/test_pip_indices_cli.py37 symbols
unidep/utils.py36 symbols
unidep/_pixi.py35 symbols
tests/test_pypi_alternatives.py30 symbols

For agents

$ claude mcp add unidep \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page