-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Requirements for a new configuration management class #24585
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
Comments
If you are doing some redesign, can I suggest some thought into different types of rcParams and differentiating when they can be set? We use rcParams as both defaults for various style things, but also for configuration of pretty crucial things like the backend, or things like a default layout manager or unit converters. Having some way to differentiate those roles (or locking them out), and clarifying when things can be set (before startup, before figure creation, before artist creation, before the next draw) would be really helpful. I personally use style sheets, but otherwise avoid setting anything in my matplotlibrc except the default backend because I don't find it is very portable. |
#12577 is only loosely related. The new config class will be much more different than what is proposed in #12577. However, we need #12577 to enable reasonable compatibility
can be realized either by making the new config class API compatible with rcParams. Alternatively, we can have a new BTW, the new object should be available as |
I have some older thoughts on the "new configuration class" topic at https://gist.github.com/timhoffm/0a4d3d2b01115d77f930ceaadc4523ac. May need some consolidation, but should be helpful for some additional ideas. |
What if the config class has two containers (dicts?) - one for the default that is set (a la |
https://docs.python.org/3/library/collections.html Stdlib ChainMap is almost exactly that idea |
Starting to think about what it would like to replace rcParams. It has served us well, but reflect what you could do with Python ~20 years ago (looks like it started as just a plain dictionary and picked up validation in 2007). Given the changes to Python, our experiences working with the current rcparams, and an eye towards near-term explosion of the number of things we may want to parameterize after the NASA work, I think it is worth having a discussion about what a green-field implementation of a global configuration signleton class would look like.
This line of thinking is triggered by a question via private communications about how to use a style file that only applies to rcParams that have not already been updated. In principle, you could do this by looking at rcParamsDefault (or some other baseline), but you would still have
no way of telling if a value was intentionally set to a value that just happened to be the default value or not.
I would propose the following set of requirements:
to really deprecate
setdefault
style filtering (please set this key only if it has never been updated)Other things we should consider:
__getattr__
rather than__getitem__
I want to keep this discussion independent of how we fabricate the singleton configuration.
[edited]
The text was updated successfully, but these errors were encountered: