Meet UniDep: A Tool that Streamlines Python Project Dependency Management by Unifying Conda and Pip Packages in a Single System


Handling dependencies in Python projects can often become daunting, especially when dealing with a mix of Python and non-Python packages. The constant juggling between different dependency files can lead to confusion and inefficiencies in the development process. Meet UniDep, a tool designed to streamline and simplify Python dependency management, making it an invaluable asset for developers, particularly in research, data science, robotics, AI, and ML projects.

Unified Dependency File

UniDep introduces a unified approach to managing Conda and Pip dependencies in a single file, using requirements.yaml or pyproject.toml. This eliminates the need to maintain separate files, such as requirements.txt and environment.yaml, simplifying the entire dependency landscape.

Build System Integration

One of UniDep’s notable features is its seamless integration with Setuptools and Hatchling. This ensures automatic dependency handling during the installation process, making it a breeze to set up development environments with just a single command: 

`unidep install ./your-package`.

One-Command Installation

UniDep’s `unidep install` command effortlessly handles Conda, Pip, and local dependencies, providing a comprehensive solution for developers seeking a hassle-free installation process.

Monorepo-Friendly

For projects within a monorepo structure, UniDep excels in rendering multiple requirements.yaml or pyproject.toml files into a single Conda environment.yaml file. This ensures consistent global and per-subpackage conda-lock files, simplifying dependency management across interconnected projects.

Platform-Specific Support

UniDep acknowledges the diversity of operating systems and architectures by allowing developers to specify dependencies tailored to different platforms. This ensures a smooth experience when working across various environments.

pip-compile Integration

UniDep integrates with pip-compile, enabling the generation of fully pinned requirements.txt files from requirements.yaml or pyproject.toml files. This promotes environment reproducibility and stability.

Integration with conda-lock

UniDep enhances the functionality of conda-lock by allowing the generation of fully pinned conda-lock.yml files from one or more requirements.yaml or pyproject.toml files. This tight integration ensures consistency in dependency versions, which is crucial for reproducible environments.

Nerd Stats

Developed in Python, UniDep boasts over 99% test coverage, full typing support, adherence to Ruff’s rules, extensibility, and minimal dependencies.

UniDep proves particularly useful when setting up complete development environments that require both Python and non-Python dependencies, such as CUDA, compilers, etc. Its one-command installation and support for various platforms make it a valuable tool in fields like research, data science, robotics, AI, and ML.

Real-World Application

UniDep shines in monorepos with multiple dependent projects, although many such projects are private. A public example, home-assistant-streamdeck-yaml, showcases UniDep’s efficiency in handling system dependencies across different platforms.

UniDep emerges as a powerful ally for developers seeking simplicity and efficiency in Python dependency management. Whether you prefer Conda or Pip, UniDep streamlines the process, making it an essential tool for anyone dealing with complex development environments. Try UniDep now and witness a significant boost in your development process.


Niharika is a Technical consulting intern at Marktechpost. She is a third year undergraduate, currently pursuing her B.Tech from Indian Institute of Technology(IIT), Kharagpur. She is a highly enthusiastic individual with a keen interest in Machine learning, Data science and AI and an avid reader of the latest developments in these fields.




Source link