Heading image

Getting started

Let’s create the hello-pydoc directory and set up the required files.

Exploring PyDoc from the command line

PyDoc is a tool that allows us to explore the documentation of a module.

Writing our own documented code

We can write and search for our own docstrings.

Exploring our documented code

We can run python -m pydoc src.math and we should see the output of the docstring:

Viewing PyDoc in the browser

If we run pydoc -h, we see the following:

Outputting PyDoc as HTML

Finally, we can output the documentation as HTML by passing the -w option to pydoc.

Summary

Today’s post demonstrated how to use the pydoc package to explore built-in and custom documentation.

Resources and further reading

  1. pydoc
  2. GitHub repo

--

--

--

Senior Engineer @ UsabilityHub. Formerly Culture Amp.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Install and Setup Docker Using Ansible on Ubuntu 18.04 (Part 2)

Start adding your smart devices

How to host your Static Website on Amazon AWS

The Laurel Project

Keycloak Authentication

Fixing ‘unauthenticated error’ while using Laravel Sanctum for SPA.

How To Stay Motivated To Lose Weight The Psychology of Weight Loss Success

How to Uninstall Obsolete Drivers in Windows 10

Remove Delete Old Drivers Windows Gpu Audio

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Dennis O'Keeffe

Dennis O'Keeffe

Senior Engineer @ UsabilityHub. Formerly Culture Amp.

More from Medium

Tired of waiting? Upload your pull request on TestPyPI in the meantime

What is Numpy and why we use it instead of python’s Built-in Lists?

NHL API: what data is exposed and how to analyse it with Python

What are the Most used programming languages and databases in Brazil?