-
Notifications
You must be signed in to change notification settings - Fork 587
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
Cleanup builtin plugins interface #5333
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2905,7 +2905,7 @@ def execute(parser, args): | |
|
||
|
||
class OperatorsListCommand(Command): | ||
"""List operators and panels that you've installed locally. | ||
"""List operators and panels that are installed locally. | ||
|
||
Examples:: | ||
|
||
|
@@ -2918,7 +2918,10 @@ class OperatorsListCommand(Command): | |
# List disabled operators and panels | ||
fiftyone operators list --disabled | ||
|
||
# Only list panels | ||
# List non-builtin operators and panels | ||
fiftyone operators list --no-builtins | ||
|
||
# List panels | ||
fiftyone operators list --panels-only | ||
""" | ||
|
||
|
@@ -2938,12 +2941,26 @@ def setup(parser): | |
default=None, | ||
help="only show disabled operators and panels", | ||
) | ||
parser.add_argument( | ||
"-b", | ||
"--builtins-only", | ||
action="store_true", | ||
default=None, | ||
help="only show builtin operators and panels", | ||
) | ||
parser.add_argument( | ||
"-c", | ||
"--no-builtins", | ||
action="store_true", | ||
default=None, | ||
help="only show non-builtin operators and panels", | ||
) | ||
parser.add_argument( | ||
"-o", | ||
"--operators-only", | ||
action="store_true", | ||
default=None, | ||
help="only show operators", | ||
help="only show non-panel operators", | ||
) | ||
parser.add_argument( | ||
"-p", | ||
|
@@ -2968,18 +2985,25 @@ def execute(parser, args): | |
else: | ||
enabled = "all" | ||
|
||
if args.builtins_only: | ||
builtin = True | ||
elif args.no_builtins: | ||
builtin = False | ||
else: | ||
builtin = "all" | ||
|
||
if args.operators_only: | ||
type = "operator" | ||
elif args.panels_only: | ||
type = "panel" | ||
else: | ||
type = None | ||
|
||
_print_operators_list(enabled, type, args.names_only) | ||
_print_operators_list(enabled, builtin, type, args.names_only) | ||
|
||
|
||
def _print_operators_list(enabled, type, names_only): | ||
operators = foo.list_operators(enabled=enabled, type=type) | ||
def _print_operators_list(enabled, builtin, type, names_only): | ||
operators = foo.list_operators(enabled=enabled, builtin=builtin, type=type) | ||
|
||
if names_only: | ||
operators_map = defaultdict(list) | ||
|
@@ -3016,7 +3040,7 @@ def _print_operators_list(enabled, type, names_only): | |
|
||
|
||
class OperatorsInfoCommand(Command): | ||
"""Prints info about operators and panels that you've installed locally. | ||
"""Prints info about operators and panels that are installed locally. | ||
|
||
Examples:: | ||
|
||
|
@@ -3498,7 +3522,7 @@ def execute(parser, args): | |
|
||
|
||
class PluginsListCommand(Command): | ||
"""List plugins that you've installed locally. | ||
"""List plugins that are installed locally. | ||
|
||
Examples:: | ||
|
||
|
@@ -3510,6 +3534,9 @@ class PluginsListCommand(Command): | |
|
||
# List disabled plugins | ||
fiftyone plugins list --disabled | ||
|
||
# List non-builtin plugins | ||
fiftyone plugins list --no-builtins | ||
""" | ||
|
||
@staticmethod | ||
|
@@ -3528,6 +3555,20 @@ def setup(parser): | |
default=None, | ||
help="only show disabled plugins", | ||
) | ||
parser.add_argument( | ||
"-b", | ||
"--builtins-only", | ||
action="store_true", | ||
default=None, | ||
help="only show builtin plugins", | ||
) | ||
parser.add_argument( | ||
"-c", | ||
"--no-builtins", | ||
action="store_true", | ||
default=None, | ||
help="only show non-builtin plugins", | ||
) | ||
parser.add_argument( | ||
"-n", | ||
"--names-only", | ||
|
@@ -3544,11 +3585,18 @@ def execute(parser, args): | |
else: | ||
enabled = "all" | ||
|
||
_print_plugins_list(enabled, args.names_only) | ||
if args.builtins_only: | ||
builtin = True | ||
elif args.no_builtins: | ||
builtin = False | ||
else: | ||
builtin = "all" | ||
|
||
_print_plugins_list(enabled, builtin, args.names_only) | ||
|
||
|
||
def _print_plugins_list(enabled, names_only): | ||
plugin_defintions = fop.list_plugins(enabled=enabled) | ||
def _print_plugins_list(enabled, builtin, names_only): | ||
plugin_defintions = fop.list_plugins(enabled=enabled, builtin=builtin) | ||
|
||
if names_only: | ||
for pd in plugin_defintions: | ||
|
@@ -3558,14 +3606,15 @@ def _print_plugins_list(enabled, names_only): | |
|
||
enabled_plugins = set(fop.list_enabled_plugins()) | ||
|
||
headers = ["plugin", "version", "enabled", "directory"] | ||
headers = ["plugin", "version", "enabled", "builtin", "directory"] | ||
rows = [] | ||
for pd in plugin_defintions: | ||
rows.append( | ||
{ | ||
"plugin": pd.name, | ||
"version": pd.version or "", | ||
"enabled": pd.name in enabled_plugins, | ||
"enabled": pd.builtin or pd.name in enabled_plugins, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch 👍 |
||
"builtin": pd.builtin, | ||
"directory": pd.directory, | ||
} | ||
) | ||
|
@@ -3577,7 +3626,7 @@ def _print_plugins_list(enabled, names_only): | |
|
||
|
||
class PluginsInfoCommand(Command): | ||
"""Prints info about plugins that you've installed locally. | ||
"""Prints info about plugins that are installed locally. | ||
|
||
Examples:: | ||
|
||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see...
Hmm we haven't really figured out how to document operators/panels in a way that they provide utility in our docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it makes sense to add this as "API Reference" for plugins. I think the existing
fiftyone.operators.operations
is what I would expect in a section like that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also is there any way to adjust the header/breadcrumb - it confusingly says "Docs / Plugins Overview / plugins"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that it's not very usable in its current form. The only reason I added this is that #5261 broke a few links in the plugins docs and release notes that used to link to (equally unhelpful) resources about the available builtin operators in the
fiftyone
API reference tree.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One possible solution is to add class docstrings to all operators/panels that describe how to use them, like I did for
ViewExpression
here:https://docs.voxel51.com/api/fiftyone.core.expressions.html?highlight=viewexpression#fiftyone.core.expressions.ViewExpression
That would be a bit awkward though for this use case.
It's not that useful to have the panels in the API reference, as they aren't meant to be used programmatically and really should already have dedicated documentation sections for them.
There is some value in having a list of all the builtin operators, in the sense that they are totally undocumented to-date. It would be reasonable for some of them to have programmatic execution examples, but generally they are really intended to be invoked via the App's Operator browser. But a docstring is an awkward place to document in-App usage. What we really need is some kind of operator documentation page that shows GIFs of every single operator in use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure - I've always thought that we could allow for self-documentation, since operators define their own input/output.
We should change the "API reference". Based on what you said above I think the only value of this is the listing of what is in
/plugins
. In that case we should call it "Built-in plugins" or something similar.