liveBook · Manning

Chapter 19: Using Python libraries

What you will learn in chapter 19 of The Quick Python Book, Fourth Edition

The introduction explains Python’s “batteries included” philosophy and introduces the chapter’s survey of libraries.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The introduction explains Python’s “batteries included” philosophy and introduces the chapter’s survey of libraries.

Key terms: batteries included, stock install, standard library

19.1 “Batteries included”: The standard library

This section defines what Python’s standard library includes and recommends checking it before looking for an external library.

Key terms: built-in data types, built-in functions, exceptions, modules, library reference, Python documentation, external library

19.1.1 Managing various data types

This subsection groups standard-library modules by the kinds of data they help handle.

Key terms: standard library, string services, data types, numeric and mathematical modules

19.1.2 Manipulating files and storage

This subsection identifies files and storage as a broad category of standard-library modules.

Key terms: standard library, file access, data persistence, compression, special file formats

19.1.3 Accessing operating system services

This subsection identifies the kinds of operating-system services covered by Python’s standard library modules.

Key terms: operating system modules, command-line parameters, log files, threads or processes, non-Python libraries

19.1.4 Using internet protocols and formats

This subsection describes the standard library category for internet data formats and network services.

Key terms: internet protocols and formats, MIME, JSON, XML, HTTP, generic socket server

19.1.5 Development and debugging tools and runtime services

This subsection identifies the kinds of standard-library modules that support development, debugging, and interaction with Python code at runtime.

Key terms: testing tools, profilers, error tracebacks, garbage collection, importing

19.2 Moving beyond the standard library

Explains why Python users may need functionality beyond its standard library.

Key terms: batteries included, standard library

19.3 Adding more Python libraries

This section explains how to find additional Python libraries and weigh the convenience of OS-packaged installations against trust, version, and flexibility concerns.

Key terms: Python package, module, source, quality of the code, OS, installer, package manager, dependencies, prebuilt packages

19.4 The Python Package Index

This section introduces PyPI as an official, searchable place to find Python packages when the standard library does not provide the needed functionality.

Key terms: Python Package Index, PyPI, standard library, source packages

19.5 Installing Python libraries using pip and venv

This section explains why pip is useful for installing third-party libraries, outlines basic installation options, and distinguishes managing a local Python installation from using Colaboratory.

Key terms: pip, Python Package Index, dependencies, requests, –-upgrade switch, Colaboratory, temporary environment, virtual environments

19.5.1 Installing with the --user flag

This subsection explains when and why to install a Python library for one user with the --user flag.

Key terms: --user flag, user’s home directory, main system instance of Python

19.5.2 Virtual environments

This subsection explains how virtual environments isolate a project's Python and packages, and outlines how to create, activate, and use one.

Key terms: virtual environment, virtualenv, system Python, activate, pip, default Python

19.5.3 Other options

This section compares the standard pip and venv tools with other options for managing Python versions, environments, and packages.

Key terms: pip, venv, Pyenv, poetry, rye, uv, Anaconda, conda, PyPI

19.6 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 18: Packages Chapter 20: Basic file wrangling →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.