Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[Feat] Publish keplergl jupyter 0.1.0a5 (#572)
Shan Hec5620f99345e
diff --git a/bindings/kepler.gl-jupyter/.gitignore b/bindings/kepler.gl-jupyter/.gitignoreindex 8c733556e..867fd5aae 100644--- a/bindings/kepler.gl-jupyter/.gitignore+++ b/bindings/kepler.gl-jupyter/.gitignore@@ -22,6 +22,7 @@ notebooks/*.htmlnotebooks/*.shnotebooks/*.jsnotebooks/scratch_paper.ipynb+notebooks/ignore_**/*.tgzpackage/diff --git a/bindings/kepler.gl-jupyter/README.md b/bindings/kepler.gl-jupyter/README.mdindex 6829bbe1e..542e4c6ac 100644--- a/bindings/kepler.gl-jupyter/README.md+++ b/bindings/kepler.gl-jupyter/README.md@@ -113,7 +113,7 @@ Python 2Add [Mapbox access token](https://docs.mapbox.com/help/how-mapbox-works/access-tokens/) to Node env.```sh-export MapboxAccessToken=<your_mapbox_token>+export MapboxAccessTokenJupyter=<your_mapbox_token>```#### 3. Build js module, start a local server to watch for changesdiff --git a/bindings/kepler.gl-jupyter/js/lib/keplergl/components/app.js b/bindings/kepler.gl-jupyter/js/lib/keplergl/components/app.jsindex f44b9c48d..27554fc25 100644--- a/bindings/kepler.gl-jupyter/js/lib/keplergl/components/app.js+++ b/bindings/kepler.gl-jupyter/js/lib/keplergl/components/app.js@@ -47,7 +47,7 @@ const KeplerGl = injectComponents([[PanelHeaderFactory, CustomPanelHeaderFactory]]);-const MAPBOX_TOKEN = process.env.MapboxAccessToken; // eslint-disable-line+const MAPBOX_TOKEN = process.env.MapboxAccessTokenJupyter; // eslint-disable-lineclass App extends React.Component {render() {@@ -84,7 +84,7 @@ class App extends React.Component {width={width || 1200}height={height || 800}appName="Kepler.gl Jupyter"- version="0.0.1"+ version="0.1.0"/>)}</AutoSizer>diff --git a/bindings/kepler.gl-jupyter/js/lib/keplergl/components/panel-header.js b/bindings/kepler.gl-jupyter/js/lib/keplergl/components/panel-header.jsindex d7428a7ed..f578ff843 100644--- a/bindings/kepler.gl-jupyter/js/lib/keplergl/components/panel-header.js+++ b/bindings/kepler.gl-jupyter/js/lib/keplergl/components/panel-header.js@@ -21,7 +21,7 @@import {PanelHeaderFactory, Icons} from 'kepler.gl/components';// TODO: Move the doc to public repo-const KEPLER_DOC = 'https://github.com/uber/kepler.gl-jupyter/blob/master/README.md';+const KEPLER_DOC = 'https://github.com/keplergl/kepler.gl/blob/master/docs/keplergl-jupyter/user-guide.md';export function CustomPanelHeaderFactory() {const PanelHeader = PanelHeaderFactory();diff --git a/bindings/kepler.gl-jupyter/js/package.json b/bindings/kepler.gl-jupyter/js/package.jsonindex 8f532772d..90ddd9943 100644--- a/bindings/kepler.gl-jupyter/js/package.json+++ b/bindings/kepler.gl-jupyter/js/package.json@@ -81,7 +81,7 @@"dependencies": {"@jupyter-widgets/base": "^1.0.0","global": "^4.3.0",- "kepler.gl": "^1.0.0",+ "kepler.gl": "^1.1.1","react": "^16.8.4","react-dom": "^16.8.4","react-helmet": "^5.2.0",diff --git a/bindings/kepler.gl-jupyter/js/webpack/build-html.js b/bindings/kepler.gl-jupyter/js/webpack/build-html.jsindex 99ed60030..b2f002b10 100644--- a/bindings/kepler.gl-jupyter/js/webpack/build-html.js+++ b/bindings/kepler.gl-jupyter/js/webpack/build-html.js@@ -43,7 +43,7 @@ const VERSIONS = {keplergl: clearCarats(dependencies['kepler.gl'])}-const MAPBOX_TOKEN = process.env.MapboxAccessToken; // eslint-disable-line+const MAPBOX_TOKEN = process.env.MapboxAccessTokenJupyter; // eslint-disable-lineconst externals = [{react: 'React'},diff --git a/bindings/kepler.gl-jupyter/js/webpack/config.js b/bindings/kepler.gl-jupyter/js/webpack/config.jsindex b1c14e0f2..48d615e6d 100644--- a/bindings/kepler.gl-jupyter/js/webpack/config.js+++ b/bindings/kepler.gl-jupyter/js/webpack/config.js@@ -39,7 +39,7 @@ const rules = [];const plugins = [- new webpack.EnvironmentPlugin(['MapboxAccessToken'])+ new webpack.EnvironmentPlugin(['MapboxAccessTokenJupyter'])];module.exports = {diff --git a/bindings/kepler.gl-jupyter/keplergl/_version.py b/bindings/kepler.gl-jupyter/keplergl/_version.pyindex f4bd84c34..e943ce81c 100644--- a/bindings/kepler.gl-jupyter/keplergl/_version.py+++ b/bindings/kepler.gl-jupyter/keplergl/_version.py@@ -1,4 +1,4 @@-version_info = (0, 1, 0, 'alpha', 5)+version_info = (0, 1, 0, 'alpha', 6)_specifier_ = {'alpha': 'a', 'beta': 'b', 'candidate': 'rc', 'final': ''}diff --git a/bindings/kepler.gl-jupyter/keplergl/keplergl.py b/bindings/kepler.gl-jupyter/keplergl/keplergl.pyindex 2e8029f70..c59009a4d 100644--- a/bindings/kepler.gl-jupyter/keplergl/keplergl.py+++ b/bindings/kepler.gl-jupyter/keplergl/keplergl.py@@ -53,7 +53,8 @@ def data_to_json(data, manager):return Noneelse:if type(data) is not dict:- raise DataError('data type incorrect expecting a dictionary mapping from data id to value, but got {}'.format(type(data)))+ print data+ raise Exception('data type incorrect expecting a dictionary mapping from data id to value, but got {}'.format(type(data)))return Noneelse:dataset = {}@@ -166,7 +167,7 @@ class KeplerGl(widgets.DOMWidget):cmd = """window.__keplerglDataConfig = {};""".format(keplergl_data)frame_txt = keplergl_html[:k] + "<body><script>" + cmd + "</script>" + keplergl_html[k+6:]- with open(file_name,'w') as f:+ with open(file_name,'wb') as f:f.write(frame_txt.encode('utf-8'))print("Map saved to {}!".format(file_name))diff --git a/bindings/kepler.gl-jupyter/notebooks/GeoJSON.ipynb b/bindings/kepler.gl-jupyter/notebooks/GeoJSON.ipynbindex 12eee6ea7..38a1c8b8c 100644--- a/bindings/kepler.gl-jupyter/notebooks/GeoJSON.ipynb+++ b/bindings/kepler.gl-jupyter/notebooks/GeoJSON.ipynb@@ -2,7 +2,7 @@"cells": [{"cell_type": "code",- "execution_count": 3,+ "execution_count": 1,"metadata": {},"outputs": [{@@ -623,20 +623,20 @@},{"cell_type": "code",- "execution_count": 4,+ "execution_count": 2,"metadata": {},"outputs": [{"name": "stdout","output_type": "stream","text": [- "Documentation: https://github.com/keplergl/kepler.gl/blob/master/docs/keplergl-jupyter/user-guide.md\n"+ "User Guide: https://github.com/keplergl/kepler.gl/blob/master/docs/keplergl-jupyter/user-guide.md\n"]},{"data": {"application/vnd.jupyter.widget-view+json": {- "model_id": "bf11ff10635e4b738964a9a61c34b036",+ "model_id": "1e37c6ad65ec4f34a611fbdd1928fb3d","version_major": 2,"version_minor": 0},@@ -656,7 +656,7 @@},{"cell_type": "code",- "execution_count": 5,+ "execution_count": 3,"metadata": {},"outputs": [],"source": [@@ -665,19 +665,32 @@},{"cell_type": "code",- "execution_count": 6,+ "execution_count": 5,"metadata": {},"outputs": [{"name": "stdout","output_type": "stream","text": [- "Map saved to keplergl_map.html!\n"+ "geojson_map.html\n"+ ]+ },+ {+ "ename": "Exception",+ "evalue": "data type incorrect expecting a dictionary mapping from data id to value, but got <type 'str'>",+ "output_type": "error",+ "traceback": [+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",+ "\u001b[0;31mException\u001b[0m Traceback (most recent call last)",+ "\u001b[0;32m<ipython-input-5-b5d72a09ca54>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mmap_1\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msave_to_html\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"geojson_map.html\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",+ "\u001b[0;32m/Users/shanhe/Uber/kepler.gl/bindings/kepler.gl-jupyter/keplergl/keplergl.py\u001b[0m in \u001b[0;36msave_to_html\u001b[0;34m(self, data, config, file_name, read_only)\u001b[0m\n\u001b[1;32m 158\u001b[0m \u001b[0mk\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mkeplergl_html\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfind\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"<body>\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 159\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 160\u001b[0;31m \u001b[0mdata_to_add\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mdata\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mNone\u001b[0m \u001b[0;32melse\u001b[0m \u001b[0mdata_to_json\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 161\u001b[0m \u001b[0mconfig_to_add\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconfig\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mconfig\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mNone\u001b[0m \u001b[0;32melse\u001b[0m \u001b[0mconfig\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 162\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",+ "\u001b[0;32m/Users/shanhe/Uber/kepler.gl/bindings/kepler.gl-jupyter/keplergl/keplergl.py\u001b[0m in \u001b[0;36mdata_to_json\u001b[0;34m(data, manager)\u001b[0m\n\u001b[1;32m 55\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mtype\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mdict\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 56\u001b[0m \u001b[0;32mprint\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 57\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'data type incorrect expecting a dictionary mapping from data id to value, but got {}'\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtype\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 58\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 59\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",+ "\u001b[0;31mException\u001b[0m: data type incorrect expecting a dictionary mapping from data id to value, but got <type 'str'>"]}],"source": [- "map_1.save_to_html()"+ "map_1.save_to_html(file_name=\"geojson_map.html\")"]}],@@ -697,7 +710,7 @@"name": "python","nbconvert_exporter": "python","pygments_lexer": "ipython2",- "version": "2.7.15"+ "version": "2.7.16"}},"nbformat": 4,diff --git a/bindings/kepler.gl-jupyter/notebooks/Load kepler.gl.ipynb b/bindings/kepler.gl-jupyter/notebooks/Load kepler.gl.ipynbindex 6065ea337..37d01eaa1 100644--- a/bindings/kepler.gl-jupyter/notebooks/Load kepler.gl.ipynb+++ b/bindings/kepler.gl-jupyter/notebooks/Load kepler.gl.ipynb@@ -343,7 +343,7 @@"name": "python","nbconvert_exporter": "python","pygments_lexer": "ipython2",- "version": "2.7.15"+ "version": "2.7.16"},"widgets": {"application/vnd.jupyter.widget-state+json": {diff --git a/bindings/kepler.gl-jupyter/setup.py b/bindings/kepler.gl-jupyter/setup.pyindex a6beccc01..e1e462be3 100644--- a/bindings/kepler.gl-jupyter/setup.py+++ b/bindings/kepler.gl-jupyter/setup.py@@ -136,7 +136,7 @@ setup_args = {'keplergl/static/index.js','keplergl/static/index.js.map',],),- ('etc/jupyter/nbconfig/notebook.d/' ,['keplergl-jupyter.json'])+ ('etc/jupyter/nbconfig/notebook.d' ,['keplergl-jupyter.json'])],'install_requires': ['ipywidgets>=7.0.0,<8',