Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Data access API for rcParams#24730
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
anntzer commentedDec 14, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Thanks for the ping. The replacement seems OK, but perhaps you could just make the API |
e8ff5bb
to888811c
CompareThere 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.
Some minor comments. Looks good, but I guess other people have better insights into what is actually wanted.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
@@ -605,7 +605,7 @@ def gen_candidates(): | |||
) | |||
class RcParams(MutableMapping, dict): |
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 may not fully get the scope here, but I take it that one reason to do this is that we should not subclass fromdict
later on? Or is the whole idea to provide a stable API for this, but actually still subclass?
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.
We want to get rid of dict subclassing eventually. Using a dict subclass dictates the internal data model. We likely don't want this in the future when we're remodelling the config data structure. Either the new structure will be a 100% API compatible drop in and the config object will be available viarcParams
; or we have a new completely free to designconfig
object andrcParams
will loose all state and only be an adapter to that newconfig
object. Either way, being bound to a dict subclass would be cumbersome.
888811c
to986ea7c
CompareI guess I don't fully understand the need for this change, even after reading the comments before. Is there some reason |
Note CI didn't run for this. |
Discussed on call, consensus is that while |
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.
Sorry, I didn't grok that this was callingdict.__get_item__
, and hence didn't understand the point of this. I now understand and think it is a reasonable thing to add direct private access without hacking up an inheritance level todict
. Added a few more clarifying phrases to the note that would have helped me.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
cc2f863
toe29ab5b
CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
c6425b1
to338ee3d
CompareThere 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.
Have no objection on adding a shim/translation layer, especially if it's kept private 'til an API gets settled on - mostly just documentation nits about how this is communicating that this is a "don't touch, for contributors only" API.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
338ee3d
to11df707
CompareThis provides a defined API for accessing rcParams via`rcParams._data[key]`while circumventing any validation logic happening in`rcParams[key]`.Before, direct data access was realized through`dict.__getitem(rcParams, key)` / `dict.__setitem(rcParams, key, val)`,which depends on the implementation detail of `rcParams` being a dictsubclass. The new data access API gets rid of this dependence and thusopens up a way to later move away from dict subclassing.We want to move away from dict subclassing and only guarantee the`MutableMapping` interface for `rcParams` in the future. This allowsother future restructings like introducing a new configuration managementand changing `rcParams` into a backward-compatible adapter.Co-authored-by: Oscar Gustafsson <oscar.gustafsson@gmail.com>Co-authored-by: Jody Klymak <jklymak@gmail.com>Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>Co-authored-by: story645 <story645@gmail.com>
11df707
toecf156c
Compare
Uh oh!
There was an error while loading.Please reload this page.
PR Summary
Replaces (first step of)#12577, see in particular#12577 (comment).
This provides a defined API for accessing rcParams via
rcParams._data[key]
while circumventing any validation logic happening inrcParams[key]
.Before, direct data access was realized through
dict.__getitem__(rcParams, key)
/dict.__setitem__(rcParams, key, val)
, which depends on the implementation detail ofrcParams
being a dict subclass. The new data access API gets rid of this dependency and thus opens up a way to later move away from dict subclassing.We want to move away from dict subclassing and only guarantee the
MutableMapping
interface forrcParams
in the future. This allows other future restructings like introducing a new configuration management and changingrcParams
into a backward-compatible adapter.Ping@anntzer who will be affected by this change in mplcairo#12577 (comment)