A package is a collection of Python modules. This lets you organize even larger sets of capabilities into a single package. For example, perhaps you want to create an
log_analysis
package that includes many different sets of capabilities, and perhaps it will grow over time. Within this package, you want to include a set of functions that let users search log files (
log_search) and a set of functions to append, split, and save log files, which you'll call (
log_file_ops). Each module is a file that sits within a
log_analysis
folder. You can even nest packages, so that you can include multiple packages in a single
web_ops package. To do this, you simply create a top-level folder named
web_ops, add the
log_analysis
folder and create sibling folders such as
web_server. Below is a view of the folder structure:
web_ops/ Top-level package
__init__.py Initialize the web_ops package
web_server/ Subpackage for web server functionality
__init__.py Initialize the web_server package
deploy.py Functions to deploy your web server
start.py Functions to start your web server
log_analysis/ Subpackage for log analysis functionality
__init__.py Initialize the log_analysis package
log_search.py Functions to search your logs
log_file_ops.py Functions to modify your log files