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

feat: Update Vega-Lite to 5.20.1 #3525

Merged
merged 5 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.19.0";
import vegaEmbed from "https://esm.sh/vega-embed@6?deps=vega@5&deps=vega-lite@5.20.1";
import lodashDebounce from "https://esm.sh/[email protected]/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.5.0"
min_version = "1.6.0"
try:
version = importlib_version("vl-convert-python")
if Version(version) < Version(min_version):
Expand Down
2 changes: 1 addition & 1 deletion altair/utils/_transformed_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def get_facet_mapping(group: dict[str, Any], scope: Scope = ()) -> FacetMapping:
group, facet_data, scope
)
if definition_scope is not None:
facet_mapping[(facet_name, group_scope)] = (
facet_mapping[facet_name, group_scope] = (
facet_data,
definition_scope,
)
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.19.0"
SCHEMA_VERSION = "v5.20.1"

SCHEMA_URL = "https://vega.github.io/schema/vega-lite/v5.19.0.json"
SCHEMA_URL = "https://vega.github.io/schema/vega-lite/v5.20.1.json"
20 changes: 19 additions & 1 deletion altair/vegalite/v5/schema/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -18532,6 +18532,10 @@ class ScaleConfig(VegaLiteSchema):
round : bool, dict, :class:`ExprRef`
If true, rounds numeric output values to integers. This can be helpful for snapping
to the pixel grid. (Only available for ``x``, ``y``, and ``size`` scales.)
tickBandPaddingInner : dict, float, :class:`ExprRef`
Default inner padding for ``x`` and ``y`` band-ordinal scales of ``"tick"`` marks.

**Default value:** ``0.25``
useUnaggregatedDomain : bool
Use the source data range before aggregation as scale domain instead of aggregated
data for aggregate axis.
Expand Down Expand Up @@ -18596,6 +18600,9 @@ def __init__(
dict | float | Parameter | SchemaBase
] = Undefined,
round: Optional[bool | dict | Parameter | SchemaBase] = Undefined,
tickBandPaddingInner: Optional[
dict | float | Parameter | SchemaBase
] = Undefined,
useUnaggregatedDomain: Optional[bool] = Undefined,
xReverse: Optional[bool | dict | Parameter | SchemaBase] = Undefined,
zero: Optional[bool] = Undefined,
Expand Down Expand Up @@ -18627,6 +18634,7 @@ def __init__(
quantizeCount=quantizeCount,
rectBandPaddingInner=rectBandPaddingInner,
round=round,
tickBandPaddingInner=tickBandPaddingInner,
useUnaggregatedDomain=useUnaggregatedDomain,
xReverse=xReverse,
zero=zero,
Expand Down Expand Up @@ -26730,6 +26738,13 @@ class VariableParameter(TopLevelParameter):
An expression for the value of the parameter. This expression may include other
parameters, in which case the parameter will automatically update in response to
upstream parameter changes.
react : bool
A boolean flag (default ``true``) indicating if the update expression should be
automatically re-evaluated when any upstream signal dependencies update. If
``false``, the update expression will not register any dependencies on other
signals, even for initialization.

**Default value:** ``true``
value : Any
The `initial value <http://vega.github.io/vega-lite/docs/value.html>`__ of the
parameter.
Expand All @@ -26744,10 +26759,13 @@ def __init__(
name: Optional[str | SchemaBase] = Undefined,
bind: Optional[dict | SchemaBase] = Undefined,
expr: Optional[str | SchemaBase] = Undefined,
react: Optional[bool] = Undefined,
value: Optional[Any] = Undefined,
**kwds,
):
super().__init__(name=name, bind=bind, expr=expr, value=value, **kwds)
super().__init__(
name=name, bind=bind, expr=expr, react=react, value=value, **kwds
)


class Vector10string(VegaLiteSchema):
Expand Down
17 changes: 17 additions & 0 deletions altair/vegalite/v5/schema/vega-lite-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -22237,6 +22237,19 @@
],
"description": "If true, rounds numeric output values to integers. This can be helpful for snapping to the pixel grid. (Only available for `x`, `y`, and `size` scales.)"
},
"tickBandPaddingInner": {
"anyOf": [
{
"type": "number"
},
{
"$ref": "#/definitions/ExprRef"
}
],
"description": "Default inner padding for `x` and `y` band-ordinal scales of `\"tick\"` marks.\n\n__Default value:__ `0.25`",
"maximum": 1,
"minimum": 0
},
"useUnaggregatedDomain": {
"description": "Use the source data range before aggregation as scale domain instead of aggregated data for aggregate axis.\n\nThis is equivalent to setting `domain` to `\"unaggregate\"` for aggregated _quantitative_ fields by default.\n\nThis property only works with aggregate functions that produce values within the raw data domain (`\"mean\"`, `\"average\"`, `\"median\"`, `\"q1\"`, `\"q3\"`, `\"min\"`, `\"max\"`). For other aggregations that produce values outside of the raw data domain (e.g. `\"count\"`, `\"sum\"`), this property is ignored.\n\n__Default value:__ `false`",
"type": "boolean"
Expand Down Expand Up @@ -31631,6 +31644,10 @@
"$ref": "#/definitions/ParameterName",
"description": "A unique name for the variable parameter. Parameter names should be valid JavaScript identifiers: they should contain only alphanumeric characters (or \"$\", or \"_\") and may not start with a digit. Reserved keywords that may not be used as parameter names are \"datum\", \"event\", \"item\", and \"parent\"."
},
"react": {
"description": "A boolean flag (default `true`) indicating if the update expression should be automatically re-evaluated when any upstream signal dependencies update. If `false`, the update expression will not register any dependencies on other signals, even for initialization.\n\n __Default value:__ `true`",
"type": "boolean"
},
"value": {
"description": "The [initial value](http://vega.github.io/vega-lite/docs/value.html) of the parameter.\n\n__Default value:__ `undefined`"
}
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Source = "https://github.com/vega/altair"
[project.optional-dependencies]
all = [
"vega_datasets>=0.9.0",
"vl-convert-python>=1.5.0",
"vl-convert-python>=1.6.0",
"pandas>=0.25.3",
"numpy",
"pyarrow>=11",
Expand Down
12 changes: 4 additions & 8 deletions tests/vegalite/v5/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,19 +812,15 @@ def test_to_url(basic_chart):
pytest.skip("vl_convert is not installed")

share_url = basic_chart.to_url()
expected_vegalite_encoding = "N4Igxg9gdgZglgcxALlANzgUwO4tJKAFzigFcJSBnAdTgBNCALFAZgAY2AacaYsiygAlMiRoVYcAvpO50AhoTl4QUOQFtMKEPMUBaAOwA2ABwAWFi1NyTcgEb7TtuabAswc-XTZhMczLdNDAEYQGRA1OQAnAGtlQgBPAAdNZBAnSNDuTChIOhIkVBAAD2V4TAAbOi0lbgTkrSgINRI5csyQeNKsSq1bEFqklJAAR1I5IjhFYjRNaW4AEkowRkwIrTFCRMpkAHodmYQ5ADoEScZSWyO4CB2llYj9zEPdcsnMfYBWI6CATiO2I4AK0o0H62gUckomEIlGUOjkBhM5ks1mMdgcThcbg8Xh8fgCwRQAG1QEpUgBBMF9ZAAJmMMlJWgAQlSUB8PgyQGSQABhVnIcyc7kAEX5PyCQq0AFF+cYJZxGakAGL8j4sSWpADi-N+GpAgll+j1AElVTTJABdaRAA"

assert (
share_url
== f"https://vega.github.io/editor/#/url/vega-lite/{expected_vegalite_encoding}"
)
assert share_url.startswith("https://vega.github.io/editor/#/url/vega-lite/")

# Check fullscreen
fullscreen_share_url = basic_chart.to_url(fullscreen=True)
assert (
fullscreen_share_url
== f"https://vega.github.io/editor/#/url/vega-lite/{expected_vegalite_encoding}/view"
assert fullscreen_share_url.startswith(
"https://vega.github.io/editor/#/url/vega-lite/"
)
assert fullscreen_share_url.endswith("/view")


def test_facet_basic():
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 @@ -26,7 +26,7 @@
ruff_write_lint_format_str,
)

SCHEMA_VERSION: Final = "v5.19.0"
SCHEMA_VERSION: Final = "v5.20.1"

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