Skip to content

Commit f919f25

Browse files
franzhaasmattijndangotbanned
authored
feat: Bump vega-lite>=6 (#3831)
* bumped vega embed version see #3828 (comment) * - bumped at referenced places * - more * - bumped vegalite * - moved from 5 to 6 * update tools * more tools * changes to sphinx extension * renamed tests * changes docs * auto generated files mods * changes to chore * python changes * more python changes * first line is written by `update_vega_embed` function within `versioning.py` when called in `generate_schema_wrapper.py` on line `VERSIONS.update_all()` * - bumped vegalite * - moved from 5 to 6 * update tools * more tools * changes to sphinx extension * renamed tests * changes docs * auto generated files mods * changes to chore * python changes * more python changes * first line is written by `update_vega_embed` function within `versioning.py` when called in `generate_schema_wrapper.py` on line `VERSIONS.update_all()` * build: run `generate-schema-wrapper` Should fix this *specfic* failure https://github.com/vega/altair/actions/runs/14695042187/job/41235514359?pr=3831 `vl_convert` is still a blocker * bump vlc to 1.8.0 * vega & vl to 6 * add new expressions * catch inf recursion * update test to new height * had to remove the `+` after `v6` before: application/vnd.vega.v6+json after: application/vnd.vega.v6json * catch py3.13: BufferError: Existing exports of data: object cannot be re-sized * apply changes within tools * picnic? --------- Co-authored-by: Mattijn van Hoek <[email protected]> Co-authored-by: dangotbanned <[email protected]>
1 parent d1f4a1e commit f919f25

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+4105
-2571
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,4 @@ jobs:
7878
# uri-reference check is disabled as the URIs in the Vega-Lite schema do
7979
# not conform RFC 3986.
8080
uv pip install 'jsonschema[format]' check-jsonschema --upgrade
81-
uv run check-jsonschema --check-metaschema altair/vegalite/v5/schema/vega-lite-schema.json --disable-formats uri-reference
81+
uv run check-jsonschema --check-metaschema altair/vegalite/v6/schema/vega-lite-schema.json --disable-formats uri-reference

NOTES_FOR_MAINTAINERS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
The core Python API for Altair can be found in the following locations:
66

7-
- ``altair/vegalite/v5/schema/``
7+
- ``altair/vegalite/v6/schema/``
88

99
All the files within these directories are created automatically by running
1010
the following script:
@@ -81,7 +81,7 @@ The Vega-Lite version for the Python code propagates to `tools.generate_schema_w
8181
This will update all of the automatically-generated files in the ``schema``
8282
directory for each version, but please note that it will *not* update other
8383
pieces (for example, the core of the Altair API, including methods and
84-
doc strings within ``altair/vegalite/v5/api.py``).
84+
doc strings within ``altair/vegalite/v6/api.py``).
8585
These additional methods have fairly good test coverage, so running the test
8686
suite should identify any inconsistencies:
8787

RELEASING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050

5151
12. On main, tag the release. If you work on a fork, replace `origin` with `upstream`:
5252

53-
git tag -a v5.0.0 -m "Version 5.0.0 release"
54-
git push origin v5.0.0
53+
git tag -a v6.0.0 -m "Version 5.0.0 release"
54+
git push origin v6.0.0
5555

5656
13. Create a new branch:
5757

altair/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@
202202
"FoldTransform",
203203
"FontStyle",
204204
"FontWeight",
205+
"Format",
205206
"FormatConfig",
206207
"Generator",
207208
"GenericUnitSpecEncodingAnyMark",
@@ -389,6 +390,7 @@
389390
"ScaleInvalidDataShowAsValuestrokeOpacity",
390391
"ScaleInvalidDataShowAsValuestrokeWidth",
391392
"ScaleInvalidDataShowAsValuetheta",
393+
"ScaleInvalidDataShowAsValuetime",
392394
"ScaleInvalidDataShowAsValuex",
393395
"ScaleInvalidDataShowAsValuexOffset",
394396
"ScaleInvalidDataShowAsValuey",
@@ -406,6 +408,7 @@
406408
"ScaleInvalidDataShowAsstrokeOpacity",
407409
"ScaleInvalidDataShowAsstrokeWidth",
408410
"ScaleInvalidDataShowAstheta",
411+
"ScaleInvalidDataShowAstime",
409412
"ScaleInvalidDataShowAsx",
410413
"ScaleInvalidDataShowAsxOffset",
411414
"ScaleInvalidDataShowAsy",
@@ -489,6 +492,10 @@
489492
"ThetaValue",
490493
"TickConfig",
491494
"TickCount",
495+
"Time",
496+
"TimeDef",
497+
"TimeFieldDef",
498+
"TimeFormatSpecifier",
492499
"TimeInterval",
493500
"TimeIntervalStep",
494501
"TimeLocale",
@@ -632,7 +639,7 @@
632639
"topo_feature",
633640
"typing",
634641
"utils",
635-
"v5",
642+
"v6",
636643
"value",
637644
"vconcat",
638645
"vegalite",
@@ -647,7 +654,7 @@ def __dir__():
647654

648655

649656
from altair.vegalite import *
650-
from altair.vegalite.v5.schema.core import Dict
657+
from altair.vegalite.v6.schema.core import Dict
651658
from altair.jupyter import JupyterChart
652659
from altair.expr import expr
653660
from altair.utils import AltairDeprecationWarning, parse_shorthand, Undefined

altair/_magics.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@
1010
from IPython.core import magic_arguments
1111
from narwhals.stable.v1.dependencies import is_pandas_dataframe
1212

13-
from altair.vegalite import v5 as vegalite_v5
13+
from altair.vegalite import v6 as vegalite_v6
1414

1515
__all__ = ["vegalite"]
1616

1717
RENDERERS = {
1818
"vega-lite": {
19-
"5": vegalite_v5.VegaLite,
19+
"6": vegalite_v6.VegaLite,
2020
},
2121
}
2222

2323

2424
TRANSFORMERS = {
2525
"vega-lite": {
26-
"5": vegalite_v5.data_transformers,
26+
"6": vegalite_v6.data_transformers,
2727
},
2828
}
2929

@@ -66,21 +66,21 @@ def _get_variable(name: str) -> Any:
6666
nargs="?",
6767
help="local variablename of a pandas DataFrame to be used as the dataset",
6868
)
69-
@magic_arguments.argument("-v", "--version", dest="version", default="v5")
69+
@magic_arguments.argument("-v", "--version", dest="version", default="v6")
7070
@magic_arguments.argument("-j", "--json", dest="json", action="store_true")
71-
def vegalite(line, cell) -> vegalite_v5.VegaLite:
71+
def vegalite(line, cell) -> vegalite_v6.VegaLite:
7272
"""
7373
Cell magic for displaying vega-lite visualizations in CoLab.
7474
75-
%%vegalite [dataframe] [--json] [--version='v5']
75+
%%vegalite [dataframe] [--json] [--version='v6']
7676
7777
Visualize the contents of the cell using Vega-Lite, optionally
7878
specifying a pandas DataFrame object to be used as the dataset.
7979
8080
if --json is passed, then input is parsed as json rather than yaml.
8181
"""
8282
args = magic_arguments.parse_argstring(vegalite, line)
83-
existing_versions = {"v5": "5"}
83+
existing_versions = {"v6": "6"}
8484
version = existing_versions[args.version]
8585
assert version in RENDERERS["vega-lite"]
8686
VegaLite = RENDERERS["vega-lite"][version]

altair/expr/__init__.py

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from typing import TYPE_CHECKING, Any
1010

1111
from altair.expr.core import ConstExpression, FunctionExpression
12-
from altair.vegalite.v5.schema.core import ExprRef as _ExprRef
12+
from altair.vegalite.v6.schema.core import ExprRef as _ExprRef
1313

1414
if sys.version_info >= (3, 12):
1515
from typing import override
@@ -172,8 +172,18 @@ class expr(_ExprRef, metaclass=_ExprMeta):
172172
https://en.wikipedia.org/wiki/Continuous_uniform_distribution
173173
.. _*unit*:
174174
https://vega.github.io/vega/docs/api/time/#time-units
175+
.. _ascending from Vega Utils:
176+
https://vega.github.io/vega/docs/api/util/#ascending
175177
.. _JavaScript's String.replace:
176178
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
179+
.. _Base64:
180+
https://developer.mozilla.org/en-US/docs/Glossary/Base64
181+
.. _ASCII:
182+
https://developer.mozilla.org/en-US/docs/Glossary/ASCII
183+
.. _Window.btoa():
184+
https://developer.mozilla.org/en-US/docs/Web/API/Window/btoa
185+
.. _Window.atob():
186+
https://developer.mozilla.org/en-US/docs/Web/API/Window/atob
177187
.. _d3-format specifier:
178188
https://github.com/d3/d3-format/
179189
.. _*units*:
@@ -1175,6 +1185,16 @@ def slice(
11751185
"""
11761186
return FunctionExpression("slice", (array, start, end))
11771187

1188+
@classmethod
1189+
def sort(cls, array: IntoExpression, /) -> Expression:
1190+
"""
1191+
Sorts the array in natural order using `ascending from Vega Utils`_.
1192+
1193+
.. _ascending from Vega Utils:
1194+
https://vega.github.io/vega/docs/api/util/#ascending
1195+
"""
1196+
return FunctionExpression("sort", (array,))
1197+
11781198
@classmethod
11791199
def span(cls, array: IntoExpression, /) -> Expression:
11801200
"""Returns the span of ``array``: the difference between the last and first elements, or *array[array.length-1] - array[0]*."""
@@ -1281,6 +1301,38 @@ def upper(cls, string: IntoExpression, /) -> Expression:
12811301
"""Transforms ``string`` to upper-case letters."""
12821302
return FunctionExpression("upper", (string,))
12831303

1304+
@classmethod
1305+
def btoa(cls, string: IntoExpression, /) -> Expression:
1306+
"""
1307+
Creates a `Base64`_-encoded `ASCII`_ string.
1308+
1309+
Same as JavaScript's `Window.alt.expr.btoa()`_.
1310+
1311+
.. _Base64:
1312+
https://developer.mozilla.org/en-US/docs/Glossary/Base64
1313+
.. _ASCII:
1314+
https://developer.mozilla.org/en-US/docs/Glossary/ASCII
1315+
.. _Window.alt.expr.btoa():
1316+
https://developer.mozilla.org/en-US/docs/Web/API/Window/btoa
1317+
"""
1318+
return FunctionExpression("btoa", (string,))
1319+
1320+
@classmethod
1321+
def atob(cls, string: IntoExpression, /) -> Expression:
1322+
"""
1323+
Decodes an `ASCII`_ string that was encoded with `Base64`_.
1324+
1325+
Same as JavaScript's `Window.alt.expr.atob()`_.
1326+
1327+
.. _ASCII:
1328+
https://developer.mozilla.org/en-US/docs/Glossary/ASCII
1329+
.. _Base64:
1330+
https://developer.mozilla.org/en-US/docs/Glossary/Base64
1331+
.. _Window.alt.expr.atob():
1332+
https://developer.mozilla.org/en-US/docs/Web/API/Window/atob
1333+
"""
1334+
return FunctionExpression("atob", (string,))
1335+
12841336
@classmethod
12851337
def merge(
12861338
cls, object1: IntoExpression, object2: IntoExpression = None, *args: Any

altair/expr/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from altair.utils import SchemaBase
88

99
if TYPE_CHECKING:
10-
from altair.vegalite.v5.schema._typing import Map, PrimitiveValue_T
10+
from altair.vegalite.v6.schema._typing import Map, PrimitiveValue_T
1111

1212
if sys.version_info >= (3, 10):
1313
from typing import TypeAlias

altair/jupyter/js/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import vegaEmbed from "https://esm.sh/vega-embed@7?deps=vega@5&deps=vega-lite@5.21.0";
1+
import vegaEmbed from "https://esm.sh/vega-embed@v7?deps=vega@6&deps=vega-lite@6.1.0";
22
import lodashDebounce from "https://esm.sh/[email protected]/debounce";
33

44
// Note: For offline support, the import lines above are removed and the remaining script

altair/theme.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from typing import TYPE_CHECKING, Any
66
from typing import overload as _overload
77

8-
from altair.vegalite.v5.schema._config import (
8+
from altair.vegalite.v6.schema._config import (
99
AreaConfigKwds,
1010
AutoSizeParamsKwds,
1111
AxisConfigKwds,
@@ -77,7 +77,7 @@
7777
ViewBackgroundKwds,
7878
ViewConfigKwds,
7979
)
80-
from altair.vegalite.v5.theme import themes as _themes
80+
from altair.vegalite.v6.theme import themes as _themes
8181

8282
if TYPE_CHECKING:
8383
import sys

altair/typing/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
]
5151

5252
from altair.utils.schemapi import Optional
53-
from altair.vegalite.v5.api import ChartType, is_chart_type
54-
from altair.vegalite.v5.schema.channels import (
53+
from altair.vegalite.v6.api import ChartType, is_chart_type
54+
from altair.vegalite.v6.schema.channels import (
5555
ChannelAngle,
5656
ChannelColor,
5757
ChannelColumn,

0 commit comments

Comments
 (0)