Skip to content

Commit ed426f6

Browse files
author
Tom Augspurger
authored
Prepare for pystac 1.0 (#14)
Compatibility with pystac, pystac-client 1.0
1 parent 41c0b78 commit ed426f6

5 files changed

Lines changed: 10 additions & 37 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ pip install -e .
4545
This library currently assists with signing Azure Blob Storage URLs. The `sign` function operates directly on an HREF string, as well as several [PySTAC](https://github.com/stac-utils/pystac) objects: `Asset`, `Item`, and `ItemCollection`. In addition, the `sign` function accepts a [STAC API Client](https://github.com/stac-utils/pystac-client) `ItemSearch`, which performs a search and returns the resulting `ItemCollection` with all assets signed. The following example demonstrates these use cases:
4646

4747
```python
48-
from pystac import Asset, Item
49-
from pystac_client import ItemCollection, ItemSearch
48+
from pystac import Asset, Item, ItemCollection
49+
from pystac_client import ItemSearch
5050
import planetary_computer as pc
5151

5252

planetary_computer/sas.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
from functools import singledispatch
55
import requests
66
from pydantic import BaseModel, Field
7-
from pystac import Asset, Item
7+
from pystac import Asset, Item, ItemCollection
88
from pystac.utils import datetime_to_str
9-
from pystac_client import ItemCollection, ItemSearch
9+
from pystac_client import ItemSearch
1010

1111
from planetary_computer.settings import Settings
1212
from planetary_computer.utils import parse_blob_url
@@ -170,4 +170,4 @@ def _search_and_sign(search: ItemSearch) -> ItemCollection:
170170
a "msft:expiry" property is added to the Item properties indicating the
171171
earliest expiry time for any assets that were signed.
172172
"""
173-
return sign(search.items_as_collection())
173+
return sign(search.get_all_items())

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ packages = find:
1313
install_requires =
1414
click>=7.1
1515
pydantic[dotenv]>=1.7.3
16-
pystac>=0.5.6,<0.6
17-
pystac-client>=0.1.1,<0.2.0
16+
pystac>=1.0.0rc2
17+
pystac-client>=0.2.0b2
1818
pytz>=2020.5
1919
requests>=2.25.1
2020

tests/data-files/sample-item.json

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -93,34 +93,7 @@
9393
]
9494
}
9595
},
96-
"links":[
97-
{
98-
"href":"https://sample-self-json",
99-
"rel":"self",
100-
"type":"application/geo+json"
101-
},
102-
{
103-
"href":"https://sample-parent-json",
104-
"rel":"parent",
105-
"type":"application/json"
106-
},
107-
{
108-
"href":"https://sample-collection-json",
109-
"rel":"collection",
110-
"type":"application/json"
111-
},
112-
{
113-
"href":"https://sample-root-json",
114-
"rel":"root",
115-
"type":"application/json"
116-
},
117-
{
118-
"href":"https://sample-alternate-json",
119-
"rel":"alternate",
120-
"type":"application/json",
121-
"title":"tiles"
122-
}
123-
],
96+
"links": [],
12497
"stac_extensions":[
12598
"eo",
12699
"projection"

tests/test_signing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
import planetary_computer as pc
1111
from planetary_computer.utils import parse_blob_url
12-
from pystac import Item
13-
from pystac_client import ItemCollection, ItemSearch
12+
from pystac import Item, ItemCollection
13+
from pystac_client import ItemSearch
1414

1515

1616
ACCOUNT_NAME = "naipeuwest"

0 commit comments

Comments
 (0)