Skip to main content

Select variants of your dependencies with environment variables

Project description

hatch-deps-selector

PyPI - Version PyPI - Python Version


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

hatch_deps_selector-0.1.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

hatch_deps_selector-0.1.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file hatch_deps_selector-0.1.1.tar.gz.

File metadata

  • Download URL: hatch_deps_selector-0.1.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for hatch_deps_selector-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4c2eef06c95805ecd1ac257ad7b0d49fbaf493d4033f8c4a6ae27e2dec3f2380
MD5 a836fbee9be70fbad24a222e48c61a92
BLAKE2b-256 cdf6ddf1f0923ffa2344f26477b73e9e7f40528843cf17a578e3b9c31efd4b58

See more details on using hashes here.

File details

Details for the file hatch_deps_selector-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for hatch_deps_selector-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7a360a104a3ae30629b3c494217eb3d7a69e6d806bdb22d7c587b9249a78c868
MD5 04cec9c3fe29dac3cce9616a837f85e6
BLAKE2b-256 14554d747b3bd32bd4ff7621e9dfa2f01d6b31b589474b8f3a8f07c16df518a9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page