Trait-Documenter

https://travis-ci.org/enthought/trait-documenter.svg?branch=master http://codecov.io/github/enthought/trait-documenter/coverage.svg?branch=master https://readthedocs.org/projects/trait-documenter/badge/?version=latest

Trait-Documenter is an autodoc extension to allow trait definitions to be properly rendered in sphinx.

Installation

Development versions can be found at https://github.com/enthought/trait-documenter.

The package requires a recent version of sphinx, traits and astor to function properly.

Usage

Add the trait-documenter to the extensions variable in your conf.py:

extensions.append('trait_documenter')

Warning

Using the TraitDocumenter in conjunction with the TraitsDoc package is not advised.

Example

A class trait with a docstring:

from traits.api import HasTraits, Float

class MyClass(HasTraits):

    #: A float number.
    number = Float(2.0)

Will be rendered as:

.. py:attribute:: number
   :annotation: = Float(2.0)

   A float number.

Change Log

Release 1.1.0

  • Support Python 3.5 (needs astor > 0.5)
  • Correct issues with test on python 2.6

Release 1.0.2

  • Correct github link in Readme.rst
  • Fix error in setup.py that prevented installation

Release 1.0.1

  • Clean rst in Readme file.

Release 1.0.0

  • Separate documenters for module level and class level traits.
  • Add travis-ci testing.
  • Add basic tests.
  • Use the python ast module to recover the trait definitions.
  • Factor out trait-documenter from the traits source.

License

This software is OSI Certified Open Source Software. OSI Certified is a certification mark of the Open Source Initiative.

Copyright (c) 2014, Enthought, Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of Enthought, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.