diff --git a/maplibre/map.py b/maplibre/map.py
index bc9fcc1..5a07b5f 100644
--- a/maplibre/map.py
+++ b/maplibre/map.py
@@ -51,7 +51,9 @@ class MapOptions(MapLibreBaseModel):
See [MapOptions](https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/MapOptions) for details.
"""
- model_config = ConfigDict(validate_assignment=True, extra="forbid", use_enum_values=False)
+ model_config = ConfigDict(
+ validate_assignment=True, extra="forbid", use_enum_values=False
+ )
antialias: bool = None
attribution_control: bool = Field(None, serialization_alias="attributionControl")
@@ -75,7 +77,9 @@ class MapOptions(MapLibreBaseModel):
min_zoom: int = Field(None, serialization_alias="minZoom")
pitch: Union[int, float] = None
scroll_zoom: bool = Field(None, serialization_alias="scrollZoom")
- style: Union[str, Carto, MapTiler, OpenFreeMap, dict, Basemap] = Field(Carto.DARK_MATTER, validate_default=True)
+ style: Union[str, Carto, MapTiler, OpenFreeMap, dict, Basemap] = Field(
+ Carto.DARK_MATTER, validate_default=True
+ )
zoom: Union[int, float] = None
@field_validator("style")
@@ -208,7 +212,7 @@ def add_source(self, id: str, source: Source | dict | gpd.GeoDataFrame) -> None:
id (str): The unique ID of the source.
source (Source | dict | gpd.GeoDataFrame): The source to be added to the map.
"""
- if GEOPANDAS is not None and isinstance(source, gpd.GeoDataFrame):
+ if GEOPANDAS and isinstance(source, gpd.GeoDataFrame):
source = SimpleFeatures(source).to_source()
if isinstance(source, Source):
@@ -257,7 +261,9 @@ def add_popup(self, layer_id: str, prop: str = None, template: str = None) -> No
"""
self.add_call("addPopup", layer_id, prop, template)
- def add_tooltip(self, layer_id: str, prop: str = None, template: str = None) -> None:
+ def add_tooltip(
+ self, layer_id: str, prop: str = None, template: str = None
+ ) -> None:
"""Add a tooltip to the map
Args:
@@ -337,7 +343,9 @@ def fit_bounds(
self.add_call("fitBounds", bounds, kwargs)
- def set_projection(self, type: str | ProjectionType | list = ProjectionType.GLOBE) -> None:
+ def set_projection(
+ self, type: str | ProjectionType | list = ProjectionType.GLOBE
+ ) -> None:
"""Set the projection of the map"""
self.add_call("setProjection", dict(type=type))
@@ -378,12 +386,18 @@ def to_html(self, title: str = "My Awesome Map", **kwargs) -> str:
"""
js_lib = read_internal_file("srcjs", "pywidget.js")
js_snippet = Template(js_template).render(data=json.dumps(self.to_dict()))
- css_file = "ipywidget.maplibre-geocoder.css" if self._geocoder_type == GeocoderType.MAPLIBRE else "pywidget.css"
+ css_file = (
+ "ipywidget.maplibre-geocoder.css"
+ if self._geocoder_type == GeocoderType.MAPLIBRE
+ else "pywidget.css"
+ )
css = read_internal_file("srcjs", css_file)
headers = [f""]
# Deck.GL headers
- add_deckgl_headers = "addDeckOverlay" in [item[0] for item in self._message_queue]
+ add_deckgl_headers = "addDeckOverlay" in [
+ item[0] for item in self._message_queue
+ ]
# TODO: Set version in constants
deckgl_headers = (
[
@@ -397,7 +411,9 @@ def to_html(self, title: str = "My Awesome Map", **kwargs) -> str:
)
# Mapbox Draw headers
- add_mapbox_draw_headers = "addMapboxDraw" in [item[0] for item in self._message_queue]
+ add_mapbox_draw_headers = "addMapboxDraw" in [
+ item[0] for item in self._message_queue
+ ]
# TODO: Set version in constants
mapbox_draw_headers = (
[
@@ -425,7 +441,9 @@ def save(self, filename: str = None, preview=True, **kwargs):
# -------------------------
# Plugins
# -------------------------
- def add_deck_layers(self, layers: list[dict | pdk.Layer], tooltip: str | dict = None) -> None:
+ def add_deck_layers(
+ self, layers: list[dict | pdk.Layer], tooltip: str | dict = None
+ ) -> None:
"""Add Deck.GL layers to the layer stack
Args:
@@ -436,7 +454,9 @@ def add_deck_layers(self, layers: list[dict | pdk.Layer], tooltip: str | dict =
layers = parse_deck_layers(layers)
self.add_call("addDeckOverlay", layers, tooltip)
- def set_deck_layers(self, layers: list[dict | pdk.Layer], tooltip: str | dict = None) -> None:
+ def set_deck_layers(
+ self, layers: list[dict | pdk.Layer], tooltip: str | dict = None
+ ) -> None:
"""Update Deck.GL layers
Args:
diff --git a/pyproject.toml b/pyproject.toml
index 74bee10..d58a099 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "maplibre"
-version = "0.3.5"
+version = "0.3.6"
description = "Python bindings for MapLibre GL JS"
authors = ["Stefan Kuethe "]
readme = "README.md"