---
source: https://iinventedlight.com/library/notes/python-pydoc.md
title: "Python pydoc: generate documentation and online help"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "PSF License Version 2 (Python Software Foundation); PSF License Version 2 (CPython); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, pydoc — Documentation generator and online help system; CPython, pydoc documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-24
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-24
as_of: 2026-11-24
confidence: medium
untested: "Not reproduced (2026-11-24). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-python: python-pydoc"
tags: [python, pydoc, help, docstrings, documentation]
client: Librarian
sources:
  - id: S1
    title: "pydoc — Documentation generator and online help system"
    publisher: Python Software Foundation
    url: https://docs.python.org/3/library/pydoc.html
    accessed: 2026-11-24
    license: "PSF License Version 2"
  - id: S2
    title: "pydoc documentation (source)"
    publisher: CPython
    url: https://raw.githubusercontent.com/python/cpython/main/Doc/library/pydoc.rst
    accessed: 2026-11-24
    license: "PSF License Version 2"
---
# Python pydoc: generate documentation and online help
**Answer:** The pydoc module automatically generates documentation from Python objects.

## How documentation is shown

Output can appear as console pages, in a web browser, or as saved HTML files.

For modules, classes, functions and methods, the text comes from the docstring of the object.

The built-in help function uses pydoc to generate console documentation.

You can also run pydoc as a script at the operating system command prompt.

## How it locates modules

When printing output to the console, pydoc attempts to paginate the output.

If both MANPAGER and PAGER are set, MANPAGER is used.

The synopsis line of a module is the first line of its documentation string.

Core module docs are assumed to reside under the docs.python.org library pages for this interpreter version.

## See also

- [python-inspect](https://iinventedlight.com/library/notes/python-inspect/)
- [python-doctest](https://iinventedlight.com/library/notes/python-doctest/)
- [python-webbrowser](https://iinventedlight.com/library/notes/python-webbrowser/)

## Claims

- id: C1
  claim: The pydoc module automatically generates documentation from Python objects.
  source: S1
  evidence: "pydoc module automatically generates documentation"

- id: C2
  claim: The built-in help function uses pydoc for console documentation.
  source: S1
  evidence: "invokes the online help system"

- id: C3
  claim: If both pager variables are set, MANPAGER is used.
  source: S1
  evidence: "When both are set, MANPAGER is used"

- id: C4
  claim: A module synopsis is the first line of its documentation string.
  source: S2
  evidence: "synopsis line of a module is the first line"

## Sources

- [S1] pydoc — Documentation generator and online help system. Python Software Foundation. https://docs.python.org/3/library/pydoc.html . License: PSF License Version 2. Accessed 2026-11-24.

- [S2] pydoc documentation (source). CPython. https://raw.githubusercontent.com/python/cpython/main/Doc/library/pydoc.rst . License: PSF License Version 2. Accessed 2026-11-24.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, pydoc — Documentation generator and online help system; CPython, pydoc documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
