chart_spec = py`# start with a fake dependency on the libraries being installed:
# ${deps_installed}
# now the basic altair example:
import altair as alt
import json
from vega_datasets import data
cars = data.cars.url
chart = alt.Chart(cars).mark_point().encode(
x=alt.X('Horsepower:Q', scale=alt.Scale(domain=[0, ${max_horsepower}])),
y='Miles_per_Gallon:Q',
color='Origin:N',
).interactive()
# this outputs Map, not Object:
# chart.to_dict()
# which, we could probably correct for directly
# for now, we'll take the hit of encoding and recoding it to JSON:
json.dumps(chart.to_dict())`