0

in a setuptools defined Python lib I could choose which files I wanted ton include using the following:

[tool.setuptools]
include-package-data = true

For hatch I didn't find any mention of this parameter in the documentation, is it automatic ? If not what parameter should I use ?

Pierrick Rambaud
  • 1,726
  • 1
  • 20
  • 47

1 Answers1

0

Yes, the include-package-data parameter is automatic in Hatch. This means that all files in the package's source directory, as well as any directories marked as data_files, will be included in the wheel.

If you want to exclude some files from the wheel, you can use the only-include parameter. This parameter takes a list of glob patterns, and only the files that match these patterns will be included.

For example, the following configuration would include all files in the src/mypackage directory, as well as all files in the scripts directory:

[tool.hatch.build.targets.wheel]
only-include = ["src/mypackage", "scripts"]

You can also use the sources parameter to specify the specific files that should be included in the wheel. This parameter takes a list of file paths, and only the files that are listed will be included.

For example, the following configuration would include the src/mypackage/main.py file and the scripts/myscript.sh file:

[tool.hatch.build.targets.wheel.sources]
"src/mypackage/main.py" = ""
"scripts/myscript.sh" = ""

I hope this helps!

Mohamad Raad
  • 179
  • 6