pydeck: Unlocking deck.gl for use in Python

Andrew Duberstein
vis.gl
Published in
3 min readOct 15, 2019

Uber’s open source deck.gl library powers both internal data visualization tools and brings to life award-winning visualizations from across the community.

Today, we’re excited to announce that we’ll be bringing deck.gl’s declarative syntax, the ease of use, and ability to render massive data to Python with the beta release of pydeck, a set of Python bindings for deck.gl. In this post, we’ll cover pydeck’s unique features, how it works beneath the hood, and how you can get started using it today.

The mission of pydeck is to let Python users create deck.gl maps without having to know a lot of Javascript. At its core, pydeck focuses on data analytics use cases, so it works best in environments used by data professionals, like Jupyter Notebooks. With pydeck, users can embed visualizations interactively in a Jupyter Notebook or simply export them to a standalone HTML file.

A few mapmaking libraries exist within the Python ecosystem, so it’s worth highlighting the unique features that pydeck provides which differentiate it:

  • The availability of the full deck.gl layer catalog in Python
  • Support for large-scale updates, like color changes or data modification, to hundreds of thousands of visualized data points
  • Two-way communication, where data selected in a visualization can be passed back to a Jupyter Notebook’s kernel
  • The ability to map hundreds of thousands of data points in 2D and 3D via a Python API
2010 San Francisco building polygons, colored by elevation

Under the hood, pydeck converts its Python objects to JSON and passes that JSON to the new @deck.gl/json API. This library interprets JSON objects into deck.gl layers, letting users render a visualization written in Javascript without having to know Javascript itself. Pydeck augments this by also providing components for Jupyter Notebook integration and convenience functions for data processing.

You can get started using pydeck with a simple copy and paste in your terminal:

pip install pydeck

To see pydeck in action, you can copy and paste this Python code into a Jupyter Notebook or an IPython terminal:

Go to the GitHub Gist for the full code

You can also check out the hosted examples on mybinder.org, where you can use pydeck in your browser without installing it. For further details while coding, review the documentation home page here.

Conway’s Game of Life in pydeck

You can file bugs and submit feature requests with our team on GitHub. Contributions are both welcome and encouraged, not only to improve pydeck but also to bindings for other languages via the @deck.gl/json library.

--

--