Serdar Yegulalp
Senior Writer

PyPI parser eases path to browsing Python package APIs

news analysis
Nov 25, 20163 mins

A new project from Read the Docs aims to automatically generate API documentation from code uploaded to the Python Package Index

Read the Docs, a popular community-supported service for creating easy-to-navigate online documentation for software projects, has unveiled Pydoc, a new service that automatically generates API reference documentation for packages uploaded to the Python Package Index (PyPI).

“There are a specific set of use cases that API reference documentation support,” write the project’s maintainers in their introductory post to the service, “and the Python community doesn’t support them well.” Languages like Go and Ruby already have similar API documentation sites, and now Python users can enjoy the same.

Do you read me?

Pydoc takes packages hosted in PyPI and parses their source code with the Sphinx documentation generation engine. If the source code has inline documentation formatted according to Python’s docstring convention, it generates a browsable, tree-formatted index of all the APIs in the package. APIs with no documentation have their function signature listed with no comments.

Read the Docs has typically focused on high-level user documentation for a project, although it has also included API documentation whenever it’s provided. But Read the Docs generates material at the behest of the project owners and not automatically from the project’s source.

Pydoc’s approach differs in two aspects. One, it’s built automatically from PyPI packages; anything hosted on PyPI with proper docstrings will have its documentation assembled without need for user intervention. Two, it provides a place for seasoned programmers to look up information about a package’s API without having to paw through the source code. The source code is still available in its own repository — or by simply obtaining the PyPI package and uncrating it — but with Pydoc, it’s easier to read it without distractions.

Rough and tumble

Not everything works yet. “This is a very beta release,” state the developers in their introductory post. How the service integrates with PyPI or handles edge cases like private methods in functions are all still works-in-progress.

What’s more, the current techniques used for generating docs don’t scale well. The code has to be imported into a running instance of the Python interpreter to be parsed and traversed.

For smaller libraries, such as the pytz time zone library, this approach isn’t so bad. But for anything more sprawling and complex, such as NumPy where a lot of the functionality is in C libraries, it’s impractical. To that end, Pydoc’s developers are looking at building custom parsers as a long-term solution, but there’s no timetable for when that’ll be available.

Serdar Yegulalp

Serdar Yegulalp is a senior writer at InfoWorld. A veteran technology journalist, Serdar has been writing about computers, operating systems, databases, programming, and other information technology topics for 30 years. Before joining InfoWorld in 2013, Serdar wrote for Windows Magazine, InformationWeek, Byte, and a slew of other publications. At InfoWorld, Serdar has covered software development, devops, containerization, machine learning, and artificial intelligence, winning several B2B journalism awards including a 2024 Neal Award and a 2025 Azbee Award for best instructional content and best how-to article, respectively. He currently focuses on software development tools and technologies and major programming languages including Python, Rust, Go, Zig, and Wasm. Tune into his weekly Dev with Serdar videos for programming tips and techniques and close looks at programming libraries and tools.

More from this author