From f50c4d496ce9831337ab6dd5be1e7e0b931d1900 Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Tue, 6 Feb 2024 11:01:10 +0100 Subject: [PATCH 1/5] Add examples --- .examples/earthquakes_cluster/app.py | 3 +-- .examples/experimental/app2.py | 3 +-- .examples/experimental/flights.py | 10 ++++++++-- .examples/h3_hexagons/app.py | 13 +++---------- .examples/motor_vehicle_collisions/app.py | 2 +- .examples/text_layer/app.py | 3 +-- docs/examples/every_person_in_manhattan/app.py | 11 ++--------- maplibre/server.py | 8 ++------ 8 files changed, 19 insertions(+), 34 deletions(-) diff --git a/.examples/earthquakes_cluster/app.py b/.examples/earthquakes_cluster/app.py index cfead397..ac7ac004 100644 --- a/.examples/earthquakes_cluster/app.py +++ b/.examples/earthquakes_cluster/app.py @@ -1,8 +1,7 @@ -from shiny import App, reactive, ui - from maplibre import Layer, Map, MapOptions, output_maplibregl, render_maplibregl from maplibre.basemaps import Carto from maplibre.sources import GeoJSONSource +from shiny import App, reactive, ui SOURCE_ID = "earthquakes" LAYER_ID = "earthquakes" diff --git a/.examples/experimental/app2.py b/.examples/experimental/app2.py index 7bd84718..4475eeb9 100644 --- a/.examples/experimental/app2.py +++ b/.examples/experimental/app2.py @@ -1,6 +1,4 @@ import requests as req -from shiny import App, reactive, render, ui - from maplibre import ( Layer, LayerType, @@ -11,6 +9,7 @@ ) from maplibre.basemaps import Carto from maplibre.experimental import LineLayer +from shiny import App, reactive, render, ui LAYER_ID = "counties" LAYER_ID_LINE = "us-states-line" diff --git a/.examples/experimental/flights.py b/.examples/experimental/flights.py index 5026d750..24e783b6 100644 --- a/.examples/experimental/flights.py +++ b/.examples/experimental/flights.py @@ -2,8 +2,14 @@ import pandas as pd import shapely -from maplibre import (Layer, LayerType, Map, MapContext, output_maplibregl, - render_maplibregl) +from maplibre import ( + Layer, + LayerType, + Map, + MapContext, + output_maplibregl, + render_maplibregl, +) from maplibre.basemaps import Carto from maplibre.utils import GeometryType, df_to_geojson from shiny import App, reactive, ui diff --git a/.examples/h3_hexagons/app.py b/.examples/h3_hexagons/app.py index d621dd23..1ef8a02c 100644 --- a/.examples/h3_hexagons/app.py +++ b/.examples/h3_hexagons/app.py @@ -1,18 +1,11 @@ import h3 import pandas as pd -from shiny import App, reactive, ui - # import shapely -from maplibre import ( - Layer, - LayerType, - Map, - MapContext, - output_maplibregl, - render_maplibregl, -) +from maplibre import (Layer, LayerType, Map, MapContext, output_maplibregl, + render_maplibregl) from maplibre.basemaps import Carto from maplibre.utils import GeometryType, df_to_geojson, get_bounds +from shiny import App, reactive, ui LAYER_ID = "motor_vehicle_collisions" diff --git a/.examples/motor_vehicle_collisions/app.py b/.examples/motor_vehicle_collisions/app.py index 50df99ea..a197d634 100644 --- a/.examples/motor_vehicle_collisions/app.py +++ b/.examples/motor_vehicle_collisions/app.py @@ -1,6 +1,5 @@ import h3 import pandas as pd -from shiny import App, reactive, ui # import shapely from maplibre import ( @@ -13,6 +12,7 @@ ) from maplibre.basemaps import Carto from maplibre.utils import GeometryType, df_to_geojson, get_bounds +from shiny import App, reactive, ui LAYER_ID = "motor_vehicle_collisions" diff --git a/.examples/text_layer/app.py b/.examples/text_layer/app.py index cf4fab75..044bd919 100644 --- a/.examples/text_layer/app.py +++ b/.examples/text_layer/app.py @@ -1,5 +1,4 @@ -from maplibre import (Layer, LayerType, Map, output_maplibregl, - render_maplibregl) +from maplibre import Layer, LayerType, Map, output_maplibregl, render_maplibregl from maplibre.basemaps import Carto from shiny import App, reactive, render, ui diff --git a/docs/examples/every_person_in_manhattan/app.py b/docs/examples/every_person_in_manhattan/app.py index 164ef77f..b429cb90 100644 --- a/docs/examples/every_person_in_manhattan/app.py +++ b/docs/examples/every_person_in_manhattan/app.py @@ -2,15 +2,8 @@ import pandas as pd import shapely -from maplibre import ( - Layer, - LayerType, - Map, - MapContext, - MapOptions, - output_maplibregl, - render_maplibregl, -) +from maplibre import (Layer, LayerType, Map, MapContext, MapOptions, + output_maplibregl, render_maplibregl) from maplibre.basemaps import Carto from maplibre.controls import ScaleControl from maplibre.sources import GeoJSONSource diff --git a/maplibre/server.py b/maplibre/server.py index 165932ae..b4827073 100644 --- a/maplibre/server.py +++ b/maplibre/server.py @@ -1,11 +1,7 @@ from __future__ import annotations -from shiny.render.transformer import ( - TransformerMetadata, - ValueFn, - output_transformer, - resolve_value_fn, -) +from shiny.render.transformer import (TransformerMetadata, ValueFn, + output_transformer, resolve_value_fn) from shiny.session import get_current_session from .map import Map From a61b684e3dc1a41a250dd51256ca9c4caa3cba93 Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Tue, 6 Feb 2024 11:43:17 +0100 Subject: [PATCH 2/5] isort --- .examples/experimental/app2.py | 10 ++-------- docs/examples/every_person_in_manhattan/app.py | 11 +++++++++-- maplibre/server.py | 8 ++++++-- pyproject.toml | 2 +- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.examples/experimental/app2.py b/.examples/experimental/app2.py index 4475eeb9..8a9cee39 100644 --- a/.examples/experimental/app2.py +++ b/.examples/experimental/app2.py @@ -1,12 +1,6 @@ import requests as req -from maplibre import ( - Layer, - LayerType, - Map, - MapContext, - output_maplibregl, - render_maplibregl, -) +from maplibre import (Layer, LayerType, Map, MapContext, output_maplibregl, + render_maplibregl) from maplibre.basemaps import Carto from maplibre.experimental import LineLayer from shiny import App, reactive, render, ui diff --git a/docs/examples/every_person_in_manhattan/app.py b/docs/examples/every_person_in_manhattan/app.py index b429cb90..164ef77f 100644 --- a/docs/examples/every_person_in_manhattan/app.py +++ b/docs/examples/every_person_in_manhattan/app.py @@ -2,8 +2,15 @@ import pandas as pd import shapely -from maplibre import (Layer, LayerType, Map, MapContext, MapOptions, - output_maplibregl, render_maplibregl) +from maplibre import ( + Layer, + LayerType, + Map, + MapContext, + MapOptions, + output_maplibregl, + render_maplibregl, +) from maplibre.basemaps import Carto from maplibre.controls import ScaleControl from maplibre.sources import GeoJSONSource diff --git a/maplibre/server.py b/maplibre/server.py index b4827073..165932ae 100644 --- a/maplibre/server.py +++ b/maplibre/server.py @@ -1,7 +1,11 @@ from __future__ import annotations -from shiny.render.transformer import (TransformerMetadata, ValueFn, - output_transformer, resolve_value_fn) +from shiny.render.transformer import ( + TransformerMetadata, + ValueFn, + output_transformer, + resolve_value_fn, +) from shiny.session import get_current_session from .map import Map diff --git a/pyproject.toml b/pyproject.toml index 43e3cd7d..2b6437c3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,7 @@ geopandas = "^0.14.2" all = ["pandas", "geopandas"] [tool.black] -line-lenght = 130 +line-lenght = 120 [build-system] requires = ["poetry-core"] From de11d175e43508f84b45ada2bfe9c31d327313d3 Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Tue, 6 Feb 2024 11:43:53 +0100 Subject: [PATCH 3/5] Update example --- .examples/experimental/app2.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.examples/experimental/app2.py b/.examples/experimental/app2.py index ae00f5ea..06aca3b2 100644 --- a/.examples/experimental/app2.py +++ b/.examples/experimental/app2.py @@ -1,6 +1,12 @@ import requests as req -from maplibre import (Layer, LayerType, Map, MapContext, output_maplibregl, - render_maplibregl) +from maplibre import ( + Layer, + LayerType, + Map, + MapContext, + output_maplibregl, + render_maplibregl, +) from maplibre.basemaps import Carto from maplibre.experimental import LineLayer from shiny import App, reactive, render, ui From e1f15c89a12794ea5e1dac55e4c82f7178acf398 Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Tue, 6 Feb 2024 11:47:52 +0100 Subject: [PATCH 4/5] Update README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 907a0ced..b72fcac2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # MapLibre for Python [![Release](https://img.shields.io/github/v/release/eodaGmbH/py-maplibregl)](https://img.shields.io/github/v/release/eodaGmbH/py-maplibregl) +[![pypi](https://img.shields.io/pypi/v/maplibre.svg)](https://pypi.python.org/pypi/maplibre) [![Build status](https://img.shields.io/github/actions/workflow/status/eodaGmbH/py-maplibregl/pytest.yml?branch=main)](https://img.shields.io/github/actions/workflow/status/eodaGmbH/py-maplibregl/pytest.yml?branch=main) [![License](https://img.shields.io/github/license/eodaGmbH/py-maplibregl)](https://img.shields.io/github/license/eodaGmbH/py-maplibregl) From 39ca7e5a5b664e0341b4592451665ce5ae291f94 Mon Sep 17 00:00:00 2001 From: Stefan Kuethe Date: Tue, 6 Feb 2024 11:57:02 +0100 Subject: [PATCH 5/5] Update examples --- .examples/experimental/app2.py | 10 ++++++++-- docs/examples/airports/app.py | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.examples/experimental/app2.py b/.examples/experimental/app2.py index ae00f5ea..06aca3b2 100644 --- a/.examples/experimental/app2.py +++ b/.examples/experimental/app2.py @@ -1,6 +1,12 @@ import requests as req -from maplibre import (Layer, LayerType, Map, MapContext, output_maplibregl, - render_maplibregl) +from maplibre import ( + Layer, + LayerType, + Map, + MapContext, + output_maplibregl, + render_maplibregl, +) from maplibre.basemaps import Carto from maplibre.experimental import LineLayer from shiny import App, reactive, render, ui diff --git a/docs/examples/airports/app.py b/docs/examples/airports/app.py index 68cfcdeb..d754a3ba 100644 --- a/docs/examples/airports/app.py +++ b/docs/examples/airports/app.py @@ -1,8 +1,14 @@ import sys import pandas as pd -from maplibre import (Layer, LayerType, Map, MapOptions, output_maplibregl, - render_maplibregl) +from maplibre import ( + Layer, + LayerType, + Map, + MapOptions, + output_maplibregl, + render_maplibregl, +) from maplibre.basemaps import Carto from maplibre.controls import Marker, MarkerOptions, Popup, PopupOptions from maplibre.sources import GeoJSONSource