Adding extra files

By default, setuptools will only copy Python files into your package. Our package contains more than that, though: we have documentation in RST, SQL scripts, and most importantly our PNG images, without which our program won't run.

Non-Python files inside our package can be specified using the package_data argument as follows:

setup(    #...        package_data={'abq_data_entry.images': ['*.png']},

The package_data argument takes a dictionary that matches module paths to a list of files or globbing expressions to be included in that module. Here, we're telling setuptools to include all the PNG files in the images module.

Our project contains other files outside the abq_data_entry module, which aren't needed for the program to operate, ...

Get Python GUI Programming with Tkinter now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.