A Hatch plugin to enable building a conda package from your pyproject.toml without having to write a separate conda build recipe meta.yaml file
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file hatch_conda_build-0.1.2.tar.gz
.
File metadata
- Download URL: hatch_conda_build-0.1.2.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
1385f4986f544e5a2a555404b12282266711942485b1f2eaa1b72e3ba91fbae8
|
|
MD5 |
00079ba452581f0eb53f727813a0f60d
|
|
BLAKE2b-256 |
c0107c14dbb919542cf909a46fafb4c39a6d04fb09bdc649c5f7bc9bfe7873bd
|
Provenance
The following attestation bundles were made for hatch_conda_build-0.1.2.tar.gz
:
Publisher:
release.yaml
on conda-incubator/hatch-conda-build
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
hatch_conda_build-0.1.2.tar.gz
-
Subject digest:
1385f4986f544e5a2a555404b12282266711942485b1f2eaa1b72e3ba91fbae8
- Sigstore transparency entry: 198660808
- Sigstore integration time:
-
Permalink:
conda-incubator/hatch-conda-build@70af628e58b05165f57e635f12dff4ea7fc85be4
-
Branch / Tag:
refs/tags/v0.1.2
- Owner: https://github.com/conda-incubator
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
release.yaml@70af628e58b05165f57e635f12dff4ea7fc85be4
-
Trigger Event:
push
-
Statement type:
File details
Details for the file hatch_conda_build-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: hatch_conda_build-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
2f8febc77a658516fb7dba2c92fc59d486f5ecfd6a0b6569fb8758a13d69f81a
|
|
MD5 |
8bd15ea2f6621dd54d5c56a9b280d60b
|
|
BLAKE2b-256 |
1a484d1affb4c0e17c4398c4c7e1d36f90a95ce683a455d8a700027a0c8f567c
|
Provenance
The following attestation bundles were made for hatch_conda_build-0.1.2-py3-none-any.whl
:
Publisher:
release.yaml
on conda-incubator/hatch-conda-build
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
hatch_conda_build-0.1.2-py3-none-any.whl
-
Subject digest:
2f8febc77a658516fb7dba2c92fc59d486f5ecfd6a0b6569fb8758a13d69f81a
- Sigstore transparency entry: 198660815
- Sigstore integration time:
-
Permalink:
conda-incubator/hatch-conda-build@70af628e58b05165f57e635f12dff4ea7fc85be4
-
Branch / Tag:
refs/tags/v0.1.2
- Owner: https://github.com/conda-incubator
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
release.yaml@70af628e58b05165f57e635f12dff4ea7fc85be4
-
Trigger Event:
push
-
Statement type: