Skip to content

Commit c411fec

Browse files
author
Jon Duckworth
authored
Avoid implicit re-exports (#591)
* Remove implicit re-exports * Enable mypy strict mode * Update CHANGELOG for #591
1 parent e744897 commit c411fec

File tree

7 files changed

+64
-18
lines changed

7 files changed

+64
-18
lines changed

CHANGELOG.md

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

99
### Changed
1010

11+
- Enable [strict
12+
mode](https://mypy.readthedocs.io/en/latest/command_line.html?highlight=strict%20mode#cmdoption-mypy-strict)
13+
for `mypy` ([#591](https://github.com/stac-utils/pystac/pull/591))
14+
1115
### Fixed
1216

17+
- Avoid implicit re-exports ([#591](https://github.com/stac-utils/pystac/pull/591))
18+
1319
### Deprecated
1420

1521
## [v1.1.0]

mypy.ini

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
[mypy]
2-
check_untyped_defs = True
3-
disallow_any_generics = True
4-
disallow_incomplete_defs = True
5-
disallow_subclassing_any = True
6-
disallow_untyped_calls = True
7-
disallow_untyped_decorators = True
8-
disallow_untyped_defs = True
9-
no_implicit_optional = True
102
show_error_codes = True
11-
strict_equality = True
12-
warn_redundant_casts = True
13-
warn_return_any = True
14-
warn_unused_configs = True
15-
warn_unused_ignores = True
3+
strict = True
164

175
[mypy-jsonschema.*]
186
ignore_missing_imports = True

pystac/__init__.py

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,43 @@
11
"""
22
PySTAC is a library for working with SpatioTemporal Asset Catalogs (STACs)
33
"""
4+
__all__ = [
5+
"__version__",
6+
"STACError",
7+
"STACTypeError",
8+
"DuplicateObjectKeyError",
9+
"ExtensionAlreadyExistsError",
10+
"ExtensionNotImplemented",
11+
"ExtensionTypeError",
12+
"RequiredPropertyMissing",
13+
"STACValidationError",
14+
"MediaType",
15+
"RelType",
16+
"StacIO",
17+
"STACObject",
18+
"STACObjectType",
19+
"Link",
20+
"HIERARCHICAL_LINKS",
21+
"Catalog",
22+
"CatalogType",
23+
"Collection",
24+
"Extent",
25+
"SpatialExtent",
26+
"TemporalExtent",
27+
"Summaries",
28+
"CommonMetadata",
29+
"RangeSummary",
30+
"Item",
31+
"Asset",
32+
"ItemCollection",
33+
"Provider",
34+
"ProviderRole",
35+
"read_file",
36+
"read_dict",
37+
"write_file",
38+
"get_stac_version",
39+
"set_stac_version",
40+
]
441

542
from pystac.errors import (
643
STACError,
@@ -30,11 +67,11 @@
3067
Extent,
3168
SpatialExtent,
3269
TemporalExtent,
33-
Summaries,
3470
)
3571
from pystac.common_metadata import CommonMetadata
36-
from pystac.summaries import RangeSummary
37-
from pystac.item import Item, Asset
72+
from pystac.summaries import RangeSummary, Summaries
73+
from pystac.asset import Asset
74+
from pystac.item import Item
3875
from pystac.item_collection import ItemCollection
3976
from pystac.provider import ProviderRole, Provider
4077
import pystac.validation

pystac/catalog.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
from pystac.utils import is_absolute_href, make_absolute_href, make_relative_href
3333

3434
if TYPE_CHECKING:
35-
from pystac.item import Asset as Asset_Type, Item as Item_Type
35+
from pystac.asset import Asset as Asset_Type
36+
from pystac.item import Item as Item_Type
3637
from pystac.collection import Collection as Collection_Type
3738

3839

pystac/serialization/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
__all__ = [
2+
"merge_common_properties",
3+
"migrate_to_latest",
4+
"STACVersionRange",
5+
"identify_stac_object",
6+
"identify_stac_object_type",
7+
]
18
from pystac.serialization.identify import (
29
STACVersionRange,
310
identify_stac_object,

tests/extensions/test_scientific.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from pystac import ExtensionTypeError
66
from pystac.link import Link
7-
from pystac.collection import Summaries
7+
from pystac.summaries import Summaries
88
import unittest
99
from typing import List, Optional
1010

tests/utils/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
__all__ = [
2+
"TestCases",
3+
"ARBITRARY_GEOM",
4+
"ARBITRARY_BBOX",
5+
"ARBITRARY_EXTENT",
6+
"MockStacIO",
7+
]
18
from typing import Any, Dict, TYPE_CHECKING, Type
29
import unittest
310
from tests.utils.test_cases import (

0 commit comments

Comments
 (0)