Select variants of your dependencies with environment variables
Project description
hatch-deps-selector
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
Global dependency
Ensure hatch-deps-selector
is defined within the build-system.requires
field in your pyproject.toml
file.
[build-system]
requires = ["hatchling", "hatch-deps-selector"]
build-backend = "hatchling.build"
Build plugin
The build plugin name is selector
.
-
pyproject.toml
[tool.hatch.build.hooks.selector] env-var = <ENV-VAR-NAME> [tool.hatch.build.hooks.selector.variants.<VARIANT>] dependencies = ["numpy"]
-
hatch.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 license.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file hatch_deps_selector-0.0.1.tar.gz
.
File metadata
- Download URL: hatch_deps_selector-0.0.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 649217e36ce39b3eb4999f38db49b2b61d1ba38a51b02f9cc47e4cf0e3e77852 |
|
MD5 | 327226312c3821572c369453656c77f3 |
|
BLAKE2b-256 | 8e1b84d38294ee1faa3a2e5c28064a3adc68dddfa3221c627d2608f6d0107bb5 |
File details
Details for the file hatch_deps_selector-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: hatch_deps_selector-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | efbd52559a5349d60270b9f331ff510afa51464d6f8397cae5754a92af226648 |
|
MD5 | 3002c13bf33635eb42909fed05d9f7c6 |
|
BLAKE2b-256 | 124a9f6ec9ec928b47d877d112b275b0e81e7c0c165267338274eeee942a005e |