Skip to content

Commit bb4d0e6

Browse files
pjonssongadomski
authored andcommitted
Remove unused pystac.validation import (#1583)
This takes 23 000us to import on a Ryzen 9950X3D, and the import does not seem to be used after PR #591 was merged. Co-authored-by: Pete Gadomski <pete.gadomski@gmail.com>
1 parent 4cfef4e commit bb4d0e6

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## [Unreleased]
44

5+
- Remove unused pystac.validation import ([#1583](https://github.com/stac-utils/pystac/pull/1583))
6+
57
## [v1.14.1] - 2025-09-18
68

79
### Fixed

pystac/__init__.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@
8686
from pystac.item_collection import ItemCollection
8787
from pystac.provider import ProviderRole, Provider
8888
from pystac.utils import HREF
89-
import pystac.validation
9089

9190
import pystac.extensions.hooks
9291
import pystac.extensions.classification
@@ -241,3 +240,18 @@ def read_dict(
241240
if stac_io is None:
242241
stac_io = StacIO.default()
243242
return stac_io.stac_object_from_dict(d, href, root)
243+
244+
245+
def __getattr__(name: str) -> Any:
246+
if name == "validation":
247+
import warnings
248+
import pystac.validation
249+
250+
warnings.warn(
251+
"pystac.validation will not be automatically imported to the package in "
252+
"pystac v2.0. Instead, import it directly: `import pystac.validation`",
253+
DeprecationWarning,
254+
stacklevel=2,
255+
)
256+
return pystac.validation
257+
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")

0 commit comments

Comments
 (0)