Package: conda-join
:rocket:conda-join- Unified Conda and Pip Requirements Management :rocket:conda-joinsimplifies Python project dependency management by enabling a singlerequirements.yamlfile to handle both Conda and Pip dependencies.
This streamlined approach allows for creating a unified Condaenvironment.yaml, while also seamlessly integrating withsetup.pyorpyproject.toml.
In addition, it can be used as a CLI to combine multiplerequirements.yamlfiles into a singleenvironment.yamlfile.
Simplify your setup and maintain all your dependencies in one place withconda-join.:books: Table of Contents:package: Installation:page_facing_up:requirements.yamlstructureExampleKey PointsPlatform SelectorsSupported SelectorsUsageImplementation:memo: UsageWithpyproject.tomlorsetup.py:memo: As a CLILimitations:package: InstallationTo installconda-join, run the following command:pipinstall-Uconda-joinOr just copy the script to your computer:wgethttps://raw.githubusercontent.com/basnijholt/conda-join/main/conda_join.py:page_facing_up:requirements.yamlstructureconda-joinprocessesrequirements.yamlfiles with a specific format:name(Optional): For documentation, not used in the output.channels: List of sources for packages, such asconda-forge.dependencies: Mix of Conda and Pip packages.ExampleExample of arequirements.yamlfile:name:example_environmentchannels:-conda-forgedependencies:-numpy# same name on conda and pip-conda:python-graphviz# When names differ between Conda and Pippip:graphviz-pip:slurm-usage# pip-only-conda:mumps# conda-only⚠️conda-joincan process this file inpyproject.tomlorsetup.pyand create aenvironment.yamlfile.Key PointsStandard names (e.g.,- numpy) are assumed to be the same for Conda and Pip.Useconda: <package>andpip: <package>to specify different names across platforms.Usepip:to specify packages that are only available through Pip.Useconda:to specify packages that are only available through Conda.Using the CLIconda-joinwill combine these dependencies into a singleenvironment.yamlfile, structured as follows:name:some_namechannels:-conda-forgedependencies:-numpy-python-graphviz-mumpspip:-slurm-usagePlatform SelectorsThis tool supports a range of platform selectors that allow for specific handling of dependencies based on the user's operating system and architecture. This feature is particularly useful for managing conditional dependencies in diverse environments.Supported SelectorsThe following selectors are supported:linux: For all Linux-based systems.linux64: Specifically for 64-bit Linux systems.aarch64: For Linux systems on ARM64 architectures.ppc64le: For Linux on PowerPC 64-bit Little Endian architectures.osx: For all macOS systems.osx64: Specifically for 64-bit macOS systems.arm64: For macOS systems on ARM64 architectures (Apple Silicon).macos: An alternative toosxfor macOS systems.unix: A general selector for all UNIX-like systems (includes Linux and macOS).win: For all Windows systems.win64: Specifically for 64-bit Windows systems.UsageSelectors are used inrequirements.yamlfiles to conditionally include dependencies based on the platform:dependencies:-some-package# [unix]-another-package# [win]-special-package# [osx64]-pip:cirq# [macos]conda:cirq# [linux]In this example:some-packageis included only in UNIX-like environments (Linux and macOS).another-packageis specific to Windows.special-packageis included only for 64-bit macOS systems.cirqis managed bypipon macOS and bycondaon Linux. This demonstrates how you can specify different package managers for the same package based on the platform.ImplementationThe tool parses these selectors and filters dependencies according to the platform where it's being run.
This is particularly useful for creating environment files that are portable across different platforms, ensuring that each environment has the appropriate dependencies installed.:memo: UsageWithpyproject.tomlorsetup.pyTo useconda-joinin your project, you can configure it inpyproject.toml. This setup works alongside arequirements.yamlfile located in the same directory. The behavior depends on your project's setup:When using onlypyproject.toml: Thedependenciesfield inpyproject.tomlwill be automatically populated based on the contents ofrequirements.yaml.When usingsetup.py: Theinstall_requiresfield insetup.pywill be automatically populated, reflecting the dependencies defined inrequirements.yaml.Here's an examplepyproject.tomlconfiguration:[build-system]build-backend="setuptools.build_meta"requires=["setuptools","wheel","conda-join"][project]dynamic=["dependencies"]In this configuration,conda-joinis included as a build requirement, allowing it to process the Python dependencies in therequirements.yamlfile and update the project's dependencies accordingly.:memo: As a CLIUseconda-jointo scan directories forrequirements.yamlfile(s) and combine them into anenvironment.yamlfile.
Seeexamplefor more information or check the output ofconda-join -h:usage:conda-join[-h][-dDIRECTORY][-oOUTPUT][-nNAME][--depthDEPTH][--stdout][-v]UnifiedCondaandPiprequirementsmanagement.

options:-h,--helpshowthishelpmessageandexit-dDIRECTORY,--directoryDIRECTORYBasedirectorytoscanforrequirements.yamlfiles,bydefault`.`-oOUTPUT,--outputOUTPUTOutputfileforthecondaenvironment,bydefault`environment.yaml`-nNAME,--nameNAMENameofthecondaenvironment,bydefault`myenv`--depthDEPTHDepthtoscanforrequirements.yamlfiles,bydefault1--stdoutOutputtostdoutinsteadofafile-v,--verbosePrintverboseoutputLimitationsNo Conflict Resolution: Doesn't resolve version conflicts between differentrequirements.yamlfiles.Conda-Focused: Best suited for Conda environments.Tryconda-jointoday for a streamlined approach to managing your Conda environment dependencies across multiple projects! 🎉👏