Behind the Curtain: Modules, Packages, and Libraries

Following a question asked after our Geolunch session, "What is numpy?" We thought it would be useful to provide a brief overview of python's modules, packages, and libraries: what they are and how they are useful.

Since ArchaeoPy focuses on scientific applications, we often want to reuse the same functions and variables. Luckily for us, python has a great selection of modules and packages that we can use to simplify our projects; instead of having to define our own functions and variables with each project.

A module is a file that contains definitions of functions, variables, and classes that can be imported and run in other modules. A package is a directory of modules. A library is a collection of packages and modules.

Python already has a great standard library with built-in functions, constants, and types that we will regularly use. However, we will often want and need to go beyond the standard library tools, and to that end, there is a range of other powerful numeric and scientific libraries and modules that we can utilise. Below lists just few of which we frequently utilise for our scientific applications (hopefully familiar from the code in our Geolunch presentation and in our ArchaeoPy repository):

NumPy: Numpy is one of our fundamental packages because it handles and processes arrays, which are what we use to structure our geophysical data.

matplotlib: matplotlib is a plotting library. In our examples, we have used matplotlib to produce greyscales.

PyQt: We have used PyQt to create our graphical user interfaces (GUI).