Skip to content

pydoc_markdown.contrib.loaders.python

Class PythonLoader

@dataclasses.dataclass
class PythonLoader(Loader)

[view_source]

This implementation of the Loader interface parses Python modules and packages using docspec_python. See the options below to control which modules and packages are being loaded and how to configure the parser.

With no modules or packages set, the PythonLoader will discover available modules in the current and src/ directory.

lib2to3 Quirks

Pydoc-Markdown doesn't execute your Python code but instead relies on the lib2to3 parser. This means it also inherits any quirks of lib2to3.

List of known quirks

  • A function argument in Python 3 cannot be called print even though it is legal syntax

packages

A list of package names that this loader will search for and then parse, including all sub-packages and modules.

search_path

The module search path. If not specified, the current sys.path is used instead. If any of the elements contain a * (star) symbol, it will be expanded with sys.path.

ignore_when_discovered

List of modules to ignore when using module discovery on the search_path.

parser

Options for the Python parser.

encoding

The encoding to use when reading the Python source files.

Changed in 4.7.0: Default changed from None (system default encoding) to "utf-8".