Skip to content

Commit

Permalink
feat: Upgrade Vega-Lite from 5.17.0 to 5.19.0 (#3479)
Browse files Browse the repository at this point in the history
* feat: Upgrade Vega-Lite from 5.17.0 to 5.19.0

* Add support for new resolve argument for density transform

* Update editor url in test. Adapt to fixed typo in utcweeksdayhours

* Bump VL version used for JupyterChart

* Bump minimum vl-convert version to 1.5
  • Loading branch information
binste authored Jul 17, 2024
1 parent 9afd374 commit f8c9776
Show file tree
Hide file tree
Showing 16 changed files with 1,800 additions and 392 deletions.
36 changes: 36 additions & 0 deletions altair/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@
"Mark",
"MarkConfig",
"MarkDef",
"MarkInvalidDataMode",
"MarkPropDefGradientstringnull",
"MarkPropDefnumber",
"MarkPropDefnumberArray",
Expand Down Expand Up @@ -382,6 +383,41 @@
"ScaleFieldDef",
"ScaleInterpolateEnum",
"ScaleInterpolateParams",
"ScaleInvalidDataConfig",
"ScaleInvalidDataShowAsValueangle",
"ScaleInvalidDataShowAsValuecolor",
"ScaleInvalidDataShowAsValuefill",
"ScaleInvalidDataShowAsValuefillOpacity",
"ScaleInvalidDataShowAsValueopacity",
"ScaleInvalidDataShowAsValueradius",
"ScaleInvalidDataShowAsValueshape",
"ScaleInvalidDataShowAsValuesize",
"ScaleInvalidDataShowAsValuestroke",
"ScaleInvalidDataShowAsValuestrokeDash",
"ScaleInvalidDataShowAsValuestrokeOpacity",
"ScaleInvalidDataShowAsValuestrokeWidth",
"ScaleInvalidDataShowAsValuetheta",
"ScaleInvalidDataShowAsValuex",
"ScaleInvalidDataShowAsValuexOffset",
"ScaleInvalidDataShowAsValuey",
"ScaleInvalidDataShowAsValueyOffset",
"ScaleInvalidDataShowAsangle",
"ScaleInvalidDataShowAscolor",
"ScaleInvalidDataShowAsfill",
"ScaleInvalidDataShowAsfillOpacity",
"ScaleInvalidDataShowAsopacity",
"ScaleInvalidDataShowAsradius",
"ScaleInvalidDataShowAsshape",
"ScaleInvalidDataShowAssize",
"ScaleInvalidDataShowAsstroke",
"ScaleInvalidDataShowAsstrokeDash",
"ScaleInvalidDataShowAsstrokeOpacity",
"ScaleInvalidDataShowAsstrokeWidth",
"ScaleInvalidDataShowAstheta",
"ScaleInvalidDataShowAsx",
"ScaleInvalidDataShowAsxOffset",
"ScaleInvalidDataShowAsy",
"ScaleInvalidDataShowAsyOffset",
"ScaleResolveMap",
"ScaleType",
"SchemaBase",
Expand Down
2 changes: 1 addition & 1 deletion altair/jupyter/js/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import vegaEmbed from "https://esm.sh/vega-embed@6?deps=vega@5&deps=vega-lite@5.17.0";
import vegaEmbed from "https://esm.sh/vega-embed@6?deps=vega@5&deps=vega-lite@5.19.0";
import lodashDebounce from "https://esm.sh/lodash-es@4.17.21/debounce";

// Note: For offline support, the import lines above are removed and the remaining script
Expand Down
2 changes: 1 addition & 1 deletion altair/utils/_importers.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def import_vegafusion() -> ModuleType:


def import_vl_convert() -> ModuleType:
min_version = "1.3.0"
min_version = "1.5.0"
try:
version = importlib_version("vl-convert-python")
if Version(version) < Version(min_version):
Expand Down
2 changes: 1 addition & 1 deletion altair/utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def __dataframe__(
"utcmonthdatehoursminutes",
"utcmonthdatehoursminutesseconds",
"utcweekday",
"utcweeksdayhours",
"utcweekdayhours",
"utcweekdayhoursminutes",
"utcweekdayhoursminutesseconds",
"utcdayhours",
Expand Down
10 changes: 10 additions & 0 deletions altair/vegalite/v5/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
SelectionResolution_T,
SingleDefUnitChannel_T,
StackOffset_T,
ResolveMode_T,
)

ChartDataType: TypeAlias = Optional[Union[DataType, core.Data, str, core.Generator]]
Expand Down Expand Up @@ -1764,6 +1765,7 @@ def transform_density(
maxsteps: Optional[int] = Undefined,
minsteps: Optional[int] = Undefined,
steps: Optional[int] = Undefined,
resolve: Optional[ResolveMode_T] = Undefined,
) -> Self:
"""Add a :class:`DensityTransform` to the spec.
Expand Down Expand Up @@ -1804,6 +1806,13 @@ def transform_density(
density. If specified, overrides both minsteps and maxsteps to set an exact number
of uniform samples. Potentially useful in conjunction with a fixed extent to ensure
consistent sample points for stacked densities.
resolve : Literal['independent', 'shared']
Indicates how parameters for multiple densities should be resolved. If
``"independent"``, each density may have its own domain extent and dynamic number of
curve sample steps. If ``"shared"``, the KDE transform will ensure that all
densities are defined over a shared domain and curve steps, enabling stacking.
**Default value:** ``"shared"``
"""
return self._add_transform(
core.DensityTransform(
Expand All @@ -1816,6 +1825,7 @@ def transform_density(
maxsteps=maxsteps,
minsteps=minsteps,
steps=steps,
resolve=resolve,
**{"as": as_},
)
)
Expand Down
4 changes: 2 additions & 2 deletions altair/vegalite/v5/schema/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
from .core import *
from .channels import *

SCHEMA_VERSION = "v5.17.0"
SCHEMA_VERSION = "v5.19.0"

SCHEMA_URL = "https://vega.github.io/schema/vega-lite/v5.17.0.json"
SCHEMA_URL = "https://vega.github.io/schema/vega-lite/v5.19.0.json"
10 changes: 9 additions & 1 deletion altair/vegalite/v5/schema/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"LayoutAlign_T",
"LegendOrient_T",
"Map",
"MarkInvalidDataMode_T",
"MarkType_T",
"Mark_T",
"MultiTimeUnit_T",
Expand Down Expand Up @@ -723,6 +724,13 @@
"bottom-left",
"bottom-right",
]
MarkInvalidDataMode_T: TypeAlias = Literal[
"filter",
"break-paths-filter-domains",
"break-paths-show-domains",
"break-paths-show-path-domains",
"show",
]
MarkType_T: TypeAlias = Literal[
"arc",
"area",
Expand Down Expand Up @@ -802,7 +810,7 @@
"utcmonthdatehoursminutes",
"utcmonthdatehoursminutesseconds",
"utcweekday",
"utcweeksdayhours",
"utcweekdayhours",
"utcweekdayhoursminutes",
"utcweekdayhoursminutesseconds",
"utcdayhours",
Expand Down
252 changes: 103 additions & 149 deletions altair/vegalite/v5/schema/channels.py

Large diffs are not rendered by default.

1,132 changes: 1,000 additions & 132 deletions altair/vegalite/v5/schema/core.py

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions altair/vegalite/v5/schema/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from __future__ import annotations

import sys
from typing import TYPE_CHECKING, Literal, Sequence
from typing import TYPE_CHECKING, Sequence

from altair.utils import use_signature
from altair.utils.schemapi import Undefined
Expand Down Expand Up @@ -84,7 +84,7 @@ def mark_arc(
interpolate: Optional[
dict | Parameter | SchemaBase | Interpolate_T
] = Undefined,
invalid: Optional[Literal["filter", None]] = Undefined,
invalid: Optional[None | SchemaBase | MarkInvalidDataMode_T] = Undefined,
limit: Optional[dict | float | Parameter | SchemaBase] = Undefined,
line: Optional[bool | dict | SchemaBase] = Undefined,
lineBreak: Optional[str | dict | Parameter | SchemaBase] = Undefined,
Expand Down Expand Up @@ -291,7 +291,7 @@ def mark_area(
interpolate: Optional[
dict | Parameter | SchemaBase | Interpolate_T
] = Undefined,
invalid: Optional[Literal["filter", None]] = Undefined,
invalid: Optional[None | SchemaBase | MarkInvalidDataMode_T] = Undefined,
limit: Optional[dict | float | Parameter | SchemaBase] = Undefined,
line: Optional[bool | dict | SchemaBase] = Undefined,
lineBreak: Optional[str | dict | Parameter | SchemaBase] = Undefined,
Expand Down Expand Up @@ -498,7 +498,7 @@ def mark_bar(
interpolate: Optional[
dict | Parameter | SchemaBase | Interpolate_T
] = Undefined,
invalid: Optional[Literal["filter", None]] = Undefined,
invalid: Optional[None | SchemaBase | MarkInvalidDataMode_T] = Undefined,
limit: Optional[dict | float | Parameter | SchemaBase] = Undefined,
line: Optional[bool | dict | SchemaBase] = Undefined,
lineBreak: Optional[str | dict | Parameter | SchemaBase] = Undefined,
Expand Down Expand Up @@ -705,7 +705,7 @@ def mark_image(
interpolate: Optional[
dict | Parameter | SchemaBase | Interpolate_T
] = Undefined,
invalid: Optional[Literal["filter", None]] = Undefined,
invalid: Optional[None | SchemaBase | MarkInvalidDataMode_T] = Undefined,
limit: Optional[dict | float | Parameter | SchemaBase] = Undefined,
line: Optional[bool | dict | SchemaBase] = Undefined,
lineBreak: Optional[str | dict | Parameter | SchemaBase] = Undefined,
Expand Down Expand Up @@ -912,7 +912,7 @@ def mark_line(
interpolate: Optional[
dict | Parameter | SchemaBase | Interpolate_T
] = Undefined,
invalid: Optional[Literal["filter", None]] = Undefined,
invalid: Optional[None | SchemaBase | MarkInvalidDataMode_T] = Undefined,
limit: Optional[dict | float | Parameter | SchemaBase] = Undefined,
line: Optional[bool | dict | SchemaBase] = Undefined,
lineBreak: Optional[str | dict | Parameter | SchemaBase] = Undefined,
Expand Down Expand Up @@ -1119,7 +1119,7 @@ def mark_point(
interpolate: Optional[
dict | Parameter | SchemaBase | Interpolate_T
] = Undefined,
invalid: Optional[Literal["filter", None]] = Undefined,
invalid: Optional[None | SchemaBase | MarkInvalidDataMode_T] = Undefined,
limit: Optional[dict | float | Parameter | SchemaBase] = Undefined,
line: Optional[bool | dict | SchemaBase] = Undefined,
lineBreak: Optional[str | dict | Parameter | SchemaBase] = Undefined,
Expand Down Expand Up @@ -1326,7 +1326,7 @@ def mark_rect(
interpolate: Optional[
dict | Parameter | SchemaBase | Interpolate_T
] = Undefined,
invalid: Optional[Literal["filter", None]] = Undefined,
invalid: Optional[None | SchemaBase | MarkInvalidDataMode_T] = Undefined,
limit: Optional[dict | float | Parameter | SchemaBase] = Undefined,
line: Optional[bool | dict | SchemaBase] = Undefined,
lineBreak: Optional[str | dict | Parameter | SchemaBase] = Undefined,
Expand Down Expand Up @@ -1533,7 +1533,7 @@ def mark_rule(
interpolate: Optional[
dict | Parameter | SchemaBase | Interpolate_T
] = Undefined,
invalid: Optional[Literal["filter", None]] = Undefined,
invalid: Optional[None | SchemaBase | MarkInvalidDataMode_T] = Undefined,
limit: Optional[dict | float | Parameter | SchemaBase] = Undefined,
line: Optional[bool | dict | SchemaBase] = Undefined,
lineBreak: Optional[str | dict | Parameter | SchemaBase] = Undefined,
Expand Down Expand Up @@ -1740,7 +1740,7 @@ def mark_text(
interpolate: Optional[
dict | Parameter | SchemaBase | Interpolate_T
] = Undefined,
invalid: Optional[Literal["filter", None]] = Undefined,
invalid: Optional[None | SchemaBase | MarkInvalidDataMode_T] = Undefined,
limit: Optional[dict | float | Parameter | SchemaBase] = Undefined,
line: Optional[bool | dict | SchemaBase] = Undefined,
lineBreak: Optional[str | dict | Parameter | SchemaBase] = Undefined,
Expand Down Expand Up @@ -1947,7 +1947,7 @@ def mark_tick(
interpolate: Optional[
dict | Parameter | SchemaBase | Interpolate_T
] = Undefined,
invalid: Optional[Literal["filter", None]] = Undefined,
invalid: Optional[None | SchemaBase | MarkInvalidDataMode_T] = Undefined,
limit: Optional[dict | float | Parameter | SchemaBase] = Undefined,
line: Optional[bool | dict | SchemaBase] = Undefined,
lineBreak: Optional[str | dict | Parameter | SchemaBase] = Undefined,
Expand Down Expand Up @@ -2154,7 +2154,7 @@ def mark_trail(
interpolate: Optional[
dict | Parameter | SchemaBase | Interpolate_T
] = Undefined,
invalid: Optional[Literal["filter", None]] = Undefined,
invalid: Optional[None | SchemaBase | MarkInvalidDataMode_T] = Undefined,
limit: Optional[dict | float | Parameter | SchemaBase] = Undefined,
line: Optional[bool | dict | SchemaBase] = Undefined,
lineBreak: Optional[str | dict | Parameter | SchemaBase] = Undefined,
Expand Down Expand Up @@ -2361,7 +2361,7 @@ def mark_circle(
interpolate: Optional[
dict | Parameter | SchemaBase | Interpolate_T
] = Undefined,
invalid: Optional[Literal["filter", None]] = Undefined,
invalid: Optional[None | SchemaBase | MarkInvalidDataMode_T] = Undefined,
limit: Optional[dict | float | Parameter | SchemaBase] = Undefined,
line: Optional[bool | dict | SchemaBase] = Undefined,
lineBreak: Optional[str | dict | Parameter | SchemaBase] = Undefined,
Expand Down Expand Up @@ -2568,7 +2568,7 @@ def mark_square(
interpolate: Optional[
dict | Parameter | SchemaBase | Interpolate_T
] = Undefined,
invalid: Optional[Literal["filter", None]] = Undefined,
invalid: Optional[None | SchemaBase | MarkInvalidDataMode_T] = Undefined,
limit: Optional[dict | float | Parameter | SchemaBase] = Undefined,
line: Optional[bool | dict | SchemaBase] = Undefined,
lineBreak: Optional[str | dict | Parameter | SchemaBase] = Undefined,
Expand Down Expand Up @@ -2775,7 +2775,7 @@ def mark_geoshape(
interpolate: Optional[
dict | Parameter | SchemaBase | Interpolate_T
] = Undefined,
invalid: Optional[Literal["filter", None]] = Undefined,
invalid: Optional[None | SchemaBase | MarkInvalidDataMode_T] = Undefined,
limit: Optional[dict | float | Parameter | SchemaBase] = Undefined,
line: Optional[bool | dict | SchemaBase] = Undefined,
lineBreak: Optional[str | dict | Parameter | SchemaBase] = Undefined,
Expand Down Expand Up @@ -2935,7 +2935,7 @@ def mark_boxplot(
clip: Optional[bool] = Undefined,
color: Optional[str | dict | Parameter | SchemaBase | ColorName_T] = Undefined,
extent: Optional[str | float] = Undefined,
invalid: Optional[Literal["filter", None]] = Undefined,
invalid: Optional[None | SchemaBase | MarkInvalidDataMode_T] = Undefined,
median: Optional[bool | dict | SchemaBase] = Undefined,
opacity: Optional[float] = Undefined,
orient: Optional[SchemaBase | Orientation_T] = Undefined,
Expand Down
Loading

0 comments on commit f8c9776

Please sign in to comment.