Skip to main content

Utilities to inherit method documentation from parent classes.

Project description

==================
python-doc-inherit
==================
Utilities to inherit method documentation from parent classes.

Badges
------

.. image:: https://img.shields.io/travis/kavdev/python-doc-inherit/master.svg?style=flat-square
:target: https://travis-ci.org/kavdev/python-doc-inherit
.. image:: https://img.shields.io/codecov/c/github/kavdev/python-doc-inherit/master.svg?style=flat-square
:target: http://codecov.io/github/kavdev/python-doc-inherit?branch=master
.. image:: https://img.shields.io/requires/github/kavdev/python-doc-inherit.svg?style=flat-square
:target: https://requires.io/github/kavdev/python-doc-inherit/requirements/?branch=master
.. image:: https://img.shields.io/codacy/75dbe2685efe47c3aa203a53154c9e7e.svg?style=flat-square
:target: https://www.codacy.com/app/kavanaugh-development/python-doc-inherit/dashboard

.. image:: https://img.shields.io/pypi/v/python-doc-inherit.svg?style=flat-square
:target: https://pypi-hypernode.com/pypi/python-doc-inherit
.. image:: https://img.shields.io/pypi/dw/python-doc-inherit.svg?style=flat-square
:target: https://pypi-hypernode.com/pypi/python-doc-inherit

.. image:: https://img.shields.io/github/issues/kavdev/python-doc-inherit.svg?style=flat-square
:target: https://github.com/kavdev/python-doc-inherit/issues
.. image:: https://img.shields.io/github/license/kavdev/python-doc-inherit.svg?style=flat-square
:target: https://github.com/kavdev/python-doc-inherit/blob/master/LICENSE

Installation
------------

Install python-doc-inherit:

.. code-block:: bash

pip install python-doc-inherit

Usage
-----

Simple decorator (will cause other decorators to fail)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: python

from doc_inherit import method_doc_inherit

class Foo(object):

def foo(self):
"""Frobber"""

pass

class Bar(Foo):

@method_doc_inherit
def foo(self):
pass

Now, ``Bar.foo.__doc__ == Bar().foo.__doc__ == Foo.foo.__doc__ == "Frobber"``


Metaclass
~~~~~~~~~

.. code-block:: python

from doc_inherit.metaclasses import DocStringInheritor
from six import add_metaclass # Note: Six is not included in this distribution.

class Animal:
def move_to(self, dest):
"""Move to *dest*"""
pass

@add_metaclass(DocStringInheritor)
class Bird(Animal):
def move_to(self, dest):
pass

Now, ``Animal.move_to.__doc__ == Bird.move_to.__doc__ == "Move to *dest*"``


Running the Tests
------------------

.. code-block:: bash

pip install -r requirements/test.txt
./runtests.py





Changes
=======

0.1.1 (2016-06-18)
----------------------

* small fixes

0.1.0 (2016-06-18)
----------------------

* Initial release

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

python-doc-inherit-0.2.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

python_doc_inherit-0.2.0-py2.py3-none-any.whl (5.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file python-doc-inherit-0.2.0.tar.gz.

File metadata

File hashes

Hashes for python-doc-inherit-0.2.0.tar.gz
Algorithm Hash digest
SHA256 609f0547e26b33827d5dab598afd7991ca8cd241bdd545854a36b75a47ae8c30
MD5 79d119c2233487a644cce5613ebb77ab
BLAKE2b-256 5f49c4b64e9381ede7df5800f62e1932e3b4e16baccc5777e8a177d16ef76dba

See more details on using hashes here.

File details

Details for the file python_doc_inherit-0.2.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for python_doc_inherit-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 098660cc188b16cfeb9ce83cb17b3366b646298fd4f8f5f84ba66c2ce3c884a3
MD5 1a8da343bdcd835f85990f53dcc98fdb
BLAKE2b-256 370e62327265f2ab5d898e1a396b10df04fccf64a706a903022db328387144ef

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