Skip to Content
Mastering Python
book

Mastering Python

by Rick Hattem
April 2016
Intermediate to advanced content levelIntermediate to advanced
486 pages
9h 21m
English
Packt Publishing
Content preview from Mastering Python

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'])
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Advanced Python Programming

Advanced Python Programming

Dr. Gabriele Lanaro, Quan Nguyen, Sakis Kasampalis
Getting Started with Python

Getting Started with Python

Fabrizio Romano, Benjamin Baka, Dusty Phillips
Python for Geeks

Python for Geeks

Muhammad Asif

Publisher Resources

ISBN: 9781785289729Supplemental Content