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] default-variant = "foo" env-var = <ENV-VAR-NAME> [tool.hatch.build.hooks.selector.variants.foo] dependencies = ["numpy"]
-
hatch.toml
[build.hooks.selector] default-variant = "foo" env-var = <ENV-VAR-NAME> [build.hooks.selector.variants.foo] 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 |
---|---|---|---|
default-variant |
str |
None | Name of default variant to use if environment variable is unset. |
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.1.2.tar.gz
.
File metadata
- Download URL: hatch_deps_selector-0.1.2.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d87d62c83292ce356e9f1b0386dd4f88de7f2ab0e52bfe476fc3e4ee2421e61 |
|
MD5 | ca12d4cca7665f9b9cf5308ee9b22758 |
|
BLAKE2b-256 | d9901ad348089226ad1c2190f5be2dacc487d17ed745db666e62c80b4c0907e0 |
Provenance
File details
Details for the file hatch_deps_selector-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: hatch_deps_selector-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa257b0d1b11cf4936a8301cacccb9185d0bf51913a59a276eae124d2ac9bc4d |
|
MD5 | 13e081c78de66e176598eab4e49a5102 |
|
BLAKE2b-256 | b6332f808dc1445e5a4f056d034f1dc031b0242879abd6b6ce18596860f4e4ba |