Skip to content

Commit 6853c81

Browse files
authored
chore(pydeck) update pydeck to use deck 9.1 and update documentation (#9361)
* point pydeck to deck 9.1 and update documentation * Update widget.rst * Update CHANGELOG.rst
1 parent 5643bb5 commit 6853c81

File tree

9 files changed

+32
-10
lines changed

9 files changed

+32
-10
lines changed

bindings/pydeck/docs/CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ Releases and associated GitHub PRs for pydeck are documented here.
66
0.9 Releases
77
------------
88

9+
0.9.2 - Jan XX 2025
10+
^^^^^^^^^^^^^^^^^^^
11+
- Update to deck.gl v9.1
12+
- Add support for deck.gl widgets (#9342)
13+
914
0.9.1 - May 10 2024
1015
^^^^^^^^^^^^^^^^^^^
1116
- Fix pydeck iframe height in Google Colab (#8881)

bindings/pydeck/docs/index.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ like plotting in flat plane instead of plotting on a mercator projection
6666

6767
Configure the lighting within a visualization.
6868

69+
`Widgets <widget.html>`__
70+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
71+
72+
Configure one of the many deck.gl UI widgets for displaying and controlling deck.gl state in pydeck.
73+
6974
.. note::
7075
The pydeck library assumes Internet access. You will need an Internet connection or the visualization will not render.
7176

@@ -99,6 +104,7 @@ Index
99104
view_state
100105
view
101106
light_settings
107+
widget
102108

103109
.. toctree::
104110
:maxdepth: 1

bindings/pydeck/docs/layer.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ Passing string constants
156156

157157
Strings most often in pydeck indicate a data set variable name, like ``lng`` or ``lat`` in the previous examples.
158158
Some pydeck arguments require a string constant, however.
159-
In order to indiciate to the library that you're passing a string constant, you must wrap your strings in the ``pydeck.String`` constructor.
159+
In order to indicate to the library that you're passing a string constant, you must wrap your strings in the ``pydeck.String`` constructor.
160160
For example, below
161161
we plot the mean of billions of dollars of profit per employee by passing ``'MEAN'`` to ``aggregation``,
162162
giving us the average for that statistic within an area:

bindings/pydeck/docs/widget.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ Widget
55
:members:
66
:undoc-members:
77
:show-inheritance:
8+
9+
The ``pydeck.Widget`` object follows the same convention as ``pydeck.Layer`` for styling keyword arguments and the ``type`` positional argument.
10+
Read `Understanding keyword arguments in pydeck layers <layer.html#understanding-keyword-arguments-in-pydeck-layers>`__ documentation for more information.

bindings/pydeck/examples/01 - Introduction.ipynb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,12 @@
124124
" pitch=40.5,\n",
125125
" bearing=-27.36)\n",
126126
"\n",
127-
"# Add a zoom control\n",
128-
"widget = pdk.Widget('ZoomWidget')\n",
127+
"# Add a compass and zoom control\n",
128+
"compass_widget = pdk.Widget('CompassWidget', placement='top-right')\n",
129+
"zoom_widget = pdk.Widget('ZoomWidget', placement='top-right')\n",
129130
"\n",
130131
"# Combined all of it and render a viewport\n",
131-
"r = pdk.Deck(layers=[layer], initial_view_state=view_state, widgets=[widget])\n",
132+
"r = pdk.Deck(layers=[layer], initial_view_state=view_state, widgets=[compass_widget, zoom_widget])\n",
132133
"r.show()"
133134
]
134135
},

bindings/pydeck/pydeck/bindings/widget.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,24 @@ class Widget(JSONMixin):
88
Represents a deck.gl widget, which are UI components around the WebGL2/WebGPU canvas
99
to offer controls and information for a better user experience.
1010
11+
Please see the deck.gl
12+
`Widget catalog <https://deck.gl/docs/api-reference/widgets/overview>`_
13+
to determine the particular parameters of your widget.
14+
1115
Parameters
1216
---------
1317
type : str, default None
14-
deck.gl widget to display, e.g., 'CompassWidget'
18+
deck.gl widget to display, e.g., ``CompassWidget``
1519
id : str, default None
1620
Unique name for widget
17-
placement : string, default 'top-left'
18-
Placement of the widget on the map. Options are 'top-left', 'top-right', 'bottom-left', 'bottom-right', and 'fill'.
21+
placement : str, default ``top-left``
22+
Placement of the widget on the map. Options are ``top-left``, ``top-right``, ``bottom-left``, ``bottom-right``, and ``fill``.
1923
Note that not all widgets support custom placement.
20-
view_id : string, default None
24+
view_id : str, default None
2125
ID of the view to which the widget should be added. The widget will be added to the default view if not specified.
2226
Note that not all widgets support custom view_id.
2327
**kwargs
24-
Any of the parameters passable to a deck.gl Widget
28+
Any of the parameters passable to a deck.gl widget.
2529
"""
2630

2731
def __init__(self, type, id=None, placement=None, view_id=None, **kwargs):
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
DECKGL_SEMVER = "~9.0.*"
1+
DECKGL_SEMVER = "~9.1.*"

bindings/pydeck/pydeck/io/html.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def convert_js_bool(py_bool):
3434
j2_loader = jinja2.FileSystemLoader(TEMPLATES_PATH)
3535
j2_env = jinja2.Environment(loader=j2_loader, trim_blocks=True)
3636
CDN_URL = "https://cdn.jsdelivr.net/npm/@deck.gl/jupyter-widget@{}/dist/index.js".format(DECKGL_SEMVER)
37+
CDN_CSS_URL = "https://cdn.jsdelivr.net/npm/@deck.gl/widgets@{}/dist/stylesheet.css".format(DECKGL_SEMVER)
3738

3839

3940
def cdn_picker(offline=False):
@@ -72,6 +73,7 @@ def render_json_to_html(
7273
google_maps_key=google_maps_key,
7374
json_input=json_input,
7475
deckgl_jupyter_widget_bundle=cdn_picker(offline=offline),
76+
deckgl_widget_css_url=CDN_CSS_URL,
7577
tooltip=convert_js_bool(tooltip),
7678
css_text=css_text,
7779
custom_libraries=custom_libraries,

bindings/pydeck/pydeck/io/templates/index.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css" />
1212
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" />
1313
{{ deckgl_jupyter_widget_bundle }}
14+
<link rel="stylesheet" href={{ deckgl_widget_css_url }} />
1415
<style>
1516
{{ css_text }}
1617
</style>

0 commit comments

Comments
 (0)