From 1b666f9fe3ff24d9dbca56f51c6a7df7ac6c61ad Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Thu, 25 Jul 2024 14:57:52 +0100 Subject: [PATCH 1/2] fix: Avoid `sphinx` error "Code Execution failed:NameError: name 'format_locale' is not defined" Occurs during doc build, due to both variables being used without a defintion. ```log .\doc\Lib\site-packages\sphinxext_altair\altairplot.py:261: UserWarning: altair-plot: .\altair\doc\user_guide/customization.rst:826 Code Execution failed: NameError: name 'format_locale' is not defined warnings.warn(message, stacklevel=1) ``` --- doc/user_guide/customization.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/doc/user_guide/customization.rst b/doc/user_guide/customization.rst index ca44620b2..77eaf7070 100644 --- a/doc/user_guide/customization.rst +++ b/doc/user_guide/customization.rst @@ -827,9 +827,7 @@ the locale for your chart using the global ``alt.renderers.set_embed_options`` f :output: none import altair as alt - alt.renderers.set_embed_options( - format_locale=format_locale, time_format_locale=time_format_locale - ) + alt.renderers.set_embed_options(format_locale=None, time_format_locale=None) Here ``format_locale`` and ``time_format_locale`` may either be D3 format dictionaries, or strings with the names of pre-defined locales. For example, here we use the From 1bf8edca1d225762db0c08cfefc824d641dfbac8 Mon Sep 17 00:00:00 2001 From: dangotbanned <125183946+dangotbanned@users.noreply.github.com> Date: Sat, 27 Jul 2024 18:09:48 +0100 Subject: [PATCH 2/2] docs: Remove redundant `.. altair-plot::` https://github.com/vega/altair/pull/3503#issuecomment-2254159548 --- doc/user_guide/customization.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/doc/user_guide/customization.rst b/doc/user_guide/customization.rst index 77eaf7070..9759669bd 100644 --- a/doc/user_guide/customization.rst +++ b/doc/user_guide/customization.rst @@ -823,12 +823,6 @@ The preferred format of numbers, dates, and currencies varies by language and lo Vega-Altair takes advantage of `D3's localization support`_ to make it easy to configure the locale for your chart using the global ``alt.renderers.set_embed_options`` function. -.. altair-plot:: - :output: none - - import altair as alt - alt.renderers.set_embed_options(format_locale=None, time_format_locale=None) - Here ``format_locale`` and ``time_format_locale`` may either be D3 format dictionaries, or strings with the names of pre-defined locales. For example, here we use the Italian locale (named ``it-IT``) for both currencies and dates: