Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

generate README from python docstrings

Project description


$ [sudo] pip install readme-docstring


class __doc__
readme_docstring.Classes classes table class. attrs: classes
readme_docstring.Functions functions table class. attrs: functions
readme_docstring.Table abstract table class. attrs: headers, objects


function __doc__
readme_docstring.getclasses() return a list of classes defined in __all__
readme_docstring.getdoc(obj) return first line of an object docstring
readme_docstring.getfunctions() return a list of functions defined in __all__
readme_docstring.getmembers() return all the members defined in __all__ in a list of (name, value) pairs
readme_docstring.getmodules() return a list of modules
readme_docstring.getspec(routine) return a string with Python routine specification

Executable modules

usage __doc__
python -m readme_docstring.classes generate classes table
python -m readme_docstring.functions generate functions table


example with readme-generator

class Readme(readme_generator.Readme):
    order = [..., "classes", "functions", ...]

    def classes(self):
        classes = self.getclasses()
        return readme_docstring.Classes(classes)

    def functions(self):
        functions = self.getfunctions()
        return readme_docstring.Functions(functions)

custom table

class ExecutableModules(readme_docstring.Table):
    columns = ["usage", "`__doc__`"]

    def __init__(self,modules):
        self.objects = modules

    def getleftcell(self, obj):
        default = "python -m %s" % obj.__name__.replace(".__main__", "")
        return "`%s`" % getattr(obj, "USAGE", default)


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for readme-docstring, version 2019.4.13
Filename, size File type Python version Upload date Hashes
Filename, size readme-docstring-2019.4.13.tar.gz (2.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page