Login
📚 Introduction to Python Programming
Chapters ▾
⇩ Download ▾

7.5 Finding modules

Learning objectives

By the end of this section you should be able to

  • Explain differences between the standard library and PyPI.
  • Search python.org and pypi.org for modules of interest.

Built-in modules

The Python Standard Library is a collection of built-in functions and modules that support common programming tasks. Ex: The math module provides functions like sqrt and constants like pi. Python's official documentation includes a library reference and a module index for becoming familiar with the standard library.

For decades, Python has maintained a "batteries included" philosophy. This philosophy means that the standard library should come with everything most programmers need. In fact, the standard library includes over 200 built-in modules!

Table 7.1 Example built-in modules in the standard library.
ModuleDescription
calendarGeneral calendar-related functions.
datetimeBasic date and time types and functions.
emailGenerate and process email messages.
mathMathematical functions and constants.
osInteract with the operating system.
randomGenerate pseudo-random numbers.
statisticsMathematical statistics functions.
sysSystem-specific parameters and functions.
turtleEducational framework for simple graphics.
zipfileRead and write ZIP-format archive files.

Third-party modules

The Python Package Index (PyPI), available at pypi.org, is the official third-party software library for Python. The abbreviation "PyPI" is pronounced like pie pea eye (in contrast to PyPy, a different project).

PyPI allows anyone to develop and share modules with the Python community. Module authors include individuals, large companies, and non-profit organizations. PyPI helps programmers install modules and receive updates.

Most software available on PyPI is free and open source. PyPI is supported by the Python Software Foundation and is maintained by an independent group of developers.

Table 7.2 Example third-party modules available from PyPI.
ModuleDescription
arrowConvert and format dates, times, and timestamps.
BeautifulSoupExtract data from HTML and XML documents.
bokehInteractive plots and applications in the browser.
matplotlibStatic, animated, and interactive visualizations.
moviepyVideo editing, compositing, and processing.
nltkNatural language toolkit for human languages.
numpyFundamental package for numerical computing.
pandasData analysis, time series, and statistics library.
pillowImage processing for jpg, png, and other formats.
pytestFull-featured testing tool and unit test framework.
requestsElegant HTTP library for connecting to web servers.
scikit-learnSimple, efficient tools for predictive data analysis.
scipyFundamental algorithms for scientific computing.
scrapyCrawl websites and scrape data from web pages.
tensorflowEnd-to-end machine learning platform for everyone.