-
Notifications
You must be signed in to change notification settings - Fork 10
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
Adding YTEP-0035 about using traitlets. #8
base: master
Are you sure you want to change the base?
Conversation
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 like this and definitely support starting with viz. Just so I'm clear, does this mean you would be able to do p.width = (1, 'pc')
instead of p.set_width(1, 'pc')
?
Co-Authored-By: Britton Smith <brittonsmith@gmail.com>
It does -- it also means that anything that is a property of the plot can be set at instantiation, and it also means in principle we could do something like: p1 = yt.SlicePlot(ds, "x", "density")
p2 = yt.SlicePlot(ds, "y", "density")
traitlets.link( (p1, "width"), (p2, "width") ) and they would be kept in sync. While this is not as important for scripting code as it is for interface code, it is still a nice thing. |
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 really like this and support using traitlets in yt this way.
I'd also like to second Britton's comment about starting out with viz-specific traits. This could be a pretty big change for the whole codebase, so doing everything in smaller pieces is going to be helpful for review and for making implementation manageable.
Should we anticipate any issues with this and say, unyt quantities?
When I've tested it in the past with what were then |
So, we're at 2 approvals -- what would you two suggest for trying to move this forward? |
For what it's worth, I sat with @samwalkow and we started working on implementing bits of this, and I've pushed to my branch The way we broke it up was to start converting a straightforward class like FRB and then build out the traitlets support as it goes. This will set it up so that the |
I appreciate that you're thinking about how to streamline code review for something like this. Your initial approach sounds good, IMO. If we have time in the next triage meeting (or in a different relevant meeting) it might be worth talking through how to plan out a big change like this. I think it'd be helpful for all of us in our future development efforts (so we can learn how to do it too). |
I just want to emphasise, since I haven't found any direct documentation stating this, that mypy and traitlets seem to be compatible since IPython uses both. |
Hey folks, I know it has been a really long time since I've done anything on this PR. I want to continue it, but for the present time I'm going to focus on a PR in tandem that looks at type annotating, which will take precedence since it is a less invasive change. |
This YTEP describes how and why we could move to using traitlets for tasks such as visualization, with a light discussion of how to implement for data objects.