Skip to main content

generate README from python docstrings

Project description

Installation

$ [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

Executable modules

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

Examples

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)

python-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.4.2.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

readme_docstring-2019.4.2-py2.py3-none-any.whl (4.0 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: readme-docstring-2019.4.2.tar.gz
  • Upload date:
  • Size: 2.6 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.4.2.tar.gz
Algorithm Hash digest
SHA256 c3b6e31840a164b853f6156058eb21dd3be07b094bb057964b9a29f19b858337
MD5 609833f81162a88c5a470781706fd7ca
BLAKE2b-256 10c20797c0625de0538750808a990365a957863f0f00b76ff934de1cd8f84f89

See more details on using hashes here.

File details

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

File metadata

  • Download URL: readme_docstring-2019.4.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.0 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.4.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 160f66727685113e4c80b5937f8fc125ce926dbbd612818f34db197e0ddd479d
MD5 d3f75ba098987627545b01ddbdbedabf
BLAKE2b-256 edd991495e1f6161b7c21487d3f5469faa89e72c6fc6287dad4ed99866374649

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