How to ship data files with a python binary distribution?

Viewed 1045

I'd like to create a bdist for my Python package. The package contains a LICENSE file which is mandatory as part of the distribution.

I added a reference to the LICENSE file in my MANIFEST.IN file, and indeed after creating an sdist for my package, the LICENSE file was there.

However, it seems like when I build a Python wheel for my package (python setup.py bdist_wheel), the LICENSE file is nowhere to be seen.

I'm familiar with the setup.py's concepts of package_data and data_files - yet they do not seem to be relevant in my use case: package_data requires the LICENSE file to be inside a Python package, but I'm required to have this file on the top level folder of the project, which isn't a Python package. data_files requires me to map the target directory for the file after installation, but instead of having it be relative to the project's packages, it's relative to the python installation - which I find to be very weird, as it might depend on the OS/platform, whether virtualenv is used or not, etc.

I understand that at the end of the day, the packages get installed under site-packages and there's no room for "top level files" post-installation. Still, I'm looking for a way to have the LICENSE file as part of my wheel, even if it doesn't get copied later on during installation to any specific location.

1 Answers
Related