-
Notifications
You must be signed in to change notification settings - Fork 279
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
RFC: decouple yt.config from initialization #3626
Conversation
9bab4c3
to
cfc81eb
Compare
901d75b
to
7eb8f8e
Compare
After I managed postponing configuration to the end of yt.init, I was able to fix #3045 trivially |
bab71ba
to
12631a3
Compare
12631a3
to
9c5ee52
Compare
9c5ee52
to
64675fe
Compare
pre-commit.ci autofix |
ff9401c
to
88f9464
Compare
This seems like a good refactor; your third bullet point is intriguing to me though and I'd like to hear if you have anything in mind. If you fix the conflicts I think it's good to go. |
I'm not promoting this callback system as a feature-enabling change, it's mostly there to allow fixing the issues I was looking into without breaking backwards compatibility.
solved ! |
e65a0a9
to
0146479
Compare
Forced pushed. Marking as draft until CI passes. |
0146479
to
2f6dcc8
Compare
@neutrinoceros Do you think it is worthwhile to explore a wrapper function (for our wrapper function!) that manages the imports appropriately? Something like how we do on-demand imports, or something like that. I am slightly anxious about the increased verbosity of adding |
I don't have a clear idea how to do that, and I'm convinced that I can come up with a different solution that will not add technical debt :/ |
Actually here's an idea to avoid having to nest imports: |
2f6dcc8
to
8fb0228
Compare
@neutrinoceros I think that would be great! |
Ok for today I'll just resolve conflicts and switch this back to draft. I'll get back to this. |
8fb0228
to
62e1252
Compare
3dee445
to
8e24414
Compare
8e24414
to
4d6212b
Compare
@neutrinoceros Should we re-up this? |
…was initialized Add a callback system for post-initialization configuration that can be utilize to spread bits of the configuration throughout the code base but still run them only in a final stage when importing yt. Avoid automatically creating a yt configuration file when none is present
4d6212b
to
4b036c8
Compare
@matthewturk conflict solved |
@matthewturk did you mean to approve this ? |
PR Summary
This patch postpones the "live" part of the configuration to the very end of
yt.__init__
and disentangle the configuration code a bit. This is achieved byyt.config.ytcfg
object. This is in line with the existing practice in theyt.funcs
moduleYTConfig
classyt.utilities.configure
, allowing any module to perform configuration at runtime, but delaying it untilyt.config
is imported from for the first time (inyt.__init__
)The first commit fixes #3625 while the second fixes #3045
It also has obvious conflicts with #3106, but I think it'd be easier to merge the present PR first.