Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to included data file in distribution using hatch?

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 ?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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!

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading