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

tool.hatch.build.targets.sdist.include is ignored for non-python files #1817

Open
eguiraud-pf opened this issue Nov 19, 2024 · 1 comment
Open

Comments

@eguiraud-pf
Copy link

Hello, I am trying to convince hatch to include some C++ source files in the sdist archive. I would like to understand why using include does not work (force-include does, but it does not support globs like **/*.h, so it's not optimal).

Given the docs I would expect this to work.

I'm using all the globs I could think of but the sdist does not contain that submodule.h file:

[tool.hatch.build.targets.sdist]
include = [
  "hatch_bazel_and_pybind11/**/*.h",
  "hatch_bazel_and_pybind11/cpp/submodule",
  "hatch_bazel_and_pybind11/cpp/submodule/submodule.h",
  "src/hatch_bazel_and_pybind11/cpp/submodule",
  "src/hatch_bazel_and_pybind11/cpp/submodule",
  "src/hatch_bazel_and_pybind11/cpp/submodule/submodule.h",
]

A full reproducer is available at https://github.com/eguiraud/hatch-bazel-and-pybind11/tree/include-problem-repro .

@henryiii
Copy link
Contributor

FWIW, I think the nested folder is more suspect than non Python files. Non Python files are fine in the first subfolder, it's just missing the second folder entirely. If I remove all hatch configuration (I don't think that

[tool.hatch.build]
packages = ["src/hatch_bazel_and_pybind11"]

is correct, you need

[tool.hatch.build.targets.wheel]
packages = ["src/hatch_bazel_and_pybind11"]

instead (https://hatch.pypa.io/latest/config/build/#packages).

Another interesting observation: if I turn off vcs file selection, I get:

$ uv build --sdist
$ tar -tf dist/*.tar.gz | grep submodule
hatch_bazel_and_pybind11-0.0.5/src/hatch_bazel_and_pybind11/cpp/bazel-bin/submodule/submodule.cppmap
hatch_bazel_and_pybind11-0.0.5/src/hatch_bazel_and_pybind11/cpp/bazel-cpp/submodule/BUILD.bazel
hatch_bazel_and_pybind11-0.0.5/src/hatch_bazel_and_pybind11/cpp/bazel-cpp/submodule/submodule.h

These are showing up in the generated directories, but hatch_bazel_and_pybind11-0.0.5/src/hatch_bazel_and_pybind11/cpp/submodule is still not present.

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

2 participants