The standard library is the set of modules that ship with Python. It is documented
apart from the language, in the
Python Standard Library reference. This
page lists its groups briefly, in the order of that reference. Packages from outside the
standard library are installed from PyPI with
pip, as .whl files or source
archives.
Built-ins
The built-in functions and types need no import, and live in the
builtins module. Python 3.15 has 73 entries in the table of built-in
functions, among them print, len, range,
open, isinstance, sorted and zip.
The types are on the Types page.
Module groups
| Group | Modules |
|---|---|
| Text processing | string, string.templatelib, re, difflib, textwrap, unicodedata, stringprep, readline, rlcompleter |
| Binary data | struct, codecs |
| Data types | datetime, zoneinfo, calendar, collections, collections.abc, heapq, bisect, array, weakref, types, copy, pprint, reprlib, enum, graphlib |
| Numeric and mathematical | numbers, math, math.integer, cmath, decimal, fractions, random, statistics |
| Functional programming | itertools, functools, operator |
| Files and directories | pathlib, os.path, stat, filecmp, tempfile, glob, fnmatch, linecache, shutil |
| Data persistence | pickle, copyreg, shelve, marshal, dbm, sqlite3 |
| Compression and archives | compression.zstd, zlib, gzip, bz2, lzma, zipfile, tarfile |
| File formats | csv, configparser, tomllib, netrc, plistlib |
| Cryptography | hashlib, hmac, secrets |
| Operating system | os, io, time, logging, platform, errno, ctypes |
| Command-line interfaces | argparse, optparse, getpass, fileinput, curses, cmd |
| Concurrency | threading, multiprocessing, concurrent.futures, concurrent.interpreters, subprocess, sched, queue, contextvars, _thread |
| Networking and communication | asyncio, socket, ssl, select, selectors, signal, mmap |
| Internet data | email, json, mailbox, mimetypes, base64, binascii, quopri |
| Markup | html, html.parser, xml.etree.ElementTree, xml.dom, xml.dom.minidom, xml.sax, xml.parsers.expat |
| Internet protocols | webbrowser, wsgiref, urllib, http, ftplib, poplib, imaplib, smtplib, uuid, socketserver, xmlrpc, ipaddress |
| Multimedia | wave, colorsys |
| Internationalisation | gettext, locale |
| Graphical interfaces | tkinter, turtle, IDLE |
| Development tools | typing, pydoc, doctest, unittest, test |
| Debugging and profiling | bdb, faulthandler, pdb, profiling, pstats, timeit, trace, tracemalloc |
| Packaging | ensurepip, venv, zipapp |
| Runtime services | sys, sys.monitoring, sysconfig, builtins, __main__, warnings, dataclasses, contextlib, abc, atexit, traceback, __future__, gc, inspect, annotationlib, site |
| Custom interpreters | code, codeop |
| Importing | zipimport, pkgutil, modulefinder, runpy, importlib |
| Language services | ast, symtable, token, keyword, tokenize, tabnanny, pyclbr, py_compile, compileall, dis, pickletools |
| Windows | msvcrt, winreg, winsound |
| Unix | shlex, posix, pwd, grp, termios, tty, pty, fcntl, resource, syslog |
| Superseded | getopt, profile |
The profile module is deprecated and due for removal in Python 3.17.
Modules that read Python source
| Module | What it does |
|---|---|
tokenize | Splits source into tokens |
ast | Parses source into a syntax tree |
symtable | Reports each name's scope |
dis | Disassembles bytecode |
py_compile, compileall | Compile to .pyc files |
inspect | Examines live objects |
Removed modules
Modules leave the standard library after a period of deprecation. See Versions for which release did what. Python 3.13 removed 19 old modules together (PEP 594):
aifc, audioop, cgi, cgitb,
chunk, crypt, imghdr, mailcap,
msilib, nis, nntplib, ossaudiodev,
pipes, sndhdr, spwd, sunau,
telnetlib, uu and xdrlib.