Skip to content

Commit

Permalink
DOCS: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
agoose77 authored Aug 27, 2024
1 parent 098c751 commit 9909343
Showing 1 changed file with 42 additions and 3 deletions.
45 changes: 42 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,56 @@

-----

This package provides a Hatch plugin for configuring "variants" of dependencies according to an environment variable.
This can be used e.g. to change the package dependencies for conda-forge vs PyPI builds.

## Table of Contents

- [Installation](#installation)
- [License](#license)

## Installation
## Global dependency

Ensure `hatch-deps-selector` is defined within the `build-system.requires` field in your `pyproject.toml` file.

```console
pip install hatch-deps-selector
```toml
[build-system]
requires = ["hatchling", "hatch-deps-selector"]
build-backend = "hatchling.build"
```

## Build plugin

The [build plugin](https://hatch.pypa.io/latest/plugins/build-hook/reference/) name is `selector`.

- ***pyproject.toml***

```toml
[tool.hatch.build.hooks.selector]
env-var = <ENV-VAR-NAME>

[tool.hatch.build.hooks.selector.variants.<VARIANT>]
dependencies = ["numpy"]
```

- ***hatch.toml***

```toml
[build.hooks.selector.variants.PYPI]
dependencies = ["numpy"]
```

By default, set `HATCH_SELECTOR_VARIANT=<VARIANT>` to select the dependencies from `<VARIANT>` as additional project dependencies.
This might be used to only pull in certain dependencies when building for PyPI vs conda-forge.


### Build plugin options

| Option | Type | Default | Description |
|------------|--------|--------------------------|--------------------------------------------------------|
| `env-var` | `str` | `HATCH_SELECTOR_VARIANT` | Name of environment variable to control built variant. |
| `variants` | `dict` | `{}` | Table of variant-tables with `dependencies` field. |

## License

`hatch-deps-selector` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.

0 comments on commit 9909343

Please sign in to comment.