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

Remove EventSource.from_config #2258

Closed
maxnoe opened this issue Feb 14, 2023 · 3 comments · Fixed by #2384
Closed

Remove EventSource.from_config #2258

maxnoe opened this issue Feb 14, 2023 · 3 comments · Fixed by #2384
Milestone

Comments

@maxnoe
Copy link
Member

maxnoe commented Feb 14, 2023

Please describe the use case that requires this feature.

EventSource.from_config is not needed anymore (and since quite some time), since EventSource(parent=self) "just works™".

@FrancaCassol was confused about what the purpose is. Since it doesn't serve one anymore, we should remove that method.

@maxnoe maxnoe added this to the v0.19.0 milestone Feb 14, 2023
@kosack
Copy link
Contributor

kosack commented Feb 17, 2023

I didn't even realize it existed! Yes, should remove

@HealthyPear
Copy link
Member

Not sure if this is the right place, but the docs are a bit obscure about this part.

They mention that "An EventSource can also be created through the configuration system" which sounds clear, but than they mention both config and parent.

Is it possible to add more lines about this and what is the difference?

config should be a dictionary loaded with the traitlets API, but what's parent?
I looked at some of the unit tests of event source, but it's not really clear even from the code (at least for me)

@kosack
Copy link
Contributor

kosack commented Mar 14, 2023

It comes from the traitlets.config API: you can either construct a Component by

  1. passing in trait arguments explicitly SomeComponent(param1=1, param2="x")
  2. passing in a traitlets.config.Config dictionary SomeComponent(config=config)
  3. referencing a parent Configurable, that already has or will have a config loaded later SomeComponent(parent=self) where self is a Component or Tool (which both inherit from triaitlets.config.HasConfig)

The constructors are overloaded to support all three methods, but generally you should not mix them. E.g. if you specify config=x you should not specify parent=x.

maxnoe added a commit that referenced this issue Jul 17, 2023
maxnoe added a commit that referenced this issue Jul 17, 2023
@maxnoe maxnoe linked a pull request Jul 17, 2023 that will close this issue
kosack added a commit that referenced this issue Jul 18, 2023
Tobychev pushed a commit to Tobychev/ctapipe that referenced this issue Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants