The Python Standard Library: Built-In Modules Worth Knowing
The standard library modules you'll actually reach for regularly — no pip install required, already in every Python installation
Common Python Packages covers the third-party libraries worth installing. This is the opposite list: what already ships with Python, no pip install required, and quietly does more of your day-to-day work than people expect.
Working with data structures
collections extends the built-in dict, list, and tuple with purpose-built variants — Counter for tallying items, defaultdict for dictionaries with automatic default values, namedtuple for lightweight structured records before you’d reach for a full class or a Pydantic model.
itertools provides efficient, memory-friendly ways to combine and iterate over sequences — chaining iterables together, generating permutations and combinations, or grouping consecutive items — without building intermediate lists in memory.
Working with files and paths
pathlib replaced the older os.path string-manipulation approach with an object-oriented API for filesystem paths — Path("data") / "file.csv" instead of os.path.join("data", "file.csv"), plus built-in methods for checking existence, reading text, and globbing. Modern Python code should default to pathlib over os.path.
json and csv handle the two most common data interchange formats without any external dependency — reading and writing JSON, or reading and writing CSV files with proper quoting and delimiter handling.
Working with dates, logging, and configuration
datetime handles dates and times, including timezone-aware objects — genuinely fiddly to get right by hand, and rarely worth a third-party dependency for basic use. logging provides structured, leveled logging (debug/info/warning/error) built in, a meaningful step up from scattering print() statements through a codebase. argparse builds command-line interfaces with help text and argument validation — Click is nicer for larger CLIs, but argparse alone covers most simple scripts without any dependency at all.
Testing without a dependency
unittest is the standard library’s built-in testing framework — class-based, assertEqual-style assertions. Most teams today prefer pytest for its plain-assert syntax and fixture system, but unittest requires zero installation and is worth knowing since some codebases and tutorials still use it. See pytest vs unittest for the fuller comparison.
Why this matters
Every module here is already installed the moment Python is — no dependency to add, no version to pin, no supply-chain surface to worry about. Reaching for the standard library first, before adding a third-party package for something it already does reasonably well, keeps a project’s dependency tree smaller and its long-term maintenance simpler.