Skip to content

Commit

Permalink
ENH: add Plugin.short_description and Plugin.description API (#222)
Browse files Browse the repository at this point in the history
Added `description` and `short_description` parameters to `qime.plugin.Plugin` constructor.

Fixes #81.
  • Loading branch information
maxvonhippel authored and jairideout committed Feb 18, 2017
1 parent 7f831b2 commit 7f939b0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -2,4 +2,4 @@

[![Build Status](https://travis-ci.org/qiime2/qiime2.svg?branch=master)](https://travis-ci.org/qiime2/qiime2)

Source code repository for the QIIME 2 framework. Visit https://qiime2.org to learn more about the QIIME 2 project.
Source code repository for the QIIME 2 framework. Visit [https://qiime2.org](https://qiime2.org) to learn more about the QIIME 2 project.
2 changes: 2 additions & 0 deletions qiime2/core/testing/plugin.py
Expand Up @@ -27,6 +27,8 @@

dummy_plugin = qiime2.plugin.Plugin(
name='dummy-plugin',
description='Description of dummy plugin.',
short_description='Dummy plugin for testing.',
version='0.0.0-dev',
website='https://github.com/qiime2/qiime2',
package='qiime2.core.testing',
Expand Down
15 changes: 13 additions & 2 deletions qiime2/plugin/plugin.py
Expand Up @@ -36,8 +36,9 @@ def yaml_representer(dumper, data):
]
return dumper.represent_dict(items)

def __init__(self, name, version, website, package, citation_text=None,
user_support_text=None):
def __init__(self, name, version, website, package,
citation_text=None, user_support_text=None,
short_description=None, description=None):
self.name = name
self.version = version
self.website = website
Expand All @@ -53,6 +54,16 @@ def __init__(self, name, version, website, package, citation_text=None,
% self.website)
else:
self.user_support_text = user_support_text
if short_description is None:
self.short_description = ''
else:
self.short_description = short_description
if description is None:
self.description = ('No description available. '
'See plugin website: %s'
% self.website)
else:
self.description = description

self.methods = PluginMethods(self)
self.visualizers = PluginVisualizers(self)
Expand Down
8 changes: 8 additions & 0 deletions qiime2/plugin/tests/test_plugin.py
Expand Up @@ -39,6 +39,14 @@ def test_user_support_text(self):
self.assertEqual(self.plugin.user_support_text,
'For help, see https://qiime2.org')

def test_short_description_text(self):
self.assertEqual(self.plugin.short_description,
'Dummy plugin for testing.')

def test_description_text(self):
self.assertEqual(self.plugin.description,
'Description of dummy plugin.')

def test_citation_text_default(self):
plugin = qiime2.plugin.Plugin(
name='local-dummy-plugin',
Expand Down

0 comments on commit 7f939b0

Please sign in to comment.