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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

File details

Details for the file readme-docstring-2019.3.9.tar.gz.

File metadata

  • Download URL: readme-docstring-2019.3.9.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2

File hashes

Hashes for readme-docstring-2019.3.9.tar.gz
Algorithm Hash digest
SHA256 57078aed5075efc82a9029460588ac2782249fe2c923c99e34443126ef64eaf7
MD5 fedbf53396dfec1fdcda865fa61df128
BLAKE2b-256 b7fa80390e04d074a19d203e377e4a2e1e0d6155ca98efbbb5443753d6d9c952

See more details on using hashes here.

File details

Details for the file readme_docstring-2019.3.9-py2.py3-none-any.whl.

File metadata

  • Download URL: readme_docstring-2019.3.9-py2.py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.2

File hashes

Hashes for readme_docstring-2019.3.9-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0caa2548d4d4b44f709c2533e0971b5df68a6d8e150ad6ae028f1af70f020fdf
MD5 34d8a9a3194964b2be0dda1bcb10f87a
BLAKE2b-256 e545d17bc1880abc92ec0cef23562d3c2c65d62c7fd19aa5777fd1fc562dc48f

See more details on using hashes here.

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