How to include license file in setup.py script? | Python

Developers Group
2 min readApr 25, 2021

The basics of how to configure, package and distribute your own Python projects. It assumes that you are already familiar with the contents of the Installing Packages page.

This article does not aim to cover best practices for Python project development as a whole. For example, it does not provide guidance or tool recommendations for version control, documentation, or testing. This is more about showing how to include license file in setup.py when you plan to distribute with license.

Example: Assume I’m planning to license the xyz module under the BSD license. In my source tree, the file LICENSE.txt is in the top folder along with setup.py.

Fix: Write a setup.cfg file and in there specify:

[metadata]
license_files = LICENSE.txt

For this to work it seems like wheel is required to be installed. That is:

pip install wheel

If you have wheel already installed and it doesn't work, try to update it:

pip install --upgrade wheel

Read More & Originally published here.

--

--

Developers Group

A Developer is responsible for coding, designing, deploying, and debugging development projects, typically on the server-side (or back-end).