Skip to content
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

deprecate Vega wrappers and VegaLite 3 wrappers #2843

Merged
merged 9 commits into from Jan 21, 2023
7 changes: 7 additions & 0 deletions 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 *

Expand All @@ -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,
)
4 changes: 4 additions & 0 deletions 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
Expand Down Expand Up @@ -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.

Expand Down
9 changes: 9 additions & 0 deletions 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 *
Expand All @@ -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,
)
5 changes: 5 additions & 0 deletions 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
Expand Down Expand Up @@ -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.

Expand Down
3 changes: 3 additions & 0 deletions doc/releases/changes.rst
Expand Up @@ -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)
-------------------------------------
Expand Down