# hatch-buildext
[![PyPI - Version](https://img.shields.io/pypi/v/hatch-buildext.svg)](https://pypi.org/project/hatch-buildext)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/hatch-buildext.svg)](https://pypi.org/project/hatch-buildext)
[![Checks & Tests](https://github.com/xoudini/hatch-buildext/actions/workflows/test.yml/badge.svg)](https://github.com/xoudini/hatch-buildext/actions)
---
## Table of Contents
- [Usage](#usage)
- [Example](#example)
- [Resolvers](#resolvers)
- [License](#license)
## Usage
The only key currently recognised is `extensions`.
This should be a map of key-value pairs mapping the extension name to a [resolver](#resolvers).
```toml
# pyproject.toml
[tool.hatch.build.targets.wheel.hooks.buildext]
dependencies = ["hatch-buildext"]
[tool.hatch.build.targets.wheel.hooks.buildext.extensions]
libsome = "path.to.resolver"
libother = "path.to.another"
```
### Example
For instance, if using [src layout][src-layout],
the directory structure could look as follows:
```console
.
├── LICENSE.txt
├── README.md
├── pyproject.toml
├── src
│ ├── resolvers
│ │ ├── lib_a.py
│ │ └── lib_b.py
│ ├── liba
│ │ ├── foo.h
│ │ └── foo.c
│ ├── libb
│ │ ├── bar.h
│ │ └── bar.c
│ └── mypackage
│ ├── __about__.py
│ ├── __init__.py
│ ├── ...
│ └── core.py
└── tests
├── __init__.py
├── conftest.py
├── ...
└── test_core.py
```
Then, if that you want to include both libraries as module extensions in `mypackage`,
the `extensions` configuration would look as follows:
```toml
[tool.hatch.build.targets.wheel.hooks.buildext.extensions]
"mypackage.lib_a" = "src.resolvers.lib_a"
"mypackage.lib_b" = "src.resolvers.lib_b"
```
> [!WARNING]
> The configuration may change at any time until this package is stable.
### Resolvers
Resolvers may implement or omit any part of the interface [here](./src/hatch_buildext/resolver.py).
Each function will be passed the root of of the project directory while building,
in order to make it easier to provide paths to build requirements in the project tree.
The meaning of these functions are identical to those in the [setuptools Extension API][setuptools].
> [!WARNING]
> The interface may change at any time until this package is stable.
## License
`hatch-buildext` is distributed under the terms of the [Apache-2.0][license] license.
<!-- MARK: links -->
[src-layout]: https://packaging.python.org/en/latest/discussions/src-layout-vs-flat-layout
[setuptools]: https://setuptools.pypa.io/en/latest/userguide/ext_modules.html
[license]: https://spdx.org/licenses/Apache-2.0.html
Raw data
{
"_id": null,
"home_page": null,
"name": "hatch-buildext",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "build, extension modules, hatch, packaging",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/15/85/a57217b83dd1ab291f088ceb5cf9bcdae9580af97dd32182564839ffc404/hatch_buildext-0.2.0.tar.gz",
"platform": null,
"description": "# hatch-buildext\n\n[![PyPI - Version](https://img.shields.io/pypi/v/hatch-buildext.svg)](https://pypi.org/project/hatch-buildext)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/hatch-buildext.svg)](https://pypi.org/project/hatch-buildext)\n[![Checks & Tests](https://github.com/xoudini/hatch-buildext/actions/workflows/test.yml/badge.svg)](https://github.com/xoudini/hatch-buildext/actions)\n\n---\n\n## Table of Contents\n\n- [Usage](#usage)\n - [Example](#example)\n - [Resolvers](#resolvers)\n- [License](#license)\n\n## Usage\n\nThe only key currently recognised is `extensions`.\nThis should be a map of key-value pairs mapping the extension name to a [resolver](#resolvers).\n\n```toml\n# pyproject.toml\n[tool.hatch.build.targets.wheel.hooks.buildext]\ndependencies = [\"hatch-buildext\"]\n\n[tool.hatch.build.targets.wheel.hooks.buildext.extensions]\nlibsome = \"path.to.resolver\"\nlibother = \"path.to.another\"\n```\n\n### Example\n\nFor instance, if using [src layout][src-layout],\nthe directory structure could look as follows:\n\n```console\n.\n\u251c\u2500\u2500 LICENSE.txt\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 pyproject.toml\n\u251c\u2500\u2500 src\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 resolvers\n\u2502\u00a0\u00a0 \u2502 \u251c\u2500\u2500 lib_a.py\n\u2502\u00a0\u00a0 \u2502 \u2514\u2500\u2500 lib_b.py\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 liba\n\u2502\u00a0\u00a0 \u2502 \u251c\u2500\u2500 foo.h\n\u2502\u00a0\u00a0 \u2502 \u2514\u2500\u2500 foo.c\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 libb\n\u2502\u00a0\u00a0 \u2502 \u251c\u2500\u2500 bar.h\n\u2502\u00a0\u00a0 \u2502 \u2514\u2500\u2500 bar.c\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 mypackage\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 __about__.py\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 __init__.py\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 ...\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 core.py\n\u2514\u2500\u2500 tests\n \u251c\u2500\u2500 __init__.py\n \u251c\u2500\u2500 conftest.py\n \u251c\u2500\u2500 ...\n \u2514\u2500\u2500 test_core.py\n```\n\nThen, if that you want to include both libraries as module extensions in `mypackage`,\nthe `extensions` configuration would look as follows:\n\n```toml\n[tool.hatch.build.targets.wheel.hooks.buildext.extensions]\n\"mypackage.lib_a\" = \"src.resolvers.lib_a\"\n\"mypackage.lib_b\" = \"src.resolvers.lib_b\"\n```\n\n> [!WARNING]\n> The configuration may change at any time until this package is stable.\n\n### Resolvers\n\nResolvers may implement or omit any part of the interface [here](./src/hatch_buildext/resolver.py).\nEach function will be passed the root of of the project directory while building,\nin order to make it easier to provide paths to build requirements in the project tree.\n\nThe meaning of these functions are identical to those in the [setuptools Extension API][setuptools].\n\n> [!WARNING]\n> The interface may change at any time until this package is stable.\n\n## License\n\n`hatch-buildext` is distributed under the terms of the [Apache-2.0][license] license.\n\n<!-- MARK: links -->\n\n[src-layout]: https://packaging.python.org/en/latest/discussions/src-layout-vs-flat-layout\n[setuptools]: https://setuptools.pypa.io/en/latest/userguide/ext_modules.html\n[license]: https://spdx.org/licenses/Apache-2.0.html\n",
"bugtrack_url": null,
"license": null,
"summary": null,
"version": "0.2.0",
"project_urls": {
"Documentation": "https://github.com/xoudini/hatch-buildext#readme",
"Issues": "https://github.com/xoudini/hatch-buildext/issues",
"Source": "https://github.com/xoudini/hatch-buildext"
},
"split_keywords": [
"build",
" extension modules",
" hatch",
" packaging"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e2cfea8890a39d1efa5a62291e4297d556346b4704d08cddf318c18143537956",
"md5": "f3add763634f345bd832066aab330a06",
"sha256": "29aef40b776b7be1b8d72ebae4858a1a4ac94ad3e4e345f38bdb103a650998d4"
},
"downloads": -1,
"filename": "hatch_buildext-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f3add763634f345bd832066aab330a06",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 11969,
"upload_time": "2024-12-24T14:26:58",
"upload_time_iso_8601": "2024-12-24T14:26:58.935416Z",
"url": "https://files.pythonhosted.org/packages/e2/cf/ea8890a39d1efa5a62291e4297d556346b4704d08cddf318c18143537956/hatch_buildext-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1585a57217b83dd1ab291f088ceb5cf9bcdae9580af97dd32182564839ffc404",
"md5": "b2361c2e6a0260ccc3510815c20efc49",
"sha256": "b11dae010cdad3ec607bbbfa828780ad585656a191a8c788c5fda4eaebe53c03"
},
"downloads": -1,
"filename": "hatch_buildext-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "b2361c2e6a0260ccc3510815c20efc49",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 10671,
"upload_time": "2024-12-24T14:27:00",
"upload_time_iso_8601": "2024-12-24T14:27:00.162442Z",
"url": "https://files.pythonhosted.org/packages/15/85/a57217b83dd1ab291f088ceb5cf9bcdae9580af97dd32182564839ffc404/hatch_buildext-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-24 14:27:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "xoudini",
"github_project": "hatch-buildext#readme",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "hatch-buildext"
}