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.
requirements.yaml or pyproject.toml to manage both Conda and Pip dependencies in one place.pip install ./your-package.unidep install handles Conda, Pip, and local dependencies effortlessly.uv (if installed) for faster pip installations.requirements.yaml or pyproject.toml files into one Conda environment.yaml file and maintain fully consistent global and per sub package conda-lock files.pip-compile Integration: Generate fully pinned requirements.txt files from requirements.yaml or pyproject.toml files using pip-compile.conda-lock: Generate fully pinned conda-lock.yml files from (multiple) requirements.yaml or pyproject.toml file(s), leveraging conda-lock.pixi.toml files from your dependency files, enabling Pixi-based workflows while keeping UniDep as the single source of truth.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.yamlandpyproject.tomlbelow.
requirements.yaml and pyproject.toml structure[project.dependencies] in pyproject.toml handlinguse
use valuesunidep mergeunidep installunidep install-allunidep conda-lockunidep pixi
unidep pip-compileunidep pipunidep condaunidep doctorconda-lock and unidep conda-lock?hatch-conda / pdm-conda and unidep?pip install fails with FileNotFoundErrorTo 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)
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
requirements.yaml and pyproject.toml structureunidep 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:
conda-forge.requirements.yaml or pyproject.toml files to include.conda-lock).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.
requirements.yamlExample 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]
unidepcan process this duringpip installand create a Conda installableenvironment.yamlorconda-lock.ymlfile, and more![!NOTE] For a more in-depth example containing multiple installable projects, see the
exampledirectory.
pyproject.tomlAlternatively, 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
$ claude mcp add unidep \
-- python -m otcore.mcp_server <graph>