Open
Description
Using include
on build targets, I end up with different files included in the final wheel depending on if the build is made with hatch build
or through another tool (e.g. build
or uv build
).
- hatch version: 1.14.0
- reproduction repository: https://github.com/mkniewallner/repro-hatch-wheel-diff
Minimal reproducing example from the repository above:
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "foo"
version = "0.0.1"
description = ""
authors = []
requires-python = "~=3.10"
[tool.hatch.build.targets.sdist]
include = ["sdist.py", "sdist_wheel.py"]
[tool.hatch.build.targets.wheel]
include = ["sdist_wheel.py", "wheel.py"]
- Building with
hatch
:
$ uvx [email protected] build && echo "---sdist---" && tar -tzf dist/foo-0.0.1.tar.gz && echo "---wheel---" && unzip -l dist/foo-0.0.1-py3-none-any.whl
[...]
---sdist---
foo-0.0.1/sdist.py
foo-0.0.1/sdist_wheel.py
foo-0.0.1/pyproject.toml
foo-0.0.1/PKG-INFO
---wheel---
Archive: dist/foo-0.0.1-py3-none-any.whl
Length Date Time Name
--------- ---------- ----- ----
0 02-02-2020 00:00 sdist_wheel.py
0 02-02-2020 00:00 wheel.py
71 02-02-2020 00:00 foo-0.0.1.dist-info/METADATA
87 02-02-2020 00:00 foo-0.0.1.dist-info/WHEEL
322 02-02-2020 00:00 foo-0.0.1.dist-info/RECORD
--------- -------
480 5 files
- Building with
build
(same result foruv build
):
$ uvx --from [email protected] python -m build && echo "---sdist---" && tar -tzf dist/foo-0.0.1.tar.gz && echo "---wheel---" && unzip -l dist/foo-0.0.1-py3-none-any.whl
[...]
---sdist---
foo-0.0.1/sdist.py
foo-0.0.1/sdist_wheel.py
foo-0.0.1/pyproject.toml
foo-0.0.1/PKG-INFO
---wheel---
Archive: dist/foo-0.0.1-py3-none-any.whl
Length Date Time Name
--------- ---------- ----- ----
0 02-02-2020 00:00 sdist_wheel.py
71 02-02-2020 00:00 foo-0.0.1.dist-info/METADATA
87 02-02-2020 00:00 foo-0.0.1.dist-info/WHEEL
260 02-02-2020 00:00 foo-0.0.1.dist-info/RECORD
--------- -------
418 4 files
With hatch build
, wheel.py
is included in the wheel, but when invoking build backend through build
(or uv build
), it is not.
If I update include
in [tool.hatch.build.targets.sdist]
to include wheel.py
, like so:
[tool.hatch.build.targets.sdist]
include = ["sdist.py", "sdist_wheel.py", "wheel.py"]
then when building with build
(or uv build
), the wheel will include wheel.py
.
So it looks like when using another build backend, files included in the wheel that are not also in the sdist are not included.
Metadata
Metadata
Assignees
Labels
No labels