Repository navigation
Conversation
271de55 to
9409506
Compare
9409506 to
16b40f1
Compare
e6dad3d to
e9a85a1
Compare
We use an internal helper class method RcParams._set_backend() to make it easy to set backends in contexts where we do and do not have an rcParams instance at hand.
e9a85a1 to
01976cc
Compare
I'm not clear why this new private function is on |
Yes, as an intermediate solution, the backend state is held in the class variable
No. See step (4) in the issue. |
|
Can we decide and move to the permanent location first so people can start using it, and put a temporary shim in rcParams? |
|
What exactly do you mean by“the permanent location, that people should use”? There are a couple of aspects to it:
|
|
OK I see, so the public API that we want people to use is already there, so we are just discussing where that info should live. It still seems strange to create a new local private function on rcParams for this, particularly if there is a public API. But no doubt I am not following. |
|
I eat the elephant one bite at a time. This one is replacing all internal Note e.g. that if auto_select:
return rcParams['backend']
else:
backend = rcParams._get('backend')
if backend is rcsetup._auto_backend_sentinel:
return None
else:
return backendis now much more concisely written as if auto_select:
return rcParams._get_backend_resolved()
else:
return rcParams._get_backend_or_none()How that relates to the existing public API is a later bite - could be that we can just use the public API and throw away the internal API, or we could want to change the existing public API ( |
PR summary
Working towards #31791.
This removes most internal usages of the 'backend' key (some usage in tests is still in place because I have to decide there whether we still want to test the key API).
It's conceptually a schematic replacement
rcParams._get('backend')->rcParams._backend- obtain raw backend valuex = rcParams['backend']->x = rcParams._get_backend_resolved()- obtain resoved backendrcParams['backend'] = x->rcParams._set_backend(x)- store the value. Note that this write has no specific logic attatched. It's only be used to store the new backend value. We nevertheless use the class method becuase in some existing contexts we have anrcParamsinstance, in some we only have theRcParamsclass. The method can be called on both.Note: There have been some places writing
rcParamsDefault['backend']andrcParamsOrig['backend']. These were needed to synchronize and persist backend information even after resetting rcParams. That's not needed anymore and thus removed now that the backend information only exists once as class attribute onRcParams.Note2: In theory it would even be better to use
RcParams._backendrather than access via instancercParams._backendbackend. I've not done that for now, because it would complicate the PR. We may do this in a followup.AI Disclosure
No AI.
PR quality check