Skip to content

Commit 2409608

Browse files
authored
Fix import when pandas/pyarrow not installed (#678)
## Available PR templates <!-- Github doesn't allow PR template selection the same way that it is possible with issues. Preview this and select the appropriate template --> - [Default](?expand=1&template=default.md) - [Version Release](?expand=1&template=version_release.md) - _Alternatively delete and start empty_
1 parent 8202ca5 commit 2409608

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

Diff for: CHANGELOG.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [0.10.1] - 2024-10-08
4+
5+
### Fixes :bug:
6+
7+
- Fix import when pandas not installed.
8+
39
## [0.10.0] - 2024-10-07
410

511
### New! :sparkles:
@@ -29,7 +35,7 @@
2935
- Fix reading from DuckDB with only geometry column by @kylebarron in https://github.com/developmentseed/lonboard/pull/625
3036
- Fix attribution by @vgeorge in https://github.com/developmentseed/lonboard/pull/561
3137

32-
## New Contributors
38+
### New Contributors
3339

3440
- @MarcSkovMadsen made their first contribution in https://github.com/developmentseed/lonboard/pull/539
3541
- @ATL2001 made their first contribution in https://github.com/developmentseed/lonboard/pull/655

Diff for: lonboard/types/layer.py

+16-13
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import sys
44
from typing import (
5+
TYPE_CHECKING,
56
List,
67
Literal,
78
Sequence,
@@ -10,8 +11,6 @@
1011
)
1112

1213
import numpy as np
13-
import pandas as pd
14-
import pyarrow
1514
from arro3.core.types import ArrowArrayExportable, ArrowStreamExportable
1615
from numpy.typing import NDArray
1716

@@ -22,6 +21,10 @@
2221
else:
2322
from typing_extensions import TypedDict
2423

24+
if TYPE_CHECKING:
25+
import pandas as pd
26+
import pyarrow
27+
2528

2629
IntFloat = Union[int, float]
2730
Units = Literal["meters", "common", "pixels"]
@@ -32,18 +35,18 @@
3235
Tuple[int, ...],
3336
str,
3437
NDArray[np.uint8],
35-
pyarrow.FixedSizeListArray,
36-
pyarrow.ChunkedArray,
38+
"pyarrow.FixedSizeListArray",
39+
"pyarrow.ChunkedArray",
3740
ArrowArrayExportable,
3841
ArrowStreamExportable,
3942
]
4043
FloatAccessorInput = Union[
4144
int,
4245
float,
4346
NDArray[np.number],
44-
pd.Series,
45-
pyarrow.FloatingPointArray,
46-
pyarrow.ChunkedArray,
47+
"pd.Series",
48+
"pyarrow.FloatingPointArray",
49+
"pyarrow.ChunkedArray",
4750
ArrowArrayExportable,
4851
ArrowStreamExportable,
4952
]
@@ -52,18 +55,18 @@
5255
Tuple[int, int, int],
5356
Tuple[int, ...],
5457
NDArray[np.floating],
55-
pyarrow.FixedSizeListArray,
56-
pyarrow.ChunkedArray,
58+
"pyarrow.FixedSizeListArray",
59+
"pyarrow.ChunkedArray",
5760
ArrowArrayExportable,
5861
ArrowStreamExportable,
5962
]
6063
TextAccessorInput = Union[
6164
str,
6265
NDArray[np.str_],
63-
pd.Series,
64-
pyarrow.StringArray,
65-
pyarrow.LargeStringArray,
66-
pyarrow.ChunkedArray,
66+
"pd.Series",
67+
"pyarrow.StringArray",
68+
"pyarrow.LargeStringArray",
69+
"pyarrow.ChunkedArray",
6770
ArrowArrayExportable,
6871
ArrowStreamExportable,
6972
]

0 commit comments

Comments
 (0)