O'Reilly logo

Mastering Python by Rick van Hattem

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Packages

In our example, we simply use packages=setuptools.find_packages(). In most cases this will work just fine, but it's important to understand what it does. The find_packages function looks through all the directories within the given directory and adds it to the list if it has an __init__.py file inside. So instead of find_packages() you can generally use ['your_package'] instead. If you have several packages however, that tends to get tedious. That's where find_packages() is useful; simply specify some inclusion parameters (second parameter) or some exclusion parameters (third parameter) and you'll have all the relevant packages within your project. For example:

packages = find_packages(exclude=['tests', 'docs'])

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required