Skip to content

Commit

Permalink
deprecate Vega wrappers and VegaLite 3 wrappers (#2843)
Browse files Browse the repository at this point in the history
* include an altairfuturewarning

* deprecate vega 5 wrappers and render function

* deprecate vegalite 3 wrappers and render function

* use AltairDeprecationWarning

* fix typo in v5 warning

* remove mentioning alternative for vega wrappers

* Backport bug fixes for a 4.2.1 release (#2827)

* DOC: remove unused section

* Disable uri-reference format check in jsonsschema (#2771)

* Disable uri-reference format check. Consistently use same validator across codebase

* Remove validation in SchemaInfo as not used anywhere and it referenced the wrong jsonschema draft

* Add compatibility for older jsonschema versions

* Improve comments

* Simplify validate_jsonschema

* Replace `iteritems` with `items` due to pandas deprecation (#2683)

* Add changelog entry.

* Bump version.

* Run black and flake8.

* Pin selenium in CI.

Co-authored-by: Jake VanderPlas <jakevdp@google.com>
Co-authored-by: Stefan Binder <binder_stefan@outlook.com>
Co-authored-by: Joel Ostblom <joelostblom@users.noreply.github.com>

* include note in releases change log

Co-authored-by: Jan Tilly <jan.tilly@quantco.com>
Co-authored-by: Jake VanderPlas <jakevdp@google.com>
Co-authored-by: Stefan Binder <binder_stefan@outlook.com>
Co-authored-by: Joel Ostblom <joelostblom@users.noreply.github.com>
  • Loading branch information
5 people committed Jan 21, 2023
1 parent 6d214f9 commit bc74815
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 0 deletions.
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

0 comments on commit bc74815

Please sign in to comment.