Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different files included in wheels between hatch build and build from other tools #1874

Open
mkniewallner opened this issue Jan 1, 2025 · 0 comments

Comments

@mkniewallner
Copy link

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).

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 for uv 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.

@mkniewallner mkniewallner changed the title Different file included in wheels between hatch build and build from other tools Different files included in wheels between hatch build and build from other tools Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant