-
Notifications
You must be signed in to change notification settings - Fork 795
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
simplify deprecation message for altair.themes? #3694
Comments
@mattijn I do understand the concern. One thing I'd add though is that the annotation is what provides the static typing feedback. So even if you don't understand typing, if you copy and paste the code - your IDE can let you know if something is wrong. Originalimport altair as alt
@alt.theme.register('theme_name', enable=True)
def custom_theme() -> alt.theme.ThemeConfig:
return {'height': 400, 'width': 700} AlternativesIf we just want to shorten it we could say: from altair import theme
@theme.register('theme_name', enable=True)
def custom_theme() -> theme.ThemeConfig:
return {'height': 400, 'width': 700} or from altair.theme import register, ThemeConfig
@register('theme_name', enable=True)
def custom_theme() -> ThemeConfig:
return {'height': 400, 'width': 700} Both of these would be a shorter message - while not limiting the benefits of the original |
I'm in JupyterLab and I don't get any feedback🤷♂️ |
I think we'll need to figure out a good suggestion for that case as part of #3645
For example https://github.com/jupyter-lsp/jupyterlab-lsp Edit: Looks more complicated than adding an extension in VSCode |
Can we do this? import altair as alt
@alt.theme.register('theme_name', enable=True)
def custom_theme():
return alt.theme.ThemeConfig(
{'height': 400, 'width': 700}
) Still a single |
Yeah @mattijn that works for me You can also use keyword args if you're using |
Once JupyterLab and Jupyter Notebook (classic) have proper language service support, these types of changes will be easier to implement. However, we're not there yet. Thanks for helping to find an intermediate solution! |
What is your suggestion?
In the deprecation message of altair.themes we see currently among other things:
altair/altair/__init__.py
Line 681 in c41e29e
I'm wondering if we really need to add
-> alt.theme.ThemeConfig
when defining this function. Within a Jupyter Notebook I really rarely see this approach being utilised and in combination with the usage of a@
decorator to register the theme, also something I really rarely see people doing a Jupyter Notebook, this deprecation message feels a bit overwhelming to me.Have you considered any alternative solutions?
@dangotbanned, if it's not too much trouble, I prefer making one change at a time as a user. Can we just do this?
The text was updated successfully, but these errors were encountered: