You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please describe the use case that requires this feature.
Currently, we define class traitlets like this:
class Foo(Component):
bar_type = create_class_enum_trait(Bar...).tag(config=True)
this runs at import time of Foo. Which makes it impossible to use subclasses of Bar that are only imported at a later stage.
This is problematic for subclasses defined in other submodules than the base class and the containing component.
THis was triggered by the machine learning module, where ShowerProcessor has a class enum trait of Reconstructor but because ctapipe.ml.sklearn cannot import Reconstructor without also importing ShowerProcessor (as ctapipe.reco.__init__ imports it), the ml reconstructors are not yet defined when the class enum trait is created.
This is even more problematic for the case of plugins.
Describe the solution you'd like
Move the check if a provided string is an available class to the runtime (i.e. the validate method).
The text was updated successfully, but these errors were encountered:
Please describe the use case that requires this feature.
Currently, we define class traitlets like this:
this runs at import time of Foo. Which makes it impossible to use subclasses of
Bar
that are only imported at a later stage.This is problematic for subclasses defined in other submodules than the base class and the containing component.
THis was triggered by the machine learning module, where
ShowerProcessor
has a class enum trait ofReconstructor
but becausectapipe.ml.sklearn
cannot importReconstructor
without also importingShowerProcessor
(asctapipe.reco.__init__
imports it), the ml reconstructors are not yet defined when the class enum trait is created.This is even more problematic for the case of plugins.
Describe the solution you'd like
Move the check if a provided string is an available class to the runtime (i.e. the validate method).
The text was updated successfully, but these errors were encountered: