Skip to main content

generate README from python docstrings

Project description

Install

[sudo] pip install readme-docstring

Classes

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

Functions

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

Examples

example with readme-generator

class Readme(readme_generator.Readme):
    def classes(self):
        return readme_docstring.Classes()

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

custom table

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

    def __init__(self):
        self.objects = list(filter(lambda m: hasattr(m, "click"), setupcfg.getmodules()))

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

Related projects

readme-generator

Project details


Download files

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

Source Distribution

readme-docstring-2019.3.9.tar.gz (2.4 kB view hashes)

Uploaded Source

Built Distribution

readme_docstring-2019.3.9-py2.py3-none-any.whl (18.3 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page