Skip to content

Commit

Permalink
Upgrade to Vega-Lite 5.17.0 (#3367)
Browse files Browse the repository at this point in the history
* Run generate_schema_wrapper.py for VL 5.17.0

* Upgrade for JupyterChart

* Require vl-convert-python 1.3.0

* Add note to changelog

* Fix tests

* Format code
  • Loading branch information
binste authored Mar 17, 2024
1 parent 195efa6 commit 0ea4976
Show file tree
Hide file tree
Showing 13 changed files with 753 additions and 356 deletions.
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.16.3";
import vegaEmbed from "https://esm.sh/vega-embed@6?deps=vega@5&deps=vega-lite@5.17.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 @@ -33,7 +33,7 @@ def import_vegafusion() -> ModuleType:


def import_vl_convert() -> ModuleType:
min_version = "1.1.0"
min_version = "1.3.0"
try:
version = importlib_version("vl-convert-python")
if Version(version) < Version(min_version):
Expand Down
3 changes: 3 additions & 0 deletions altair/utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ def __dataframe__(
"values",
"variance",
"variancep",
"exponential",
"exponentialb",
]

# window aggregates from vega-lite version 4.6.0
Expand Down Expand Up @@ -138,6 +140,7 @@ def __dataframe__(
"monthdatehoursminutesseconds",
"weekday",
"weeksdayhours",
"weekdayhours",
"weekdayhoursminutes",
"weekdayhoursminutesseconds",
"dayhours",
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 * # type: ignore[assignment]

SCHEMA_VERSION = "v5.16.3"
SCHEMA_VERSION = "v5.17.0"

SCHEMA_URL = "https://vega.github.io/schema/vega-lite/v5.16.3.json"
SCHEMA_URL = "https://vega.github.io/schema/vega-lite/v5.17.0.json"
751 changes: 519 additions & 232 deletions altair/vegalite/v5/schema/channels.py

Large diffs are not rendered by default.

243 changes: 148 additions & 95 deletions altair/vegalite/v5/schema/core.py

Large diffs are not rendered by default.

56 changes: 42 additions & 14 deletions altair/vegalite/v5/schema/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ def mark_arc(
],
UndefinedType,
] = Undefined,
clip: Union[bool, UndefinedType] = Undefined,
clip: Union[
bool, dict, core._Parameter, core.SchemaBase, UndefinedType
] = Undefined,
color: Union[
str,
dict,
Expand Down Expand Up @@ -998,7 +1000,9 @@ def mark_area(
],
UndefinedType,
] = Undefined,
clip: Union[bool, UndefinedType] = Undefined,
clip: Union[
bool, dict, core._Parameter, core.SchemaBase, UndefinedType
] = Undefined,
color: Union[
str,
dict,
Expand Down Expand Up @@ -1919,7 +1923,9 @@ def mark_bar(
],
UndefinedType,
] = Undefined,
clip: Union[bool, UndefinedType] = Undefined,
clip: Union[
bool, dict, core._Parameter, core.SchemaBase, UndefinedType
] = Undefined,
color: Union[
str,
dict,
Expand Down Expand Up @@ -2840,7 +2846,9 @@ def mark_image(
],
UndefinedType,
] = Undefined,
clip: Union[bool, UndefinedType] = Undefined,
clip: Union[
bool, dict, core._Parameter, core.SchemaBase, UndefinedType
] = Undefined,
color: Union[
str,
dict,
Expand Down Expand Up @@ -3761,7 +3769,9 @@ def mark_line(
],
UndefinedType,
] = Undefined,
clip: Union[bool, UndefinedType] = Undefined,
clip: Union[
bool, dict, core._Parameter, core.SchemaBase, UndefinedType
] = Undefined,
color: Union[
str,
dict,
Expand Down Expand Up @@ -4682,7 +4692,9 @@ def mark_point(
],
UndefinedType,
] = Undefined,
clip: Union[bool, UndefinedType] = Undefined,
clip: Union[
bool, dict, core._Parameter, core.SchemaBase, UndefinedType
] = Undefined,
color: Union[
str,
dict,
Expand Down Expand Up @@ -5603,7 +5615,9 @@ def mark_rect(
],
UndefinedType,
] = Undefined,
clip: Union[bool, UndefinedType] = Undefined,
clip: Union[
bool, dict, core._Parameter, core.SchemaBase, UndefinedType
] = Undefined,
color: Union[
str,
dict,
Expand Down Expand Up @@ -6524,7 +6538,9 @@ def mark_rule(
],
UndefinedType,
] = Undefined,
clip: Union[bool, UndefinedType] = Undefined,
clip: Union[
bool, dict, core._Parameter, core.SchemaBase, UndefinedType
] = Undefined,
color: Union[
str,
dict,
Expand Down Expand Up @@ -7445,7 +7461,9 @@ def mark_text(
],
UndefinedType,
] = Undefined,
clip: Union[bool, UndefinedType] = Undefined,
clip: Union[
bool, dict, core._Parameter, core.SchemaBase, UndefinedType
] = Undefined,
color: Union[
str,
dict,
Expand Down Expand Up @@ -8366,7 +8384,9 @@ def mark_tick(
],
UndefinedType,
] = Undefined,
clip: Union[bool, UndefinedType] = Undefined,
clip: Union[
bool, dict, core._Parameter, core.SchemaBase, UndefinedType
] = Undefined,
color: Union[
str,
dict,
Expand Down Expand Up @@ -9287,7 +9307,9 @@ def mark_trail(
],
UndefinedType,
] = Undefined,
clip: Union[bool, UndefinedType] = Undefined,
clip: Union[
bool, dict, core._Parameter, core.SchemaBase, UndefinedType
] = Undefined,
color: Union[
str,
dict,
Expand Down Expand Up @@ -10208,7 +10230,9 @@ def mark_circle(
],
UndefinedType,
] = Undefined,
clip: Union[bool, UndefinedType] = Undefined,
clip: Union[
bool, dict, core._Parameter, core.SchemaBase, UndefinedType
] = Undefined,
color: Union[
str,
dict,
Expand Down Expand Up @@ -11129,7 +11153,9 @@ def mark_square(
],
UndefinedType,
] = Undefined,
clip: Union[bool, UndefinedType] = Undefined,
clip: Union[
bool, dict, core._Parameter, core.SchemaBase, UndefinedType
] = Undefined,
color: Union[
str,
dict,
Expand Down Expand Up @@ -12050,7 +12076,9 @@ def mark_geoshape(
],
UndefinedType,
] = Undefined,
clip: Union[bool, UndefinedType] = Undefined,
clip: Union[
bool, dict, core._Parameter, core.SchemaBase, UndefinedType
] = Undefined,
color: Union[
str,
dict,
Expand Down
38 changes: 31 additions & 7 deletions altair/vegalite/v5/schema/vega-lite-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
"valid",
"values",
"variance",
"variancep"
"variancep",
"exponential",
"exponentialb"
],
"type": "string"
},
Expand Down Expand Up @@ -15591,7 +15593,7 @@
"monthdatehoursminutes",
"monthdatehoursminutesseconds",
"weekday",
"weeksdayhours",
"weekdayhours",
"weekdayhoursminutes",
"weekdayhoursminutesseconds",
"dayhours",
Expand Down Expand Up @@ -16747,8 +16749,15 @@
]
},
"clip": {
"description": "Whether a mark be clipped to the enclosing group’s width and height.",
"type": "boolean"
"anyOf": [
{
"type": "boolean"
},
{
"$ref": "#/definitions/ExprRef"
}
],
"description": "Whether a mark be clipped to the enclosing group’s width and height."
},
"color": {
"anyOf": [
Expand Down Expand Up @@ -17882,7 +17891,9 @@
"valid",
"values",
"variance",
"variancep"
"variancep",
"exponential",
"exponentialb"
],
"type": "string"
},
Expand Down Expand Up @@ -18296,8 +18307,15 @@
]
},
"clip": {
"description": "Whether a mark be clipped to the enclosing group’s width and height.",
"type": "boolean"
"anyOf": [
{
"type": "boolean"
},
{
"$ref": "#/definitions/ExprRef"
}
],
"description": "Whether a mark be clipped to the enclosing group’s width and height."
},
"color": {
"anyOf": [
Expand Down Expand Up @@ -21924,6 +21942,12 @@
{
"$ref": "#/definitions/ColorScheme"
},
{
"items": {
"type": "string"
},
"type": "array"
},
{
"$ref": "#/definitions/SchemeParams"
},
Expand Down
2 changes: 2 additions & 0 deletions doc/releases/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Release Notes

Version 5.3.0 (unreleased month day, year)
--------------------------
- Update Vega-Lite from version 5.16.3 to version 5.17.0;
see `Vega-Lite Release Notes <https://github.com/vega/vega-lite/releases>`_.

Enhancements
~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Source = "https://github.com/altair-viz/altair"
[project.optional-dependencies]
all = [
"vega_datasets>=0.9.0",
"vl-convert-python>=1.1.0",
"vl-convert-python>=1.3.0",
"pyarrow>=11",
"vegafusion[embed]>=1.5.0",
"anywidget>=0.9.0",
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test_schemapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ def chart_error_example__four_errors():
- One of \['year', 'quarter', 'month', 'week', 'day', 'dayofyear', 'date', 'hours', 'minutes', 'seconds', 'milliseconds'\]
- One of \['utcyear', 'utcquarter', 'utcmonth', 'utcweek', 'utcday', 'utcdayofyear', 'utcdate', 'utchours', 'utcminutes', 'utcseconds', 'utcmilliseconds'\]
- One of \['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weeksdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'\]
- One of \['yearquarter', 'yearquartermonth', 'yearmonth', 'yearmonthdate', 'yearmonthdatehours', 'yearmonthdatehoursminutes', 'yearmonthdatehoursminutesseconds', 'yearweek', 'yearweekday', 'yearweekdayhours', 'yearweekdayhoursminutes', 'yearweekdayhoursminutesseconds', 'yeardayofyear', 'quartermonth', 'monthdate', 'monthdatehours', 'monthdatehoursminutes', 'monthdatehoursminutesseconds', 'weekday', 'weekdayhours', 'weekdayhoursminutes', 'weekdayhoursminutesseconds', 'dayhours', 'dayhoursminutes', 'dayhoursminutesseconds', 'hoursminutes', 'hoursminutesseconds', 'minutesseconds', 'secondsmilliseconds'\]
- One of \['utcyearquarter', 'utcyearquartermonth', 'utcyearmonth', 'utcyearmonthdate', 'utcyearmonthdatehours', 'utcyearmonthdatehoursminutes', 'utcyearmonthdatehoursminutesseconds', 'utcyearweek', 'utcyearweekday', 'utcyearweekdayhours', 'utcyearweekdayhoursminutes', 'utcyearweekdayhoursminutesseconds', 'utcyeardayofyear', 'utcquartermonth', 'utcmonthdate', 'utcmonthdatehours', 'utcmonthdatehoursminutes', 'utcmonthdatehoursminutesseconds', 'utcweekday', 'utcweeksdayhours', 'utcweekdayhoursminutes', 'utcweekdayhoursminutesseconds', 'utcdayhours', 'utcdayhoursminutes', 'utcdayhoursminutesseconds', 'utchoursminutes', 'utchoursminutesseconds', 'utcminutesseconds', 'utcsecondsmilliseconds'\]
- One of \['binnedyear', 'binnedyearquarter', 'binnedyearquartermonth', 'binnedyearmonth', 'binnedyearmonthdate', 'binnedyearmonthdatehours', 'binnedyearmonthdatehoursminutes', 'binnedyearmonthdatehoursminutesseconds', 'binnedyearweek', 'binnedyearweekday', 'binnedyearweekdayhours', 'binnedyearweekdayhoursminutes', 'binnedyearweekdayhoursminutesseconds', 'binnedyeardayofyear'\]
- One of \['binnedutcyear', 'binnedutcyearquarter', 'binnedutcyearquartermonth', 'binnedutcyearmonth', 'binnedutcyearmonthdate', 'binnedutcyearmonthdatehours', 'binnedutcyearmonthdatehoursminutes', 'binnedutcyearmonthdatehoursminutesseconds', 'binnedutcyearweek', 'binnedutcyearweekday', 'binnedutcyearweekdayhours', 'binnedutcyearweekdayhoursminutes', 'binnedutcyearweekdayhoursminutesseconds', 'binnedutcyeardayofyear'\]
Expand Down
2 changes: 1 addition & 1 deletion tests/vegalite/v5/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def test_save_html(basic_chart, inline):

def test_to_url(basic_chart):
share_url = basic_chart.to_url()
expected_vegalite_encoding = "N4Igxg9gdgZglgcxALlANzgUwO4tJKAFzigFcJSBnAdTgBNCALFAZgAY2AacaYsiygAlMiRoVYcAvpO50AhoTl4QUOQFtMKEPMUBaAOwA2ABwAWFi1NyTcgEb7TtuabAswc-XTZhMczLdNDAEYQGRA1OQAnAGtlQgBPAAdNZBAnSNDuTChIOhIkVBAAD2V4TAAbOi0lbgTkrSgINRI5csyQeNKsSq1bEFqklJAAR1I5IjhFYjRNaW4AEkowRkwIrTFCRMpkAHodmYQ5ADoEScZSWyO4CB2llYj9zEPdcsnMfYBWI6DDI5YjgBWlGg-W0CjklEwhEoyh0cgMJnMlmsxjsDicLjcHi8Pj8AWCKAA2qAlKkAIKgvrIABMxhkJK0ACFKSgPh96SBSSAAMIs5DmDlcgAifIAnEFBVoAKJ84wSzgM1IAMT5HxYktSAHE+UFRRqQIJZfp9QBJVXUyQAXWkQA"
expected_vegalite_encoding = "N4Igxg9gdgZglgcxALlANzgUwO4tJKAFzigFcJSBnAdTgBNCALFAZgAY2AacaYsiygAlMiRoVYcAvpO50AhoTl4QUOQFtMKEPMUBaAOwA2ABwAWFi1NyTcgEb7TtuabAswc-XTZhMczLdNDAEYQGRA1OQAnAGtlQgBPAAdNZBAnSNDuTChIOhIkVBAAD2V4TAAbOi0lbgTkrSgINRI5csyQeNKsSq1bEFqklJAAR1I5IjhFYjRNaW4AEkowRkwIrTFCRMpkAHodmYQ5ADoEScZSWyO4CB2llYj9zEPdcsnMfYBWI6D9I7YjgBWlGg-W0CjklEwhEoyh0cgMJnMlmsxjsDicLjcHi8Pj8AWCKAA2qAlKkAIKgvrIABMxhkJK0ACFKSgPh96SBSSAAMIs5DmDlcgAifIAnEFBVoAKJ84wSzgM1IAMT5HxYktSAHE+UFRRqQIJZfp9QBJVXUyQAXWkQA"

assert (
share_url
Expand Down
2 changes: 1 addition & 1 deletion tools/generate_schema_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
indent_docstring,
)

SCHEMA_VERSION: Final = "v5.16.3"
SCHEMA_VERSION: Final = "v5.17.0"

reLink = re.compile(r"(?<=\[)([^\]]+)(?=\]\([^\)]+\))", re.M)
reSpecial = re.compile(r"[*_]{2,3}|`", re.M)
Expand Down

0 comments on commit 0ea4976

Please sign in to comment.