-
Notifications
You must be signed in to change notification settings - Fork 794
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
Consolidate: alt.theme(s)
, alt.typing.theme
, alt.vegalite.v5.theme
, alt.utils.theme
#3610
Comments
|
def register(self, name: str, value: PluginT | None) -> PluginT | None: | |
""" | |
Register a plugin by name and value. | |
This method is used for explicit registration of a plugin and shouldn't be | |
used to manage entry point managed plugins, which are auto-loaded. | |
Parameters | |
---------- | |
name: str | |
The name of the plugin. | |
value: PluginType or None | |
The actual plugin object to register or None to unregister that plugin. |
Since this is not a default, we could probably work around this by adding some sentinel as a default for @alt.themes.register()
.
The source for @dataclasses.dataclass()
has an example of dual usage (function and decorator).
I'm fairly sure the issues around this wouldn't be the technical aspect, mostly just a bit of extra complexity for the user and more explanation in the docs.
alt.theme
I really do think it would be simpler to start fresh with a new namespace, without any additional baggage.
- Decide what we want to expose under
alt.theme.___
- Populate
alt.theme
- Update docs to use
alt.theme
- Deprecate
alt.themes
and then remove inv6
- We could add a
alt.__init__.__getattr__
to hide from autocomplete
- We could add a
We could also be sure that this wouldn't change the meaning of existing user code.
A deprecation warning can always be ignored for those determined to still use alt.themes
Thanks for the detailed description! I’m good with your suggestion to start with |
No problem @mattijn, thanks I'll try to work on this soon. We can always have |
Based on your work in PR #3618 (approaching from a fresh perspective, without considering legacy code) and your findings in issue #3586, could PR #3618 potentially serve as a drop-in replacement for the current |
Thanks @mattijn New search for all usage of NoteI'll try to put together a short analysis/visualization of this usage soon #3618 Functional Changes
alt.theme.___ replacement |
@mattijn I'm thinking about making As of #3618 (commits) everything has a replacement in With the original registry still accessible (w/ deprecation |
What is your suggestion?
The following related PRs have been merged since
v5.4.1
release:@register_theme
decorator #3526ThemeConfig
(TypedDict
) #3536This issue is the continuation of the discussion below:
Originally posted by @dangotbanned in post review comment
...
In #3536 (comment) I mentioned some related issues, but can now see I forgot to elaborate on what I would prefer for
v6
.I would like to have used
altair.theme
as the namespace instead ofaltair.typing.theme
.However, this would be very easy to mistake for
altair.themes
- which is a variable storing a registry of themes.For
v6
I would propose the following api changes - and if there is any support I will open a new issue:altair.typing.theme
->altair.theme
altair.typing.ThemeConfig
, which is already included in the above@altair.register_theme
->@altair.theme.register
altair.theme.enable
altair.themes
top-level exportThis would consolidate all theme related functionality behind a single namespace:
Response by @mattijn in comment
...
I like the suggestion you provide in #3536 (comment) to consolidate everything under a single namespace, including the proposed
ThemeConfig
.I’m fine with doing that now, rather than releasing a version first and requiring deprecation immediately after.
However, instead of phasing out the plural
altair.themes
in favour of the singletonaltair.theme
can we consolidate this PR's work into the existingaltair.themes
?For example, can we have
altair.themes.ThemeConfig
(andaltair.themes.AxisConfigKwds
, etc.) aligning with the existingaltair.themes.register()
andaltair.themes.enable()
.Aesthetically I like the singleton
altair.theme
, but I think sticking withaltair.themes
is more practical, if that is also an option. Can you reflect on this?Proposing this issue itself
Also tagging @binste, as our discussion in another issue probably needs consideration
Notes
alt.vegalite.v5.theme
,alt.utils.theme
were not mentioned in the discussion - stating them here for completenessEdit
@mattijn apologies for the delay, but see #3610 (comment) for my thoughts
The text was updated successfully, but these errors were encountered: