diff --git a/altair/vega/v5/__init__.py b/altair/vega/v5/__init__.py index 39d36c1d6..b7164e3cc 100644 --- a/altair/vega/v5/__init__.py +++ b/altair/vega/v5/__init__.py @@ -1,4 +1,6 @@ # flake8: noqa +import warnings +from ...utils.deprecation import AltairDeprecationWarning from .display import vega, Vega, renderers from .schema import * @@ -12,3 +14,8 @@ to_values, default_data_transformer, ) + +warnings.warn( + "The module altair.vega.v5 is deprecated and will be removed in Altair 5.", + AltairDeprecationWarning, +) diff --git a/altair/vega/v5/display.py b/altair/vega/v5/display.py index 3e7f39a60..f813dc92a 100644 --- a/altair/vega/v5/display.py +++ b/altair/vega/v5/display.py @@ -1,6 +1,7 @@ import os from ...utils import PluginRegistry +from ...utils.deprecation import deprecated from ..display import Displayable from ..display import default_renderer_base from ..display import json_renderer_base @@ -93,6 +94,9 @@ class Vega(Displayable): schema_path = (__name__, "schema/vega-schema.json") +@deprecated( + "Rendering Vega specifications is deprecated and will be removed in Altair 5." +) def vega(spec, validate=True): """Render and optionally validate a Vega 5 spec. diff --git a/altair/vegalite/v3/__init__.py b/altair/vegalite/v3/__init__.py index 82755a5fa..6ba719b7b 100644 --- a/altair/vegalite/v3/__init__.py +++ b/altair/vegalite/v3/__init__.py @@ -1,4 +1,7 @@ # flake8: noqa +import warnings +from ...utils.deprecation import AltairDeprecationWarning + from .schema import * from .api import * from ._deprecated import * @@ -22,3 +25,9 @@ default_data_transformer, data_transformers, ) + +warnings.warn( + "The module altair.vegalite.v3 is deprecated and will be removed in Altair 5. " + "Use `import altair as alt` instead of `import altair.vegalite.v3 as alt`.", + AltairDeprecationWarning, +) diff --git a/altair/vegalite/v3/display.py b/altair/vegalite/v3/display.py index 91967310a..8d9f050b0 100644 --- a/altair/vegalite/v3/display.py +++ b/altair/vegalite/v3/display.py @@ -1,6 +1,7 @@ import os from ...utils.mimebundle import spec_to_mimebundle +from ...utils.deprecation import deprecated from ..display import Displayable from ..display import default_renderer_base from ..display import json_renderer_base @@ -129,6 +130,10 @@ class VegaLite(Displayable): schema_path = (__name__, "schema/vega-lite-schema.json") +@deprecated( + "Rendering VegaLite 3 specifications is deprecated and will be removed in Altair 5. " + "Use `import altair as alt` instead of `import altair.vegalite.v3 as alt`." +) def vegalite(spec, validate=True): """Render and optionally validate a VegaLite 3 spec. diff --git a/doc/releases/changes.rst b/doc/releases/changes.rst index 4b58cdaff..30ae9cf5d 100644 --- a/doc/releases/changes.rst +++ b/doc/releases/changes.rst @@ -11,6 +11,9 @@ Bug Fixes - Disable uri-reference format check in jsonsschema (#2771) - Replace ``iteritems`` with ```items``` due to pandas deprecation (#2683) +Maintenance +~~~~~~~~~~~ +- Add deprecation and removal warnings for Vega-Lite v3 wrappers and Vega v5 wrappers. Version 4.2.0 (released Dec 29, 2021) -------------------------------------