Skip to content

Commit 9219359

Browse files
authored
release: v1.13.0 (#1550)
* release: v1.13.0 * feat: autoupdate pre-commit * fix: lints
1 parent 897f3cb commit 9219359

20 files changed

+1425
-1218
lines changed

.pre-commit-config.yaml

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

44
repos:
55
- repo: https://github.com/asottile/pyupgrade
6-
rev: v3.18.0
6+
rev: v3.19.1
77
hooks:
88
- id: pyupgrade
99
args:

CHANGELOG.md

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

33
## [Unreleased]
44

5+
## [v1.13.0] - 2025-04-15
6+
57
### Added
68

79
- Projection extension: migrate Assets and Item-Assets ([#1549](https://github.com/stac-utils/pystac/pull/1549))
@@ -13,13 +15,13 @@
1315
- `proj:epsg` migration when `None` ([#1544](https://github.com/stac-utils/pystac/pull/1544))
1416
- fixed missing parameter "title" in pystac.extensions.classification.Classification ([#1539](https://github.com/stac-utils/pystac/pull/1539))
1517

16-
## [v1.12.2]
18+
## [v1.12.2] - 2025-02-19
1719

1820
### Fixed
1921

2022
- Make sure that `VersionRange` has `VersionID`s rather than strings ([#1512](https://github.com/stac-utils/pystac/pull/1512))
2123

22-
## [v1.12.1]
24+
## [v1.12.1] - 2025-01-27
2325

2426
### Changed
2527

@@ -29,7 +31,7 @@
2931

3032
- Fall back to `epsg` when `code` is not present in the Projection extension ([#1505](https://github.com/stac-utils/pystac/pull/1505), [#1510](https://github.com/stac-utils/pystac/pull/1510))
3133

32-
## [v1.12.0]
34+
## [v1.12.0] - 2025-01-23
3335

3436
### Added
3537

@@ -921,7 +923,8 @@ use `Band.create`
921923

922924
Initial release.
923925

924-
[Unreleased]: <https://github.com/stac-utils/pystac/compare/v1.12.2..main>
926+
[Unreleased]: <https://github.com/stac-utils/pystac/compare/v1.13.0..main>
927+
[v1.13.0]: <https://github.com/stac-utils/pystac/compare/v1.12.2..v1.13.0>
925928
[v1.12.2]: <https://github.com/stac-utils/pystac/compare/v1.12.1..v1.12.2>
926929
[v1.12.1]: <https://github.com/stac-utils/pystac/compare/v1.12.0..v1.12.1>
927930
[v1.12.0]: <https://github.com/stac-utils/pystac/compare/v1.11.0..v1.12.0>

docs/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,19 @@
6161

6262
extlinks = {
6363
"tutorial": (
64-
"https://github.com/stac-utils/pystac/" "tree/{}/docs/tutorials/%s".format(
64+
"https://github.com/stac-utils/pystac/tree/{}/docs/tutorials/%s".format(
6565
git_branch
6666
),
6767
"%s tutorial",
6868
),
6969
"stac-spec": (
70-
"https://github.com/radiantearth/stac-spec/tree/" "v{}/%s".format(
70+
"https://github.com/radiantearth/stac-spec/tree/v{}/%s".format(
7171
STACVersion.DEFAULT_STAC_VERSION
7272
),
7373
"%s path",
7474
),
7575
"stac-api-spec": (
76-
"https://github.com/radiantearth/stac-api-spec/tree/" "v{}/%s".format(
76+
"https://github.com/radiantearth/stac-api-spec/tree/v{}/%s".format(
7777
STACVersion.DEFAULT_STAC_API_VERSION
7878
),
7979
"%s path",

docs/tutorials/adding-new-and-custom-extensions.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
" self.properties[\"timestamp\"] = datetime_to_str(v)\n",
105105
"\n",
106106
" def __repr__(self) -> str:\n",
107-
" return \"<OrderEvent \" f\"type={self.event_type} \" f\"timestamp={self.timestamp}>\"\n",
107+
" return f\"<OrderEvent type={self.event_type} timestamp={self.timestamp}>\"\n",
108108
"\n",
109109
" def apply(\n",
110110
" self,\n",

docs/tutorials/creating-a-landsat-stac.ipynb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,8 +1418,7 @@
14181418
" offset=11,\n",
14191419
" length=1,\n",
14201420
" description=(\n",
1421-
" \"Terrain not visible from sensor due to \"\n",
1422-
" \"intervening terrain\"\n",
1421+
" \"Terrain not visible from sensor due to intervening terrain\"\n",
14231422
" ),\n",
14241423
" classes=[\n",
14251424
" Classification.create(\n",

pystac/extensions/classification.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@ def color_hint(self) -> str | None:
222222
def color_hint(self, v: str | None) -> None:
223223
if v is not None:
224224
match = COLOR_HINT_PATTERN.match(v)
225-
assert (
226-
v is None or match is not None and match.group() == v
227-
), "Must format color hints as '^([0-9A-F]{6})$'"
225+
assert v is None or match is not None and match.group() == v, (
226+
"Must format color hints as '^([0-9A-F]{6})$'"
227+
)
228228
self.properties["color_hint"] = v
229229
else:
230230
self.properties.pop("color_hint", None)
@@ -343,9 +343,9 @@ def apply(
343343
assert offset >= 0, "Non-negative offsets only"
344344
assert length >= 1, "Positive field lengths only"
345345
assert len(classes) > 0, "Must specify at least one class"
346-
assert (
347-
roles is None or len(roles) > 0
348-
), "When set, roles must contain at least one item"
346+
assert roles is None or len(roles) > 0, (
347+
"When set, roles must contain at least one item"
348+
)
349349

350350
@classmethod
351351
def create(

pystac/extensions/grid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def validated_code(v: str) -> str:
3030
raise ValueError("Invalid Grid code: must be str")
3131
if not CODE_PATTERN.fullmatch(v):
3232
raise ValueError(
33-
f"Invalid Grid code: {v}" f" does not match the regex {CODE_REGEX}"
33+
f"Invalid Grid code: {v} does not match the regex {CODE_REGEX}"
3434
)
3535
return v
3636

pystac/serialization/common_properties.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def merge_common_properties(
8989
collection_props = collection["properties"]
9090
else:
9191
raise ValueError(
92-
"{} is expected to be a Collection or " "dict but is neither.".format(
92+
"{} is expected to be a Collection or dict but is neither.".format(
9393
collection
9494
)
9595
)

pystac/serialization/migrate.py

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,31 +78,29 @@ def _migrate_datetime_range(
7878
return None
7979

8080

81-
def _get_object_migrations() -> (
82-
dict[str, Callable[[dict[str, Any], STACVersionID, STACJSONDescription], None]]
83-
):
81+
def _get_object_migrations() -> dict[
82+
str, Callable[[dict[str, Any], STACVersionID, STACJSONDescription], None]
83+
]:
8484
return {
8585
pystac.STACObjectType.CATALOG: _migrate_catalog,
8686
pystac.STACObjectType.COLLECTION: _migrate_collection,
8787
pystac.STACObjectType.ITEM: _migrate_item,
8888
}
8989

9090

91-
def _get_removed_extension_migrations() -> (
92-
dict[
93-
str,
94-
tuple[
95-
list[STACObjectType] | None,
96-
None
97-
| (
98-
Callable[
99-
[dict[str, Any], STACVersionID, STACJSONDescription],
100-
set[str] | None,
101-
]
102-
),
103-
],
104-
]
105-
):
91+
def _get_removed_extension_migrations() -> dict[
92+
str,
93+
tuple[
94+
list[STACObjectType] | None,
95+
None
96+
| (
97+
Callable[
98+
[dict[str, Any], STACVersionID, STACJSONDescription],
99+
set[str] | None,
100+
]
101+
),
102+
],
103+
]:
106104
"""Handles removed extensions.
107105
108106
This does not handle renamed extension or extensions that were absorbed

pystac/utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -464,12 +464,12 @@ def extract_coords(coords: list[list[float] | list[list[Any]]]) -> None:
464464
for x in coords:
465465
# This handles points
466466
if isinstance(x, float):
467-
assert isinstance(
468-
coords[0], float
469-
), f"Type mismatch: {coords[0]} is not a float"
470-
assert isinstance(
471-
coords[1], float
472-
), f"Type mismatch: {coords[1]} is not a float"
467+
assert isinstance(coords[0], float), (
468+
f"Type mismatch: {coords[0]} is not a float"
469+
)
470+
assert isinstance(coords[1], float), (
471+
f"Type mismatch: {coords[1]} is not a float"
472+
)
473473
lats.append(coords[0])
474474
lons.append(coords[1])
475475
return

pystac/validation/local_validator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def __init__(self) -> None:
8989

9090
def registry(self) -> Any:
9191
return Registry().with_resources(
92-
[(k, Resource.from_contents(v)) for k, v in self.schema_cache.items()] # type: ignore
92+
[(k, Resource.from_contents(v)) for k, v in self.schema_cache.items()]
9393
)
9494

9595
def _validate_from_local(

pystac/validation/stac_validator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def retrieve(schema_uri: str) -> Resource[dict[str, Any]]:
179179
return Resource.from_contents(self._get_schema(schema_uri))
180180

181181
return Registry(retrieve=retrieve).with_resources( # type: ignore
182-
[(k, Resource.from_contents(v)) for k, v in self.schema_cache.items()] # type: ignore
182+
[(k, Resource.from_contents(v)) for k, v in self.schema_cache.items()]
183183
)
184184

185185
def get_schema_from_uri(self, schema_uri: str) -> tuple[dict[str, Any], Any]:

pystac/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22

3-
__version__ = "1.12.2"
3+
__version__ = "1.13.0"
44
"""Library version"""
55

66

tests/extensions/test_eo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def test_summaries_adds_uri() -> None:
253253
def test_read_pre_09_fields_into_common_metadata() -> None:
254254
eo_item = pystac.Item.from_file(
255255
TestCases.get_path(
256-
"data-files/examples/0.8.1/item-spec/examples/" "landsat8-sample.json"
256+
"data-files/examples/0.8.1/item-spec/examples/landsat8-sample.json"
257257
)
258258
)
259259

@@ -264,7 +264,7 @@ def test_read_pre_09_fields_into_common_metadata() -> None:
264264
def test_reads_asset_bands_in_pre_1_0_version() -> None:
265265
item = pystac.Item.from_file(
266266
TestCases.get_path(
267-
"data-files/examples/0.9.0/item-spec/examples/" "landsat8-sample.json"
267+
"data-files/examples/0.9.0/item-spec/examples/landsat8-sample.json"
268268
)
269269
)
270270

@@ -277,7 +277,7 @@ def test_reads_asset_bands_in_pre_1_0_version() -> None:
277277
def test_reads_gsd_in_pre_1_0_version() -> None:
278278
eo_item = pystac.Item.from_file(
279279
TestCases.get_path(
280-
"data-files/examples/0.9.0/item-spec/examples/" "landsat8-sample.json"
280+
"data-files/examples/0.9.0/item-spec/examples/landsat8-sample.json"
281281
)
282282
)
283283

tests/serialization/test_migrate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_migrates_removed_extension(self) -> None:
5858
def test_migrates_added_extension(self) -> None:
5959
item = pystac.Item.from_file(
6060
TestCases.get_path(
61-
"data-files/examples/0.8.1/item-spec/" "examples/planet-sample.json"
61+
"data-files/examples/0.8.1/item-spec/examples/planet-sample.json"
6262
)
6363
)
6464
assert ViewExtension.has_extension(item)

tests/test_catalog.py

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,9 @@ def test_catalog(cat: Catalog) -> None:
420420
c.id for c in children
421421
}, "Children unequal"
422422

423-
assert {c.id for c in root.get_items()} == {
424-
c.id for c in items
425-
}, "Items unequal"
423+
assert {c.id for c in root.get_items()} == {c.id for c in items}, (
424+
"Items unequal"
425+
)
426426

427427
assert actual_catalog_iterations == expected_catalog_iterations
428428

@@ -460,10 +460,10 @@ def test_clone_generates_correct_links(self, catalog: Catalog) -> None:
460460
actual_counts = actual_link_types_to_counts[obj_id]
461461
assert set(expected_counts.keys()) == set(actual_counts.keys())
462462
for rel in expected_counts:
463-
assert (
464-
actual_counts[rel] == expected_counts[rel]
465-
), "Clone of {} has {} {} links, original has {}".format(
466-
obj_id, actual_counts[rel], rel, expected_counts[rel]
463+
assert actual_counts[rel] == expected_counts[rel], (
464+
"Clone of {} has {} {} links, original has {}".format(
465+
obj_id, actual_counts[rel], rel, expected_counts[rel]
466+
)
467467
)
468468

469469
def test_save_uses_previous_catalog_type(self) -> None:
@@ -554,12 +554,12 @@ def test_subcatalogs_saved_to_correct_path(self) -> None:
554554

555555
# Check the root catalog path
556556
expected_root_catalog_path = os.path.join(tmp_dir, "catalog.json")
557-
assert os.path.exists(
558-
expected_root_catalog_path
559-
), f"{expected_root_catalog_path} does not exist."
560-
assert os.path.isfile(
561-
expected_root_catalog_path
562-
), f"{expected_root_catalog_path} is not a file."
557+
assert os.path.exists(expected_root_catalog_path), (
558+
f"{expected_root_catalog_path} does not exist."
559+
)
560+
assert os.path.isfile(expected_root_catalog_path), (
561+
f"{expected_root_catalog_path} is not a file."
562+
)
563563

564564
# Check each child catalog
565565
for child_catalog in catalog.get_children():
@@ -571,12 +571,12 @@ def test_subcatalogs_saved_to_correct_path(self) -> None:
571571
expected_root_catalog_path,
572572
start_is_dir=False,
573573
)
574-
assert os.path.exists(
575-
expected_child_path
576-
), f"{expected_child_path} does not exist."
577-
assert os.path.isfile(
578-
expected_child_path
579-
), f"{expected_child_path} is not a file."
574+
assert os.path.exists(expected_child_path), (
575+
f"{expected_child_path} does not exist."
576+
)
577+
assert os.path.isfile(expected_child_path), (
578+
f"{expected_child_path} is not a file."
579+
)
580580

581581
# Check each item
582582
for item in catalog.get_items(recursive=True):
@@ -588,12 +588,12 @@ def test_subcatalogs_saved_to_correct_path(self) -> None:
588588
expected_root_catalog_path,
589589
start_is_dir=False,
590590
)
591-
assert os.path.exists(
592-
expected_item_path
593-
), f"{expected_item_path} does not exist."
594-
assert os.path.isfile(
595-
expected_item_path
596-
), f"{expected_item_path} is not a file."
591+
assert os.path.exists(expected_item_path), (
592+
f"{expected_item_path} does not exist."
593+
)
594+
assert os.path.isfile(expected_item_path), (
595+
f"{expected_item_path} is not a file."
596+
)
597597

598598
def test_clone_uses_previous_catalog_type(self) -> None:
599599
catalog = TestCases.case_1()
@@ -613,10 +613,10 @@ def test_normalize_hrefs_sets_all_hrefs(self) -> None:
613613
target_href = cast(pystac.STACObject, link.target).self_href
614614
else:
615615
target_href = link.absolute_href
616-
assert (
617-
"http://example.com" in target_href
618-
), '[{}] {} does not contain "{}"'.format(
619-
link.rel, target_href, "http://example.com"
616+
assert "http://example.com" in target_href, (
617+
'[{}] {} does not contain "{}"'.format(
618+
link.rel, target_href, "http://example.com"
619+
)
620620
)
621621
for item in items:
622622
assert "http://example.com" in item.self_href
@@ -748,9 +748,9 @@ def test_generate_subcatalogs_can_be_applied_multiple_times(self) -> None:
748748
assert len(result) == 0
749749
catalog.normalize_hrefs("/tmp")
750750
for item in catalog.get_items(recursive=True):
751-
assert (
752-
item.get_self_href() == expected_hrefs[item.id]
753-
), f" for item '{item.id}'"
751+
assert item.get_self_href() == expected_hrefs[item.id], (
752+
f" for item '{item.id}'"
753+
)
754754

755755
def test_generate_subcatalogs_works_after_adding_more_items(self) -> None:
756756
catalog = Catalog(id="test", description="Test")
@@ -1151,9 +1151,9 @@ def test_self_contained_catalog_collection_item_links(self) -> None:
11511151
continue
11521152

11531153
href = link["href"]
1154-
assert not is_absolute_href(
1155-
href
1156-
), f"Link with rel={link['rel']} is absolute!"
1154+
assert not is_absolute_href(href), (
1155+
f"Link with rel={link['rel']} is absolute!"
1156+
)
11571157

11581158
def test_full_copy_and_normalize_works_with_created_stac(self) -> None:
11591159
cat = TestCases.case_3()

0 commit comments

Comments
 (0)