Skip to main content

hatch-conda-build

Conda package builder for Hatch. Hatch is modern, extensible Python project manager.

Usage

Add hatch-conda-build within the build-system.requires field in your pyproject.toml file.

[build-system]
requires = ["hatchling", "hatch-conda-build"]
build-backend = "hatchling.build"

Additionally conda-build must be in your current path when running a hatch build.

hatch-conda-build uses grayskull to translate the requirements section of your pyproject.toml, which specifies dependencies on PyPi, to appropriate conda package names.

Building Conda Package

The builder plugin defines the conda target.

To start build process, run hatch build -t conda:

$ hatch build -t conda
[conda]
...

Installing the local package

The ouptut package is written to the dist/conda directory. This directory is a fully-indexed conda channel and can be used to install the package.

$ conda install -c ./dist/conda <package-name>

Conda-build Options

Additional builder configuration can be set in the following TOML header.

[tool.hatch.build.targets.conda]
...

Following table contains available customization of builder behavior.

Option Type Default Description
channels list[str] ['conda-forge'] Channels used for package build and testing
default_numpy_version str None numpy version, otherwise use conda-build default

Modifying the generated recipe

You can specify recipe metadata keys in following TOML header

[tool.hatch.build.targets.conda.recipe]
...

Recipe metadata is defined in TOML syntax. The metadata is merged using deepmerge with the following strategies

recipe_merger = Merger(
    type_strategies=[
        (dict, ["merge"]),
        (list, ["append"])
    ],
    fallback_strategies=["override"],
    type_conflict_strategies=["override"]
)

Most importantly, this will append list values if the key already exists. For example you can use nested key TOML syntax:

[tool.hatch.build.targets.conda.recipe]
requirements.run = ["anaconda-anon-usage"]
test.imports = ["my_package"]

will append the package name anaconda-anon-usage to the autogenerated run requirements and inject the test section into the recipe before it is built.

License

Plugin hatch-conda-build is distributed under the terms of the MIT license.

Release files for hatch-conda-build 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-conda-build 0.1.2
File Size Uploaded
hatch_conda_build-0.1.2.tar.gz 6.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hatch-conda-build 0.1.2
File Interpreter ABI Platform
hatch_conda_build-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 13.3 kB

Release files / hatch_conda_build-0.1.2.tar.gz

Download URL hatch_conda_build-0.1.2.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1385f4986f544e5a2a555404b12282266711942485b1f2eaa1b72e3ba91fbae8
BLAKE2b-256 checksum
How to use checksums
c0107c14dbb919542cf909a46fafb4c39a6d04fb09bdc649c5f7bc9bfe7873bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 17, 2025.

Transparency log

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

Download URL hatch_conda_build-0.1.2-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f8febc77a658516fb7dba2c92fc59d486f5ecfd6a0b6569fb8758a13d69f81a
BLAKE2b-256 checksum
How to use checksums
1a484d1affb4c0e17c4398c4c7e1d36f90a95ce683a455d8a700027a0c8f567c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 17, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

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