{"id":6943,"library":"vegafusion","title":"VegaFusion","description":"VegaFusion provides server-side acceleration for the Vega visualization grammar, primarily designed to enhance Python libraries like Altair. It enables scaling interactive charts to large datasets by offloading data transformations from the browser to an efficient, multi-threaded Rust-based Python kernel. The library is currently at version 2.0.3 and maintains an active development and release cadence.","status":"active","version":"2.0.3","language":"en","source_language":"en","source_url":"https://github.com/vega/vegafusion","tags":["visualization","altair","vega","data-processing","scaling","jupyter","dataframe"],"install":[{"cmd":"pip install vegafusion altair","lang":"bash","label":"Install core library and Altair for common usage"}],"dependencies":[{"reason":"Required for the Python package.","package":"python","version":">=3.9"},{"reason":"Commonly used with VegaFusion for visualization; requires specific version for compatibility with VegaFusion 2.x.","package":"altair","version":"^5.5.0"},{"reason":"VegaFusion 2.0+ uses Narwhals as a general interface to DataFrames, reducing direct dependencies on pandas/pyarrow.","package":"narwhals","optional":false},{"reason":"Core dependency for Arrow data handling in VegaFusion 2.0+.","package":"arrow3-core","optional":false},{"reason":"Dependency for packaging utilities in VegaFusion 2.0+.","package":"packaging","optional":false}],"imports":[{"note":"Standard import for the VegaFusion library.","symbol":"vegafusion","correct":"import vegafusion as vf"},{"note":"As of VegaFusion 2.0, Altair integration logic has been upstreamed. Use Altair's data transformers directly. `vf.save()` and `vf.transformed_data()` are also removed in favor of Altair's native methods when the transformer is enabled.","wrong":"import vegafusion as vf; vf.enable()","symbol":"enable/save/transformed_data (for Altair)","correct":"import altair as alt\nalt.data_transformers.enable('vegafusion')"}],"quickstart":{"code":"import altair as alt\nfrom vega_datasets import data\n\n# Enable the VegaFusion data transformer within Altair\nalt.data_transformers.enable('vegafusion')\n\n# Example Altair chart that benefits from VegaFusion's server-side processing\nsource = data.flights.url\n\nchart = alt.Chart(source).mark_bar().encode(\n    x=alt.X('distance:Q', bin=True),\n    y='count()'\n).properties(title='Flight Distance Histogram (Accelerated by VegaFusion)')\n\n# To display the chart in a Jupyter environment:\nchart\n\n# To save the chart with transformed data (using Altair's native save method):\n# chart.save('flight_histogram.json')","lang":"python","description":"This quickstart demonstrates how to enable VegaFusion for Altair visualizations. As of VegaFusion 2.0, the integration is handled by enabling Altair's built-in 'vegafusion' data transformer. This allows Altair charts to automatically offload data-intensive operations to the VegaFusion backend."},"warnings":[{"fix":"Instead of `import vegafusion as vf; vf.enable()`, use `import altair as alt; alt.data_transformers.enable('vegafusion')`. For saving or extracting transformed data, use Altair's native `chart.save()` or `chart.to_dict()` methods after enabling the transformer.","message":"VegaFusion 2.0 removed the `vegafusion-jupyter` package and direct Altair integration methods (like `vf.enable()`, `vf.save()`, `vf.transformed_data()`) from the `vegafusion` package. These functionalities are now handled directly by Altair's built-in 'vegafusion' data transformer.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Ensure Altair is updated to `altair>=5.5.0` using `pip install altair>=5.5.0`.","message":"VegaFusion 2.0 requires Altair version 5.5.0 or higher for full compatibility. Older Altair versions may not work or exhibit unexpected behavior.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Review your data handling. If you require `pandas` or `pyarrow` for other parts of your workflow, ensure they are still installed. VegaFusion 2.0 supports any Narwhals-compatible DataFrame type or objects supporting the Arrow PyCapsule interface for zero-copy data transfer.","message":"VegaFusion 2.0 significantly reduced its Python dependencies. `pyarrow` and `pandas` are no longer required, instead relying on `narwhals` for DataFrame compatibility and `arrow3-core` for Arrow data. Existing code heavily dependent on `pyarrow` or `pandas` might need adjustments if not explicitly installed alongside.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Customize VegaFusion's local timezone using `vegafusion.set_local_tz(\"Your/Timezone\")` at the beginning of your session to ensure consistent time interpretation.","message":"When working in cloud notebook environments, VegaFusion's local timezone might differ from the browser's. This can lead to discrepancies in date/time-based visualizations or transformations.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}