diff --git a/docs/api/viz.md b/docs/api/viz.md index 5ea6713a..50175825 100644 --- a/docs/api/viz.md +++ b/docs/api/viz.md @@ -4,6 +4,6 @@ The top-level namespace accessible after `import lonboard`. Layers are also accessible in the top-level namespace, but are documented in the `layers/` folder. -::: lonboard.viz.viz +::: lonboard.viz options: show_root_full_path: false diff --git a/lonboard/__init__.py b/lonboard/__init__.py index 5832dae3..a9ae70c5 100644 --- a/lonboard/__init__.py +++ b/lonboard/__init__.py @@ -1,3 +1,5 @@ +from . import colormap, traits +from ._layer import PathLayer, ScatterplotLayer, SolidPolygonLayer +from ._map import Map from ._version import __version__ -from .layer import PathLayer, ScatterplotLayer, SolidPolygonLayer -from .viz import viz +from ._viz import viz diff --git a/lonboard/constants.py b/lonboard/_constants.py similarity index 100% rename from lonboard/constants.py rename to lonboard/_constants.py diff --git a/lonboard/geoarrow/__init__.py b/lonboard/_geoarrow/__init__.py similarity index 100% rename from lonboard/geoarrow/__init__.py rename to lonboard/_geoarrow/__init__.py diff --git a/lonboard/geoarrow/extension_types.py b/lonboard/_geoarrow/extension_types.py similarity index 100% rename from lonboard/geoarrow/extension_types.py rename to lonboard/_geoarrow/extension_types.py diff --git a/lonboard/geoarrow/geopandas_interop.py b/lonboard/_geoarrow/geopandas_interop.py similarity index 88% rename from lonboard/geoarrow/geopandas_interop.py rename to lonboard/_geoarrow/geopandas_interop.py index c446937b..2a899cd1 100644 --- a/lonboard/geoarrow/geopandas_interop.py +++ b/lonboard/_geoarrow/geopandas_interop.py @@ -4,7 +4,7 @@ import numpy as np import pyarrow as pa -from lonboard.geoarrow.extension_types import construct_geometry_array +from lonboard._geoarrow.extension_types import construct_geometry_array def geopandas_to_geoarrow( diff --git a/lonboard/geoarrow/ops/__init__.py b/lonboard/_geoarrow/ops/__init__.py similarity index 100% rename from lonboard/geoarrow/ops/__init__.py rename to lonboard/_geoarrow/ops/__init__.py diff --git a/lonboard/geoarrow/ops/bbox.py b/lonboard/_geoarrow/ops/bbox.py similarity index 98% rename from lonboard/geoarrow/ops/bbox.py rename to lonboard/_geoarrow/ops/bbox.py index bfea7288..ed54cf03 100644 --- a/lonboard/geoarrow/ops/bbox.py +++ b/lonboard/_geoarrow/ops/bbox.py @@ -10,7 +10,7 @@ import numpy as np import pyarrow as pa -from lonboard.constants import EXTENSION_NAME +from lonboard._constants import EXTENSION_NAME @dataclass diff --git a/lonboard/geoarrow/ops/centroid.py b/lonboard/_geoarrow/ops/centroid.py similarity index 98% rename from lonboard/geoarrow/ops/centroid.py rename to lonboard/_geoarrow/ops/centroid.py index ec392138..59654274 100644 --- a/lonboard/geoarrow/ops/centroid.py +++ b/lonboard/_geoarrow/ops/centroid.py @@ -8,7 +8,7 @@ import numpy as np import pyarrow as pa -from lonboard.constants import EXTENSION_NAME +from lonboard._constants import EXTENSION_NAME @dataclass diff --git a/lonboard/layer.py b/lonboard/_layer.py similarity index 98% rename from lonboard/layer.py rename to lonboard/_layer.py index dbd6aaee..3c9d6815 100644 --- a/lonboard/layer.py +++ b/lonboard/_layer.py @@ -8,11 +8,11 @@ import traitlets from anywidget import AnyWidget -from lonboard.constants import EPSG_4326, EXTENSION_NAME, OGC_84 -from lonboard.geoarrow.geopandas_interop import geopandas_to_geoarrow -from lonboard.serialization import infer_rows_per_chunk +from lonboard._constants import EPSG_4326, EXTENSION_NAME, OGC_84 +from lonboard._geoarrow.geopandas_interop import geopandas_to_geoarrow +from lonboard._serialization import infer_rows_per_chunk +from lonboard._viewport import compute_view from lonboard.traits import ColorAccessor, FloatAccessor, PyarrowTableTrait -from lonboard.viewport import compute_view # bundler yields lonboard/static/{index.js,styles.css} bundler_output_dir = Path(__file__).parent / "static" diff --git a/lonboard/widget.py b/lonboard/_map.py similarity index 93% rename from lonboard/widget.py rename to lonboard/_map.py index 637985d2..de30a2ca 100644 --- a/lonboard/widget.py +++ b/lonboard/_map.py @@ -6,7 +6,7 @@ import ipywidgets import traitlets -from lonboard.layer import BaseLayer +from lonboard._layer import BaseLayer # bundler yields lonboard/static/{index.js,styles.css} bundler_output_dir = Path(__file__).parent / "static" diff --git a/lonboard/serialization.py b/lonboard/_serialization.py similarity index 100% rename from lonboard/serialization.py rename to lonboard/_serialization.py diff --git a/lonboard/_testing.py b/lonboard/_testing.py index 1f7ce5d1..43cea213 100644 --- a/lonboard/_testing.py +++ b/lonboard/_testing.py @@ -2,7 +2,7 @@ """ import pyarrow.feather as feather -from lonboard.layer import BaseLayer +from lonboard._layer import BaseLayer def export_widget(widget: BaseLayer, path: str): diff --git a/lonboard/utils.py b/lonboard/_utils.py similarity index 92% rename from lonboard/utils.py rename to lonboard/_utils.py index 0409601c..f30fe1be 100644 --- a/lonboard/utils.py +++ b/lonboard/_utils.py @@ -1,6 +1,6 @@ import pyarrow as pa -from lonboard.constants import EXTENSION_NAME +from lonboard._constants import EXTENSION_NAME GEOARROW_EXTENSION_TYPE_NAMES = {e.value for e in EXTENSION_NAME} diff --git a/lonboard/viewport.py b/lonboard/_viewport.py similarity index 90% rename from lonboard/viewport.py rename to lonboard/_viewport.py index 91e51161..f697e373 100644 --- a/lonboard/viewport.py +++ b/lonboard/_viewport.py @@ -12,9 +12,9 @@ import pyarrow as pa -from lonboard.geoarrow.ops.bbox import Bbox, total_bounds -from lonboard.geoarrow.ops.centroid import WeightedCentroid, weighted_centroid -from lonboard.utils import get_geometry_column_index +from lonboard._geoarrow.ops.bbox import Bbox, total_bounds +from lonboard._geoarrow.ops.centroid import WeightedCentroid, weighted_centroid +from lonboard._utils import get_geometry_column_index def get_bbox_center(table: pa.Table) -> Tuple[Bbox, WeightedCentroid]: diff --git a/lonboard/viz.py b/lonboard/_viz.py similarity index 96% rename from lonboard/viz.py rename to lonboard/_viz.py index ce925bab..0170e3f5 100644 --- a/lonboard/viz.py +++ b/lonboard/_viz.py @@ -13,10 +13,10 @@ import shapely.geometry.base from numpy.typing import NDArray -from lonboard.constants import EPSG_4326, EXTENSION_NAME, OGC_84 -from lonboard.geoarrow.extension_types import construct_geometry_array -from lonboard.geoarrow.geopandas_interop import geopandas_to_geoarrow -from lonboard.layer import PathLayer, ScatterplotLayer, SolidPolygonLayer +from lonboard._constants import EPSG_4326, EXTENSION_NAME, OGC_84 +from lonboard._geoarrow.extension_types import construct_geometry_array +from lonboard._geoarrow.geopandas_interop import geopandas_to_geoarrow +from lonboard._layer import PathLayer, ScatterplotLayer, SolidPolygonLayer if TYPE_CHECKING: import geopandas as gpd diff --git a/lonboard/traits.py b/lonboard/traits.py index 0d4f699d..a07f3995 100644 --- a/lonboard/traits.py +++ b/lonboard/traits.py @@ -17,7 +17,7 @@ from traitlets.utils.descriptions import class_of, describe from typing_extensions import Self -from lonboard.serialization import ( +from lonboard._serialization import ( COLOR_SERIALIZATION, FLOAT_SERIALIZATION, TABLE_SERIALIZATION, diff --git a/tests/test_layer.py b/tests/test_layer.py index 2ee40d33..36424ee3 100644 --- a/tests/test_layer.py +++ b/tests/test_layer.py @@ -4,7 +4,7 @@ import shapely from traitlets import TraitError -from lonboard.layer import ScatterplotLayer +from lonboard import ScatterplotLayer def test_accessor_length_validation():