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.0.2.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

hatch_deps_selector-0.0.2-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hatch_deps_selector-0.0.2.tar.gz
  • Upload date:
  • Size: 3.5 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.0.2.tar.gz
Algorithm Hash digest
SHA256 934cb6a51aef29f4236df67812dbc84cfd20af90b6a7de7593d7e5e90c1ad708
MD5 5d8e68afe9b06c79cb4265cb566b456d
BLAKE2b-256 06b95f5fd7ca9bec2174e1b06c230a0686e7cec0dd105fee220e430b734d7202

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hatch_deps_selector-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c284e9b2ac044b6f0d88da3f534b514924f06e8996f0173b95c7371cb7ee90d6
MD5 327014b19b952dcf576f34afd2ae8f1f
BLAKE2b-256 6cf64c3a40a66a252b22203944851d430446f3a64263bfb91b1c7c47efe86756

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