Skip to content

Commit 4c7c775

Browse files
authored
Merge pull request #309 from stac-utils/feature/rde/1.0-refactors
Refactors architecture to better enable STAC 1.0 extension changes
2 parents b005962 + 63f83f4 commit 4c7c775

File tree

322 files changed

+35063
-29120
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

322 files changed

+35063
-29120
lines changed

.flake8

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
11
[flake8]
2-
max-line-length = 100
3-
4-
## IGNORES
5-
6-
# E126: yapf conflicts with "continuation line over-indented for hanging indent"
7-
8-
# E127: flake8 reporting incorrect continuation line indent errors
9-
# on multi-line and multi-level indents
10-
11-
# W503: flake8 reports this as incorrect, and scripts/format_code
12-
# changes code to it, so let format_code win.
13-
14-
ignore = E126,E127,W503
2+
max-line-length = 88
3+
extend-ignore = E203, W503, E731, E722

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,26 @@
44

55
### Added
66

7+
- Added type annotations across the library ([#309](https://github.com/stac-utils/pystac/pull/309))
8+
- Added assets to collections ([#309](https://github.com/stac-utils/pystac/pull/309))
9+
- `item_assets` extension ([#309](https://github.com/stac-utils/pystac/pull/309))
10+
- `datacube` extension ([#309](https://github.com/stac-utils/pystac/pull/309))
11+
- Added specific errors: `ExtensionAlreadyExistsError`, `ExtensionTypeError`, and `RequiredPropertyMissing`; moved custom exceptions to `pystac.errors` ([#309](https://github.com/stac-utils/pystac/pull/309))
12+
713
### Fixed
814

915
### Changed
1016

17+
- API change: The extension API changed significantly. See ([#309](https://github.com/stac-utils/pystac/pull/309)) for more details.
18+
- API change: Refactored the global STAC_IO object to an instance-specific `StacIO` implementation. STAC_IO is deprecated and will be removed next release. ([#309](https://github.com/stac-utils/pystac/pull/309))
19+
- Asset.get_absolute_href returns None if no absolute href can be inferred (previously the relative href that was passed in was returned) ([#309](https://github.com/stac-utils/pystac/pull/309))
20+
1121
### Removed
1222

23+
- Removed `properties` from Collections ([#309](https://github.com/stac-utils/pystac/pull/309))
24+
- Removed `LinkMixin`, and implemented those methods on `STACObject` directly. STACObject was the only class using LinkMixin and this should not effect users ([#309](https://github.com/stac-utils/pystac/pull/309)
25+
- Removed `single-file-stac` extension; this extension is being removed in favor of ItemCollection usage ([#309](https://github.com/stac-utils/pystac/pull/309)
26+
1327
## [v0.5.6]
1428

1529
### Added

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@ To build and develop the documentation locally, make sure sphinx is available (w
114114
> make livehtml
115115
```
116116

117+
> Note: You will see some warnings along the lines of
118+
> ```
119+
> WARNING: duplicate object description of pystac.Collection.id,
120+
> other instance in api, use :noindex: for one of them
121+
> ```
122+
> for some of the
123+
> classes. This is expected due to [sphinx-doc/sphinx#8664](https://github.com/sphinx-doc/sphinx/issues/8664).
124+
117125
Use 'make' without arguments to see a list of available commands.
118126
119127
__Note__: `nbsphinx` requires that a local `pystac` is installed; use `pip install -e .`.

docs/api.rst

Lines changed: 92 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,6 @@ Link
127127
:members:
128128
:undoc-members:
129129

130-
LinkType
131-
~~~~~~~~
132-
133-
.. autoclass:: pystac.LinkType
134-
:members:
135-
:undoc-members:
136-
137130
MediaType
138131
~~~~~~~~~
139132

@@ -149,7 +142,7 @@ STAC_IO
149142

150143
STAC_IO is the utility mechanism that PySTAC uses for reading and writing. Users of PySTAC can hook into PySTAC by overriding members to utilize their own IO methods.
151144

152-
.. autoclass:: pystac.STAC_IO
145+
.. autoclass:: pystac.stac_io.STAC_IO
153146
:members:
154147
:undoc-members:
155148

@@ -193,17 +186,20 @@ ExtensionError
193186
Extensions
194187
----------
195188

196-
.. autoclass:: pystac.extensions.Extensions
197-
:members:
198-
:undoc-members:
189+
**TEMPORARILY REMOVED**
190+
.. .. autoclass:: pystac.extensions.Extensions
191+
.. :members:
192+
.. :undoc-members:
199193
200194
ExtensionIndex
201195
~~~~~~~~~~~~~~
202196

203-
An ExtensionIndex is accessed through the :attr:`STACObject.ext <pystac.STACObject.ext>` property and is the primary way to access information and functionality around STAC extensions.
197+
**TEMPORARILY REMOVED**
198+
199+
.. An ExtensionIndex is accessed through the :attr:`STACObject.ext <pystac.STACObject.ext>` property and is the primary way to access information and functionality around STAC extensions.
204200
205-
.. autoclass:: pystac.stac_object.ExtensionIndex
206-
:members: __getitem__, __getattr__, enable, implements
201+
.. .. autoclass:: pystac.stac_object.ExtensionIndex
202+
.. :members: __getitem__, __getattr__, enable, implements
207203
208204
209205
EO Extension
@@ -214,17 +210,21 @@ These classes are representations of the `EO Extension Spec <https://github.com/
214210
EOItemExt
215211
~~~~~~~~~
216212

217-
.. autoclass:: pystac.extensions.eo.EOItemExt
218-
:members:
219-
:undoc-members:
220-
:show-inheritance:
213+
**TEMPORARILY REMOVED**
214+
215+
.. .. autoclass:: pystac.extensions.eo.EOItemExt
216+
.. :members:
217+
.. :undoc-members:
218+
.. :show-inheritance:
221219
222220
Band
223221
~~~~
224222

225-
.. autoclass:: pystac.extensions.eo.Band
226-
:members:
227-
:undoc-members:
223+
**TEMPORARILY REMOVED**
224+
225+
.. .. autoclass:: pystac.extensions.eo.Band
226+
.. :members:
227+
.. :undoc-members:
228228
229229
230230
Label Extension
@@ -235,10 +235,12 @@ These classes are representations of the `Label Extension Spec <https://github.c
235235
LabelItemExt
236236
~~~~~~~~~~~~
237237

238-
.. autoclass:: pystac.extensions.label.LabelItemExt
239-
:members:
240-
:undoc-members:
241-
:show-inheritance:
238+
**TEMPORARILY REMOVED**
239+
240+
.. .. autoclass:: pystac.extensions.label.LabelItemExt
241+
.. :members:
242+
.. :undoc-members:
243+
.. :show-inheritance:
242244
243245
LabelType
244246
~~~~~~~~~
@@ -283,10 +285,12 @@ Implements the `Point Cloud Extension <https://github.com/radiantearth/stac-spec
283285
PointcloudItemExt
284286
~~~~~~~~~~~~~~~~~
285287

286-
.. autoclass:: pystac.extensions.pointcloud.PointcloudItemExt
287-
:members:
288-
:undoc-members:
289-
:show-inheritance:
288+
**TEMPORARILY REMOVED**
289+
290+
.. .. autoclass:: pystac.extensions.pointcloud.PointcloudItemExt
291+
.. :members:
292+
.. :undoc-members:
293+
.. :show-inheritance:
290294
291295
Projection Extension
292296
--------------------
@@ -296,10 +300,12 @@ Implements the `Projection Extension <https://github.com/radiantearth/stac-spec/
296300
ProjectionItemExt
297301
~~~~~~~~~~~~~~~~~
298302

299-
.. autoclass:: pystac.extensions.projection.ProjectionItemExt
300-
:members:
301-
:undoc-members:
302-
:show-inheritance:
303+
**TEMPORARILY REMOVED**
304+
305+
.. .. autoclass:: pystac.extensions.projection.ProjectionItemExt
306+
.. :members:
307+
.. :undoc-members:
308+
.. :show-inheritance:
303309
304310
Timestamps Extension
305311
--------------------
@@ -309,10 +315,12 @@ Implements the `Timestamps Extension <https://github.com/radiantearth/stac-spec/
309315
TimestampsItemExt
310316
~~~~~~~~~~~~~~~~~
311317

312-
.. autoclass:: pystac.extensions.timestamps.TimestampsItemExt
313-
:members:
314-
:undoc-members:
315-
:show-inheritance:
318+
**TEMPORARILY REMOVED**
319+
320+
.. .. autoclass:: pystac.extensions.timestamps.TimestampsItemExt
321+
.. :members:
322+
.. :undoc-members:
323+
.. :show-inheritance:
316324
317325
SAR Extension
318326
-------------
@@ -322,10 +330,12 @@ Implements the `SAR Extension <https://github.com/radiantearth/stac-spec/tree/v1
322330
SarItemExt
323331
~~~~~~~~~~~~~~~~~~~~~~~~
324332

325-
.. autoclass:: pystac.extensions.sar.SarItemExt
326-
:members:
327-
:undoc-members:
328-
:show-inheritance:
333+
**TEMPORARILY REMOVED**
334+
335+
.. .. autoclass:: pystac.extensions.sar.SarItemExt
336+
.. :members:
337+
.. :undoc-members:
338+
.. :show-inheritance:
329339
330340
SAT Extension
331341
-------------
@@ -335,25 +345,31 @@ Implements the `SAT Extension <https://github.com/radiantearth/stac-spec/tree/v1
335345
SatItemExt
336346
~~~~~~~~~~~~~~~~~~~~~~~~
337347

338-
.. autoclass:: pystac.extensions.sar.SatItemExt
339-
:members:
340-
:undoc-members:
341-
:show-inheritance:
348+
**TEMPORARILY REMOVED**
349+
350+
.. .. autoclass:: pystac.extensions.sar.SatItemExt
351+
.. :members:
352+
.. :undoc-members:
353+
.. :show-inheritance:
342354
343355
Single File STAC Extension
344356
--------------------------
345357

346358
These classes are representations of the `Single File STAC Extension <https://github.com/radiantearth/stac-spec/tree/v1.0.0-beta.2/extensions/single-file-stac>`_.
347359

348-
.. automodule:: pystac.extensions.single_file_stac
349-
:members: create_single_file_stac
360+
**TEMPORARILY REMOVED**
361+
362+
.. .. automodule:: pystac.extensions.single_file_stac
363+
.. :members: create_single_file_stac
350364
351365
SingleFileSTACCatalogExt
352366
~~~~~~~~~~~~~~~~~~~~~~~~
353367

354-
.. autoclass:: pystac.extensions.single_file_stac.SingleFileSTACCatalogExt
355-
:members:
356-
:undoc-members:
368+
**TEMPORARILY REMOVED**
369+
370+
.. .. autoclass:: pystac.extensions.single_file_stac.SingleFileSTACCatalogExt
371+
.. :members:
372+
.. :undoc-members:
357373
358374
Version Extension
359375
-----------------
@@ -363,18 +379,22 @@ Implements the `Version Extension <https://github.com/radiantearth/stac-spec/tre
363379
VersionCollectionExt
364380
~~~~~~~~~~~~~~~~~~~~
365381

366-
.. autoclass:: pystac.extensions.version.VersionCollectionExt
367-
:members:
368-
:undoc-members:
369-
:show-inheritance:
382+
**TEMPORARILY REMOVED**
383+
384+
.. .. autoclass:: pystac.extensions.version.VersionCollectionExt
385+
.. :members:
386+
.. :undoc-members:
387+
.. :show-inheritance:
370388
371389
VersionItemExt
372390
~~~~~~~~~~~~~~
373391

374-
.. autoclass:: pystac.extensions.version.VersionItemExt
375-
:members:
376-
:undoc-members:
377-
:show-inheritance:
392+
**TEMPORARILY REMOVED**
393+
394+
.. .. autoclass:: pystac.extensions.version.VersionItemExt
395+
.. :members:
396+
.. :undoc-members:
397+
.. :show-inheritance:
378398
379399
View Geometry Extension
380400
-----------------------
@@ -384,10 +404,12 @@ Implements the `View Geometry Extension <https://github.com/radiantearth/stac-sp
384404
ViewItemExt
385405
~~~~~~~~~~~
386406

387-
.. autoclass:: pystac.extensions.view.ViewItemExt
388-
:members:
389-
:undoc-members:
390-
:show-inheritance:
407+
**TEMPORARILY REMOVED**
408+
409+
.. .. autoclass:: pystac.extensions.view.ViewItemExt
410+
.. :members:
411+
.. :undoc-members:
412+
.. :show-inheritance:
391413
392414
Serialization
393415
-------------
@@ -401,17 +423,17 @@ Identification
401423
.. automodule:: pystac.serialization
402424
:members: identify_stac_object
403425

404-
.. autoclass:: pystac.serialization.STACJSONDescription
405-
:members:
406-
:undoc-members:
426+
.. .. autoclass:: pystac.serialization.STACJSONDescription
427+
.. :members:
428+
.. :undoc-members:
407429
408430
.. autoclass:: pystac.serialization.STACVersionRange
409431
:members:
410432
:undoc-members:
411433

412-
.. autoclass:: pystac.serialization.STACVersionID
413-
:members:
414-
:undoc-members:
434+
.. .. autoclass:: pystac.serialization.STACVersionID
435+
.. :members:
436+
.. :undoc-members:
415437
416438
417439
Migration
@@ -456,8 +478,8 @@ schema URIs. A default implementation is included that uses known locations; how
456478
can provide their own schema URI maps in a :class:`~pystac.validation.JsonSchemaSTACValidator`
457479
to modify the URIs used.
458480

459-
.. autoclass:: pystac.validation.SchemaUriMap
460-
:members:
481+
.. .. autoclass:: pystac.validation.SchemaUriMap
482+
.. :members:
461483
462484
.. autoclass:: pystac.validation.schema_uri_map.DefaultSchemaUriMap
463485
:members:

docs/concepts.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ are relative to the linking object's file location. For example, if a catalog at
159159
then that link should resolve to the absolute path ``/some/location/item-id/item-id.json``.
160160

161161
Links are set as absolute or relative HREFs at save time, as determine by the root catalog's catalog_type
162-
:attribute:`~pystac.Catalog.catalog_type`. This means that, even if the stored HREF of the link is absolute,
162+
:attr:`~pystac.Catalog.catalog_type`. This means that, even if the stored HREF of the link is absolute,
163163
if the root ``catalog_type=CatalogType.RELATIVE_PUBLISHED`` or ``catalog_type=CatalogType.SELF_CONTAINED``
164164
and subsequent serializing of the any links in the catalog will produce a relative link,
165165
based on the self link of the parent object.
@@ -396,7 +396,7 @@ Item Asset properties
396396

397397
Properties that apply to Items can be found in two places: the Item's properties or in any of an Item's Assets. If the property is on an Asset, it applies only that specific asset. For example, gsd defined for an Item represents the best Ground Sample Distance (resolution) for the data within the Item. However, some assets may be lower resolution and thus have a higher gsd. In that case, the `gsd` can be found on the Asset.
398398

399-
See the STAC documentation on `Additional Fields for Assets <https://github.com/radiantearth/stac-spec/blob/v1.0.0-beta.2/item-spec/item-spec.md#additional-fields-for-assets>`_ and the relevant `Best Practices <https://github.com/radiantearth/stac-spec/blob/v1.0.0-beta.2/best-practices.md#common-use-cases-of-additional-fields-for-assets>`_ for more information.
399+
See the STAC documentation on `Additional Fields for Assets <https://github.com/radiantearth/stac-spec/blob/v1.0.0-beta.2/item-spec/item-spec.md#additional-fields-for-assets>`_ and the relevant `Best Practices <https://github.com/radiantearth/stac-spec/blob/v1.0.0-beta.2/best-practices.md#common-use-cases-of-additional-fields-for-assets>`__ for more information.
400400

401401
The implementation of this feature in PySTAC uses the method described here and is consistent across Item and ItemExtensions. The bare property names represent values for the Item only, but for each property where it is possible to set on both the Item or the Asset there is a ``get_`` and ``set_`` methods that optionally take an Asset. For the ``get_`` methods, if the property is found on the Asset, the Asset's value is used; otherwise the Item's value will be used. For the ``set_`` method, if an Asset is passed in the value will be applied to the Asset and not the Item.
402402

mypy.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[mypy]
2+
ignore_missing_imports = True
3+
disallow_untyped_defs = True

0 commit comments

Comments
 (0)