Skip to content

Commit e56d019

Browse files
committed
Remove unused pystac.validation import
This takes 23 000us to import on a Ryzen 9950X3D, and the import does not seem to be used after PR #591 was merged.
1 parent a5e0408 commit e56d019

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
@@ -239,3 +238,18 @@ def read_dict(
239238
if stac_io is None:
240239
stac_io = StacIO.default()
241240
return stac_io.stac_object_from_dict(d, href, root)
241+
242+
243+
def __getattr__(name: str) -> Any:
244+
if name == "validation":
245+
import warnings
246+
import pystac.validation
247+
248+
warnings.warn(
249+
"pystac.validation will not be automatically imported to the package in "
250+
"pystac v2.0. Instead, import it directly: `import pystac.validation`",
251+
DeprecationWarning,
252+
stacklevel=2,
253+
)
254+
return pystac.validation
255+
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")

0 commit comments

Comments
 (0)