%global pypi_name altair Name: python-%{pypi_name} Version: 6.3.0 Release: 1%{?dist} Summary: Declarative statistical visualisation for Python, built on Vega-Lite # altair/vegalite/*/schema/*.json are the Vega-Lite and vega-themes JSON # schemas, BSD-3-Clause like Altair itself. License: BSD-3-Clause URL: https://altair-viz.github.io/ Source0: %{pypi_source %{pypi_name}} BuildArch: noarch BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros BuildRequires: python3dist(pandas) %global _description %{expand: Vega-Altair builds interactive statistical charts from a declarative grammar: data, mark type and encoding channels are mapped to a Vega-Lite JSON specification, which is validated against the Vega-Lite schema and rendered by the Vega JavaScript runtime in a notebook or a standalone HTML page. Saving to PNG, SVG or PDF needs the separate vl-convert package.} %description %_description %package -n python3-%{pypi_name} Summary: %{summary} %description -n python3-%{pypi_name} %_description %prep %autosetup -n %{pypi_name}-%{version} # The version comes from versioningit's git-archive method, which an sdist # cannot satisfy: it falls back to "4.0.0+fallback". Pin it. sed -i 's/^dynamic = \["version"\]$/version = "%{version}"/' pyproject.toml grep -q '^version = "%{version}"$' pyproject.toml sed -i '/^\[tool.hatch.version\]/,/^$/d; /^\[tool.hatch.version.vcs\]/,/^$/d' pyproject.toml ! grep -q 'tool.hatch.version' pyproject.toml %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install %pyproject_save_files %{pypi_name} %check # altair.jupyter needs anywidget; vegalite.v6.display's vl-convert paths and # the magics are optional extras. %pyproject_check_import -e 'altair.jupyter*' -e 'altair._magics' cd %{_builddir} # The sdist carries no tests. Build a layered, encoded chart, validate it # against the bundled Vega-Lite schema and write standalone HTML. %{py3_test_envvars} %{python3} - <<'PYEOF' import json, jsonschema, pandas as pd, altair as alt assert alt.__version__ == "%{version}", alt.__version__ df = pd.DataFrame({"x": range(10), "y": [v * v for v in range(10)], "g": list("ab") * 5}) base = alt.Chart(df).encode(x="x:Q", y="y:Q", color="g:N") chart = (base.mark_line() + base.mark_point()).properties(title="t") spec = chart.to_dict() # validates against the schema assert spec["$schema"].startswith("https://vega.github.io/schema/vega-lite/v6") assert len(spec["layer"]) == 2 try: alt.Chart(df).mark_point().encode(x="x:Q").properties(width="wide").to_dict() except jsonschema.ValidationError: pass else: raise AssertionError("invalid width accepted") chart.save("chart.html") assert "vegaEmbed" in open("chart.html").read() print("altair ok") PYEOF %files -n python3-%{pypi_name} -f %{pyproject_files} %license LICENSE %doc README.md %changelog * Fri Oct 16 2026 Morgan Hough - 6.3.0-1 - Initial package (pyAFQ dependency).