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]
    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

hatch_deps_selector-0.1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

hatch_deps_selector-0.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hatch_deps_selector-0.1.0.tar.gz
  • Upload date:
  • Size: 3.6 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.0.tar.gz
Algorithm Hash digest
SHA256 c45445044c860d6f2e0df48e6ad75e331cc342db59dec732f286fdd03a18c7d1
MD5 a74b2c774a22687ba8ee2fa6bc967baa
BLAKE2b-256 827966e5431e82b03c8328eaa9473f19e8548ae17f50cbb71dbde017430a89f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hatch_deps_selector-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40cf712e3b6ebf7b6dd6bf391a62a90e71a22aee42103fe19f85d8883c9b5e8f
MD5 53ac9128d088451352dc24ceba1980ba
BLAKE2b-256 dc012fa3b8f159cdae4fe6b086b8440f40c94119fbb88d7f1a2e8feea4a8788a

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