diff --git a/.readthedocs.yml b/.readthedocs.yml index ef7c8748bb9..0da5ada6cd2 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -7,9 +7,9 @@ version: 2 # Build documentation in the docs/ directory with Sphinx sphinx: - configuration: bindings/python/pydeck/docs/conf.py + configuration: bindings/pydeck/docs/conf.py # Optionally set the version of Python and requirements required to build your docs python: install: - - requirements: bindings/python/pydeck/requirements-dev.txt + - requirements: bindings/pydeck/requirements-dev.txt diff --git a/bindings/pydeck/LICENSE.txt b/bindings/pydeck/LICENSE.txt index f88b58ffb90..b088f35558d 100644 --- a/bindings/pydeck/LICENSE.txt +++ b/bindings/pydeck/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2019 Uber Technologies Inc. +Copyright (c) 2020 Uber Technologies Inc. All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/bindings/pydeck/docs/conf.py b/bindings/pydeck/docs/conf.py index 12d753d10a7..a76f0a9ca98 100644 --- a/bindings/pydeck/docs/conf.py +++ b/bindings/pydeck/docs/conf.py @@ -6,7 +6,7 @@ sys.path.insert(0, os.path.abspath('../')) project = u'pydeck' -copyright = u'2019, Uber Technologies, Inc.' +copyright = u'2020, Uber Technologies, Inc.' author = u'Andrew Duberstein' # The short X.Y version version = u'' @@ -32,7 +32,7 @@ ] texinfo_documents = [ (master_doc, 'pydeck', u'pydeck Documentation', - author, 'pydeck', 'One line description of project.', + author, 'pydeck', 'Python wrapper for deck.gl', 'Miscellaneous'), ] epub_title = project diff --git a/bindings/pydeck/docs/layer.rst b/bindings/pydeck/docs/layer.rst index 242fac936dc..810c427476e 100644 --- a/bindings/pydeck/docs/layer.rst +++ b/bindings/pydeck/docs/layer.rst @@ -57,7 +57,7 @@ HexagonLayer `__: layer = pdk.Layer( 'HexagonLayer', # `type` positional argument is here UK_ACCIDENTS_DATA, - get_position='[lng, lat]', + get_position=['lng', 'lat'], auto_highlight=True, elevation_scale=50, pickable=True, @@ -91,7 +91,7 @@ Try changing ``type`` above to ``ScatterplotLayer`` and add some layer = pdk.Layer( 'ScatterplotLayer', # Change the `type` positional argument here UK_ACCIDENTS_DATA, - get_position='[lng, lat]', + get_position=['lng', 'lat'], auto_highlight=True, get_radius=1000, # Radius is given in meters get_fill_color=[180, 0, 200, 140], # Set an RGBA value for fill diff --git a/bindings/pydeck/pydeck/bindings/deck.py b/bindings/pydeck/pydeck/bindings/deck.py index 97623b306dc..83b10e64ab5 100644 --- a/bindings/pydeck/pydeck/bindings/deck.py +++ b/bindings/pydeck/pydeck/bindings/deck.py @@ -55,6 +55,7 @@ def __init__( For more advanced usage, the user can pass a dict to configure more custom tooltip features. Documentation on this is available `in the hosted pydeck documentation `_. + .. _Deck: https://deck.gl/#/documentation/deckgl-api-reference/deck .. _gallery: @@ -129,7 +130,8 @@ def to_html( Returns ------- - str : Returns absolute path of the file + str + Returns absolute path of the file """ json_blob = self.to_json() f = deck_to_html( diff --git a/bindings/pydeck/pydeck/bindings/json_tools.py b/bindings/pydeck/pydeck/bindings/json_tools.py index 4e16eb172ee..b6e12ce7aed 100644 --- a/bindings/pydeck/pydeck/bindings/json_tools.py +++ b/bindings/pydeck/pydeck/bindings/json_tools.py @@ -14,6 +14,11 @@ def to_camel_case(snake_case): ----------- snake_case : str Snake-cased string (e.g., "snake_cased") to be converted to camel-case (e.g., "camelCase") + + Returns + ------- + str + Camel-cased (e.g., "camelCased") version of input string """ output_str = '' should_upper_case = False diff --git a/bindings/pydeck/pydeck/bindings/layer.py b/bindings/pydeck/pydeck/bindings/layer.py index 2de1c3aa194..acaed75aaad 100644 --- a/bindings/pydeck/pydeck/bindings/layer.py +++ b/bindings/pydeck/pydeck/bindings/layer.py @@ -50,7 +50,7 @@ def __init__( >>> layer = pydeck.Layer( >>> 'HexagonLayer', >>> UK_ACCIDENTS_DATA, - >>> get_position='[lng, lat]', + >>> get_position=['lng', 'lat'], >>> auto_highlight=True, >>> elevation_scale=50, >>> pickable=True, @@ -65,7 +65,7 @@ def __init__( >>> layer = pydeck.Layer( >>> 'HexagonLayer', >>> df, - >>> get_position='[lng, lat]', + >>> get_position=['lng', 'lat'], >>> auto_highlight=True, >>> elevation_scale=50, >>> pickable=True, diff --git a/bindings/pydeck/pydeck/data_utils/color_scales.py b/bindings/pydeck/pydeck/data_utils/color_scales.py index cd87e8c9c05..56b2cbb4702 100644 --- a/bindings/pydeck/pydeck/data_utils/color_scales.py +++ b/bindings/pydeck/pydeck/data_utils/color_scales.py @@ -7,7 +7,8 @@ def get_random_rgb(): Returns ------- - list of float : Random RGB array + list of float + Random RGB array """ return [round(random.random()*255) for _ in range(0, 3)] @@ -22,7 +23,8 @@ def assign_random_colors(data_vector): Returns ------- - collections.OrderedDict : Dictionary of random RGBA value per class, keyed on class + collections.OrderedDict + Dictionary of random RGBA value per class, keyed on class """ deduped_classes = list(set(data_vector)) classes = sorted([str(x) for x in deduped_classes]) diff --git a/bindings/pydeck/pydeck/data_utils/type_checking.py b/bindings/pydeck/pydeck/data_utils/type_checking.py index 6954dedf70e..7be594654eb 100644 --- a/bindings/pydeck/pydeck/data_utils/type_checking.py +++ b/bindings/pydeck/pydeck/data_utils/type_checking.py @@ -1,9 +1,14 @@ def is_pandas_df(obj): - """Check if an object is a Pandas dataframe + """Check if an object is a Pandas DataFrame The benefit here is that Pandas doesn't have to be included in the dependencies for pydeck The drawback of course is that the Pandas API might change and break this function + + Returns + ------- + bool + Returns True if object is a Pandas DataFrame and False otherwise """ return obj.__class__.__module__ == 'pandas.core.frame' and obj.to_records and obj.to_dict diff --git a/bindings/pydeck/pydeck/data_utils/viewport_helpers.py b/bindings/pydeck/pydeck/data_utils/viewport_helpers.py index c8f42d36408..b96531fe7ef 100644 --- a/bindings/pydeck/pydeck/data_utils/viewport_helpers.py +++ b/bindings/pydeck/pydeck/data_utils/viewport_helpers.py @@ -41,7 +41,8 @@ def geometric_mean(points): Returns ------- - tuple : The centroid of a list of points + tuple + The centroid of a list of points """ avg_x = sum([float(p[0]) for p in points]) / len(points) avg_y = sum([float(p[1]) for p in points]) / len(points) @@ -58,7 +59,8 @@ def get_bbox(points): Returns ------- - dict: Dictionary containing the top left and bottom right points of a bounding box + dict + Dictionary containing the top left and bottom right points of a bounding box """ xs = [p[0] for p in points] ys = [p[1] for p in points] @@ -83,7 +85,8 @@ def k_nearest_neighbors(points, center, k): Returns ------- - list: Index of the k furthest points + list + Index of the k furthest points Todo --- @@ -106,7 +109,8 @@ def get_n_pct(points, proportion=1): Returns ------- - list: k nearest data points + list + k nearest data points """ if proportion == 1: return points @@ -127,7 +131,8 @@ def bbox_to_zoom_level(bbox): Returns ------- - int : Zoom level of map in a WGS84 Mercator projection (e.g., like that of Google Maps) + int + Zoom level of map in a WGS84 Mercator projection (e.g., like that of Google Maps) """ lat_diff = max(bbox[0][0], bbox[1][0]) - min(bbox[0][0], bbox[1][0]) lng_diff = max(bbox[0][1], bbox[1][1]) - min(bbox[0][1], bbox[1][1]) @@ -158,7 +163,8 @@ def compute_view(points, view_proportion=1, view_type=ViewState): Returns ------- - pydeck.Viewport : Viewport fitted to the data + pydeck.Viewport + Viewport fitted to the data """ if is_pandas_df(points): points = points.to_records(index=False) diff --git a/scripts/bindings-precommit-hook.sh b/scripts/bindings-precommit-hook.sh index d152622c7fc..394f177544d 100755 --- a/scripts/bindings-precommit-hook.sh +++ b/scripts/bindings-precommit-hook.sh @@ -1,5 +1,5 @@ #!/bin/bash -IS_PYTHON=$(git diff --cached --name-only | grep "bindings/python/") +IS_PYTHON=$(git diff --cached --name-only | grep "python/pydeck") HAS_PYTEST=$(command -v pytest) if [[ -n "$IS_PYTHON" ]]; then