Skip to main content

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.

Release files for hatch-deps-selector 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hatch-deps-selector 0.1.2
File Size Uploaded
hatch_deps_selector-0.1.2.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hatch-deps-selector 0.1.2
File Interpreter ABI Platform
hatch_deps_selector-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 10.3 kB

Release files / hatch_deps_selector-0.1.2.tar.gz

Download URL hatch_deps_selector-0.1.2.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6d87d62c83292ce356e9f1b0386dd4f88de7f2ab0e52bfe476fc3e4ee2421e61
BLAKE2b-256 checksum
How to use checksums
d9901ad348089226ad1c2190f5be2dacc487d17ed745db666e62c80b4c0907e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.5

Release files / hatch_deps_selector-0.1.2-py3-none-any.whl

Download URL hatch_deps_selector-0.1.2-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa257b0d1b11cf4936a8301cacccb9185d0bf51913a59a276eae124d2ac9bc4d
BLAKE2b-256 checksum
How to use checksums
b6332f808dc1445e5a4f056d034f1dc031b0242879abd6b6ce18596860f4e4ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.5

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page