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

Only detect plugins when they need to exist in global #1036

Merged
merged 1 commit into from
Apr 3, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions ctapipe/core/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from inspect import isabstract
from traitlets.config import Configurable
from traitlets import TraitError
from ctapipe.core.plugins import detect_and_import_io_plugins


def non_abstract_children(base):
Expand Down Expand Up @@ -140,6 +141,7 @@ def from_name(cls, name, config=None, parent=None):
instace
Instance of subclass to this class
"""
detect_and_import_io_plugins()
subclasses = {
base.__name__: base
for base in non_abstract_children(cls)
Expand Down
4 changes: 0 additions & 4 deletions ctapipe/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
# import event sources to make them visible to EventSource.from_url
from .simteleventsource import SimTelEventSource

from ctapipe.core.plugins import detect_and_import_io_plugins

detect_and_import_io_plugins()

__all__ = [
'get_array_layout',
'HDF5TableWriter',
Expand Down
2 changes: 2 additions & 0 deletions ctapipe/io/eventsource.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from ctapipe.core import Component, non_abstract_children
from ctapipe.core import Provenance
from traitlets.config.loader import LazyConfigValue
from ctapipe.core.plugins import detect_and_import_io_plugins

__all__ = [
'EventSource',
Expand Down Expand Up @@ -240,6 +241,7 @@ def from_url(cls, input_url, **kwargs):
instance
Instance of a compatible EventSource subclass
"""
detect_and_import_io_plugins()
available_classes = non_abstract_children(cls)

for subcls in available_classes:
Expand Down