Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEW: Add type, format, transformer info to plugin pages #435

Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions source/sphinx_extensions/plugin_directory/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,18 @@ def generate_rst(app):
transformers_list = []

for from_type, to_type in plugin.transformers:
from_type = repr(from_type).split('.')[-1].replace("'>", '')
to_type = repr(to_type).split('.')[-1].replace("'>", '')
from_type = repr(from_type) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DBC:

Please see this PEP for a simpler way to do this: https://www.python.org/dev/peps/pep-3155/

An example in QIIME 2 can be found here: https://github.com/qiime2/qiime2/blob/46541f547c92714079dbd0342e10a85b74522305/qiime2/core/util.py#L28

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, you might just want to look at using get_view_name, outright.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use get_view_name outright, we will probably need to open a tiny PR on the framework to expose that util through sdk (right now it is only in core).

.replace("<class '", "").replace("'>", "").split('.')[-1]
to_type = repr(to_type) \
.replace("<class '", "").replace("'>", "").split('.')[-1]

transformers_list.append((from_type, to_type))

transformers_list.sort(key=lambda element: (element[0], element[1]))
# .upper() because Python sorts all capitalized elements above all
# lowercase ones, and I figured we didn't want 'dict' sorting under
# 'TaxonomicClassifierDirFmt'
transformers_list.sort(
key=lambda element: (element[0].upper(), element[1].upper()))

plugin_cli_name = plugin.name.replace('_', '-')
plugin_dir = os.path.join(rst_dir, plugin_cli_name)
Expand Down