So far you have seen that any
.py Python source file can be used
as a module to import code. A Python package is a collection of separate
modules collected under a single name that share metadata, such as documentation,
licensing, and version numbering.
Here's an example directory structure for
my_package. Note the repeated use of
my_package directories. The individual modules are stored in the inner
my_package/ LICENSE README setup.py my_package/ __init__.py module1.py module2.py ...
Once this package has been installed you can import code from the modules using
Over the next several exercises you're going to re-use much of
the same code that was present in the
mortgage_rates Anaconda Project
to prepare a Python package that can be installed and imported in
new Python projects.
setup.py script file coordinates installing the package into your Python
Why is it important to package re-usable Python code?