Skip to content

Commit

Permalink
Rename package from conda-join to unidep (#8)
Browse files Browse the repository at this point in the history
* 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] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
basnijholt and github-actions[bot] authored Nov 24, 2023
1 parent 9ed3606 commit e0e30c0
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 43 deletions.
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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`.
Expand All @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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`.
Expand All @@ -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`:

<!-- CODE:BASH:START -->
<!-- echo '```bash' -->
<!-- conda-join -h -->
<!-- unidep -h -->
<!-- echo '```' -->
<!-- CODE:END -->
<!-- OUTPUT:START -->
<!-- ⚠️ This content is auto-generated by `markdown-code-runner`. -->
```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.
Expand All @@ -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! 🎉👏
6 changes: 3 additions & 3 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
17 changes: 8 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "[email protected]" }]
Expand All @@ -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
Expand Down Expand Up @@ -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}"'
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""Tests for the ``conda_join`` package."""
"""Tests for the ``unidep`` package."""
4 changes: 2 additions & 2 deletions tests/test_conda_join.py → tests/test_unidep.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""conda_join tests."""
"""unidep tests."""
from __future__ import annotations

import textwrap
Expand All @@ -8,7 +8,7 @@
import pytest
import yaml

from conda_join import (
from unidep import (
CondaEnvironmentSpec,
Meta,
_build_pep508_environment_marker,
Expand Down
6 changes: 3 additions & 3 deletions conda_join.py → unidep.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e0e30c0

Please sign in to comment.