From e0e30c0db7ff5af17cb2456422bbed394be21116 Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Fri, 24 Nov 2023 14:12:30 -0800 Subject: [PATCH] Rename package from conda-join to unidep (#8) * Rename package from conda-join to unidep * Rename files * Update README.md * More renames * Update README.md * Requirements -> Dependency --------- Co-authored-by: github-actions[bot] --- README.md | 50 ++++++++++---------- example/README.md | 6 +-- pyproject.toml | 17 ++++--- tests/__init__.py | 2 +- tests/{test_conda_join.py => test_unidep.py} | 4 +- conda_join.py => unidep.py | 6 +-- 6 files changed, 42 insertions(+), 43 deletions(-) rename tests/{test_conda_join.py => test_unidep.py} (99%) rename conda_join.py => unidep.py (99%) diff --git a/README.md b/README.md index 53671b16..55242587 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -# :rocket: `conda-join` - Unified Conda and Pip Requirements Management :rocket: +# :rocket: UniDep - Unified Conda and Pip Dependency Management :rocket: -[![PyPI](https://img.shields.io/pypi/v/conda-join.svg)](https://pypi.python.org/pypi/conda-join) -[![Build Status](https://github.com/basnijholt/conda-join/actions/workflows/pytest.yml/badge.svg)](https://github.com/basnijholt/conda-join/actions/workflows/pytest.yml) -[![CodeCov](https://codecov.io/gh/basnijholt/conda-join/branch/main/graph/badge.svg)](https://codecov.io/gh/basnijholt/conda-join) +[![PyPI](https://img.shields.io/pypi/v/unidep.svg)](https://pypi.python.org/pypi/unidep) +[![Build Status](https://github.com/basnijholt/unidep/actions/workflows/pytest.yml/badge.svg)](https://github.com/basnijholt/unidep/actions/workflows/pytest.yml) +[![CodeCov](https://codecov.io/gh/basnijholt/unidep/branch/main/graph/badge.svg)](https://codecov.io/gh/basnijholt/unidep) -`conda-join` simplifies Python project dependency management by enabling a single `requirements.yaml` file to handle both Conda and Pip dependencies. +`unidep` simplifies Python project dependency management by enabling a single `requirements.yaml` file to handle both Conda and Pip dependencies. This streamlined approach allows for creating a unified Conda `environment.yaml`, while also seamlessly integrating with `setup.py` or `pyproject.toml`. In addition, it can be used as a CLI to combine multiple `requirements.yaml` files into a single `environment.yaml` file. -Simplify your setup and maintain all your dependencies in one place with `conda-join`. +Simplify your setup and maintain all your dependencies in one place with `unidep`. ## :books: Table of Contents @@ -33,20 +33,20 @@ Simplify your setup and maintain all your dependencies in one place with `conda- ## :package: Installation -To install `conda-join`, run the following command: +To install `unidep`, run the following command: ```bash -pip install -U conda-join +pip install -U unidep ``` Or just copy the script to your project: ```bash -wget https://raw.githubusercontent.com/basnijholt/conda-join/main/conda_join.py +wget https://raw.githubusercontent.com/basnijholt/unidep/main/unidep.py ``` ## :page_facing_up: `requirements.yaml` structure -`conda-join` processes `requirements.yaml` files with a specific format: +`unidep` processes `requirements.yaml` files with a specific format: - **name** (Optional): For documentation, not used in the output. - **channels**: List of sources for packages, such as `conda-forge`. @@ -70,7 +70,7 @@ dependencies: - conda: cuda-toolkit # [linux64] ``` -**⚠️ `conda-join` can process this file in `pyproject.toml` or `setup.py` and create a `environment.yaml` file.** +**⚠️ `unidep` can process this file in `pyproject.toml` or `setup.py` and create a `environment.yaml` file.** ### Key Points @@ -79,7 +79,7 @@ dependencies: - Use `pip:` to specify packages that are only available through Pip. - Use `conda:` to specify packages that are only available through Conda. -Using the CLI `conda-join` will combine these dependencies into a single conda installable `environment.yaml` file. +Using the CLI `unidep` will combine these dependencies into a single conda installable `environment.yaml` file. ### Platform Selectors @@ -127,21 +127,21 @@ This is particularly useful for creating environment files that are portable acr ### Conflict Resolution -`conda-join` features a conflict resolution mechanism to manage version conflicts and platform-specific dependencies in `requirements.yaml` files. This functionality ensures optimal package version selection based on specified requirements. +`unidep` features a conflict resolution mechanism to manage version conflicts and platform-specific dependencies in `requirements.yaml` files. This functionality ensures optimal package version selection based on specified requirements. #### How It Works -- **Version Pinning Priority**: `conda-join` gives priority to version-pinned packages when multiple versions of the same package are specified. For instance, if both `foo` and `foo <1` are listed, `foo <1` is selected due to its specific version pin. +- **Version Pinning Priority**: `unidep` gives priority to version-pinned packages when multiple versions of the same package are specified. For instance, if both `foo` and `foo <1` are listed, `foo <1` is selected due to its specific version pin. -- **Minimal Scope Selection**: `conda-join` resolves platform-specific dependency conflicts by preferring the version with the most limited platform scope. For instance, given `foo <1 # [linux64]` and `foo >1`, it installs `foo <1` exclusively on Linux-64 and `foo >1` on all other platforms. This approach ensures platform-specific requirements are precisely met. +- **Minimal Scope Selection**: `unidep` resolves platform-specific dependency conflicts by preferring the version with the most limited platform scope. For instance, given `foo <1 # [linux64]` and `foo >1`, it installs `foo <1` exclusively on Linux-64 and `foo >1` on all other platforms. This approach ensures platform-specific requirements are precisely met. -- **Resolving Intractable Conflicts**: When conflicts are irreconcilable (e.g., `foo >1` vs. `foo <1`), `conda-join` issues a warning and defaults to the first encountered specification. +- **Resolving Intractable Conflicts**: When conflicts are irreconcilable (e.g., `foo >1` vs. `foo <1`), `unidep` issues a warning and defaults to the first encountered specification. ## :memo: Usage ### With `pyproject.toml` or `setup.py` -To use `conda-join` in your project, you can configure it in `pyproject.toml`. This setup works alongside a `requirements.yaml` file located in the same directory. The behavior depends on your project's setup: +To use `unidep` in your project, you can configure it in `pyproject.toml`. This setup works alongside a `requirements.yaml` file located in the same directory. The behavior depends on your project's setup: - **When using only `pyproject.toml`**: The `dependencies` field in `pyproject.toml` will be automatically populated based on the contents of `requirements.yaml`. - **When using `setup.py`**: The `install_requires` field in `setup.py` will be automatically populated, reflecting the dependencies defined in `requirements.yaml`. @@ -151,29 +151,29 @@ Here's an example `pyproject.toml` configuration: ```toml [build-system] build-backend = "setuptools.build_meta" -requires = ["setuptools", "wheel", "conda-join"] +requires = ["setuptools", "wheel", "unidep"] [project] dynamic = ["dependencies"] ``` -In this configuration, `conda-join` is included as a build requirement, allowing it to process the Python dependencies in the `requirements.yaml` file and update the project's dependencies accordingly. +In this configuration, `unidep` is included as a build requirement, allowing it to process the Python dependencies in the `requirements.yaml` file and update the project's dependencies accordingly. ### :memo: As a CLI -Use `conda-join` to scan directories for `requirements.yaml` file(s) and combine them into an `environment.yaml` file. -See [example](example/) for more information or check the output of `conda-join -h`: +Use `unidep` to scan directories for `requirements.yaml` file(s) and combine them into an `environment.yaml` file. +See [example](example/) for more information or check the output of `unidep -h`: - + ```bash -usage: conda-join [-h] [-d DIRECTORY] [-o OUTPUT] [-n NAME] [--depth DEPTH] - [--stdout] [-v] +usage: unidep [-h] [-d DIRECTORY] [-o OUTPUT] [-n NAME] [--depth DEPTH] + [--stdout] [-v] Unified Conda and Pip requirements management. @@ -199,4 +199,4 @@ options: * * * -Try `conda-join` today for a streamlined approach to managing your Conda environment dependencies across multiple projects! 🎉👏 +Try `unidep` today for a streamlined approach to managing your Conda environment dependencies across multiple projects! 🎉👏 diff --git a/example/README.md b/example/README.md index 82663c82..983a5edf 100644 --- a/example/README.md +++ b/example/README.md @@ -2,16 +2,16 @@ Run `requirements.yaml` files in subdirectories and combine them into an `environment.yaml` file. -Here we can just run `conda_join` with no arguments, since the defaults are the same as what we want. +Here we can just run `unidep` with no arguments, since the defaults are the same as what we want. This would be the same as running: ```bash -conda_join --directory . --depth 1 --output environment.yaml +unidep --directory . --depth 1 --output environment.yaml ``` or ```bash -conda_join -d . --depth 1 -o environment.yaml +unidep -d . --depth 1 -o environment.yaml ``` See the resulting [`environment.yaml`](environment.yaml) file. diff --git a/pyproject.toml b/pyproject.toml index 425a801d..9a86fef0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=42", "wheel"] build-backend = "setuptools.build_meta" [project] -name = "conda-join" +name = "unidep" description = "Unified Conda and Pip requirements management." dynamic = ["version"] authors = [{ name = "Bas Nijholt", email = "bas@nijho.lt" }] @@ -15,27 +15,26 @@ file = "README.md" content-type = "text/markdown" [project.urls] -Homepage = "https://github.com/basnijholt/conda-join" +Homepage = "https://github.com/basnijholt/unidep" [project.optional-dependencies] test = ["pytest", "pre-commit", "coverage", "pytest-cov", "pytest-mock"] [project.scripts] -conda-join = "conda_join:main" -conda_join = "conda_join:main" +unidep = "unidep:main" [project.entry-points."setuptools.finalize_distribution_options"] -conda-join = "conda_join:setuptools_finalizer" +unidep = "unidep:setuptools_finalizer" [tool.setuptools] -py-modules = ["conda_join"] +py-modules = ["unidep"] [tool.setuptools.dynamic] -version = {attr = "conda_join.__version__"} +version = {attr = "unidep.__version__"} [tool.pytest.ini_options] addopts = """ - --cov=conda_join + --cov=unidep --cov-report term --cov-report html --cov-fail-under=95 @@ -88,6 +87,6 @@ tag = true tag_name = "v{new_version}" [[tool.bumpversion.files]] -filename = "conda_join.py" +filename = "unidep.py" replace = '__version__ = "{new_version}"' search = '__version__ = "{current_version}"' diff --git a/tests/__init__.py b/tests/__init__.py index 9f49bd27..a6df561b 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1 +1 @@ -"""Tests for the ``conda_join`` package.""" +"""Tests for the ``unidep`` package.""" diff --git a/tests/test_conda_join.py b/tests/test_unidep.py similarity index 99% rename from tests/test_conda_join.py rename to tests/test_unidep.py index 65ea65e5..2baae349 100644 --- a/tests/test_conda_join.py +++ b/tests/test_unidep.py @@ -1,4 +1,4 @@ -"""conda_join tests.""" +"""unidep tests.""" from __future__ import annotations import textwrap @@ -8,7 +8,7 @@ import pytest import yaml -from conda_join import ( +from unidep import ( CondaEnvironmentSpec, Meta, _build_pep508_environment_marker, diff --git a/conda_join.py b/unidep.py similarity index 99% rename from conda_join.py rename to unidep.py index 9cdab7fe..8b8dfba0 100755 --- a/conda_join.py +++ b/unidep.py @@ -553,9 +553,9 @@ def write_conda_environment_file( f.seek(0, 0) command_line_args = " ".join(sys.argv[1:]) txt = [ - f"# This file is created and managed by `conda-join` {__version__}.", - "# For details see https://github.com/basnijholt/conda-join", - f"# File generated with: `conda-join {command_line_args}`", + f"# This file is created and managed by `unidep` {__version__}.", + "# For details see https://github.com/basnijholt/unidep", + f"# File generated with: `unidep {command_line_args}`", ] content = "\n".join(txt) + "\n\n" + content f.write(content)