dev-docs/RFCs/v7.2/python-integration-rfc.md
This RFC proposes adding a minimal official Python integration to deck.gl, focusing on Jupyter notebook support.
Improved support for data science and machine learning visualization is a focus area for deck.gl, and deck.gl is already very useful for geospatial visualizations in these contexts. Many data scientists work in Python and being able to effortlessly visualize data generated by libraries like numpy and pandas directly from the notebook is very valuable.
By providing a set of very simple bindings, focusing on overcoming the most basic integration issues and exposing a reasonable subset of the deck.gl API, we should be able to provide significantly increase adoption and value of deck.gl in these areas.
Offering such an integration clearly makes sense, as long as we can do it with low effort and maintenance cost.
Normally, exposing an API in a new language requires porting that API to the new language, which can be a significant undertaking, creating a large set of class and function "wrappers" that glue to the original code, with associated maintenance costs.
However, deck.gl now supports a JSON API API Reference (demo.
The JSON API makes it possible for users to specify deck.gl layers and access a large subset of deck.gl's functionality without directly using the deck.gl JavaScript API, making it an ideal API entry point to expose in other languages.
The idea is thus to create a minimal binding in Python that allows a python application to generate a JSON payload compatible with the deck.gl API and then start an inline frame running deck.gl rendering that JSON payload.
The JSON API is a pass-through of the underlying layer APIs. In fact, the JSON API allows the app to register layers imported from modules. Thus, the exposed API will change if the deck.gl layer APIs change.
This fits with the spirit that the official Python API matches the official deck.gl API.
The JSON API does not support everything. Some issues are already on the "roadmap" for the json module:
Others reflect generally useful features that are not yet supported by the deck.gl core:
One option is that it could make sense to build things like tooltip support and support for time into the core deck.gl library, in which case these would be easy to expose through JSON. This fits with the platform spirit where we solve application problems in a reusable way.
To minimize initial effort and long-term maintenance, we want to keep the scope very limited and focus on solving core problems such as:
Primary goals:
Secondary goals:
deck.gl should not include a major Python port of its API (e.g. a big Python class library that mirrors all deck.gl layers). That would represent too big a distraction to the core deck.gl mission.
We should leave such work to the Python community, and instead encourage, support and promote such efforts as they happen. Thus, we'd encourage independent deck.gl/Python integration libraries build on our official "minimal" integration and try to support them if they have issues.
External python deck.gl; integration libraries could either use it as a python dependency, or alternatively, they could just use it as an springboard to get started, perhaps forking it to help them solve some of the basic Python/JavaScript integration issues.
Starting up a JavaScript cell in Notebook can be done in (at least) two different ways:
(Dynamically) generated JavaScript app
iframe linking to published app
x* We do not currently publish the JSON module as part of the standalone bundle in 6.4. In 7.0 we plan to publish a master bundle (deckgl.min.js) as well as individual bundles for each submodule.
The solution will be loading pre-bundled deck.gl from CDN.
Controlling size of deck.gl visualization
Continuous Updates?
Two-way Communication?
Efficient/Binary Data Transfer
WebGL Context Reuse
bindings/python?)TBA
https://www.stefaanlippens.net/jupyter-custom-d3-visualization.html
Minimal integrations for other languages? Especially languages that run in Notebooks?
See the mapdeck integration for R.