stac-validator 3.6.0__tar.gz → 3.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: stac_validator
3
- Version: 3.6.0
3
+ Version: 3.7.0
4
4
  Summary: A package to validate STAC files
5
5
  Home-page: https://github.com/stac-utils/stac-validator
6
6
  Author: James Banting, Jonathan Healy
@@ -15,18 +15,67 @@ Classifier: Topic :: Scientific/Engineering :: GIS
15
15
  Requires-Python: >=3.8
16
16
  Description-Content-Type: text/markdown
17
17
  Provides-Extra: dev
18
+ Provides-Extra: pydantic
18
19
  License-File: LICENSE
19
20
 
20
- # SpatioTemporal Asset Catalog (STAC) Validator
21
+ # SpatioTemporal Asset Catalog Validator
22
+
23
+ <!-- markdownlint-disable MD033 MD041 -->
24
+
25
+ <p align="left">
26
+ <img src="https://raw.githubusercontent.com/stac-utils/stac-validator/main/assets/stac-validator.png" width=560>
27
+ </p>
28
+
29
+ [![Downloads](https://static.pepy.tech/badge/stac-validator?color=blue)](https://pepy.tech/project/stac-validator)
30
+ [![GitHub contributors](https://img.shields.io/github/contributors/stac-utils/stac-validator?color=blue)](https://github.com/stac-utils/stac-validator/graphs/contributors)
31
+ [![GitHub stars](https://img.shields.io/github/stars/stac-utils/stac-validator.svg?color=blue)](https://github.com/stac-utils/stac-validator/stargazers)
32
+ [![GitHub forks](https://img.shields.io/github/forks/stac-utils/stac-validator.svg?color=blue)](https://github.com/stac-utils/stac-validator/network/members)
33
+ [![PyPI version](https://img.shields.io/pypi/v/stac-validator.svg?color=blue)](https://pypi.org/project/stac-validator/)
34
+ [![STAC](https://img.shields.io/badge/STAC-1.1.0-blue.svg)](https://github.com/radiantearth/stac-spec/tree/v1.1.0)
35
+
36
+ ## Table of Contents
37
+
38
+ - [Overview](#overview)
39
+ - [Documentation](#documentation)
40
+ - [Requirements](#requirements)
41
+ - [Installation](#install)
42
+ - [Supported STAC Versions](#versions-supported)
43
+ - [Usage](#usage)
44
+ - [CLI](#cli)
45
+ - [Python](#python)
46
+ - [Examples](#additional-examples)
47
+ - [Core Validation](#--core)
48
+ - [Custom Schema](#--custom)
49
+ - [Extensions Validation](#--extensions)
50
+ - [Recursive Validation](#--recursive)
51
+ - [Item Collection Validation](#--item-collection)
52
+ - [Using Headers](#--header)
53
+ - [Schema Mapping](#--schema-map)
54
+ - [Pydantic Validation](#--pydantic)
55
+ - [Deployment](#deployment)
56
+ - [Docker](#docker)
57
+ - [AWS (CDK)](#aws-cdk)
58
+ - [Testing](#testing)
59
+ - [Related Projects](#related-projects)
60
+ - [Sponsors and Supporters](#sponsors-and-supporters)
61
+ - [Contributing](#contributing)
62
+ - [License](#license)
63
+
64
+ ## Overview
65
+
66
+ STAC Validator is a tool to validate [STAC (SpatioTemporal Asset Catalog)](https://github.com/radiantearth/stac-spec) json files against the official STAC specification. It provides both a command-line interface and a Python API for validating STAC objects.
21
67
 
22
68
  ## Documentation
23
69
 
24
- [read the docs](https://stac-validator.readthedocs.io/en/latest/)
70
+ For detailed documentation, please visit our [GitHub Pages documentation site](https://stac-utils.github.io/stac-validator/).
25
71
 
26
72
  ## Validate STAC json files against the [STAC spec](https://github.com/radiantearth/stac-spec).
27
73
 
28
74
  ```bash
29
- stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json
75
+ $ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json
76
+ ```
77
+
78
+ ```bash
30
79
  [
31
80
  {
32
81
  "version": "1.0.0",
@@ -53,33 +102,35 @@ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/e
53
102
  - Click
54
103
  - Jsonschema
55
104
 
105
+ ## Related Projects
106
+
56
107
  Note: Stac-validator is also used in stac-check which adds linting messages based on the official STAC best practices document.
57
108
  https://github.com/stac-utils/stac-check
58
109
 
59
110
  ## Install
60
111
 
61
- Installation from PyPi
112
+ ### Installation from PyPi
62
113
 
63
114
  ```bash
64
- pip install stac-validator
115
+ $ pip install stac-validator
65
116
  ```
66
117
 
67
- Installation from Repo
118
+ ### Installation from Repo
68
119
 
69
120
  ```bash
70
- pip install .
121
+ $ pip install .
71
122
  ```
72
123
 
73
124
  or for local development
74
125
 
75
126
  ```bash
76
- pip install -e '.[dev]'
127
+ $ pip install -e '.[dev]'
77
128
  ```
78
129
 
79
130
  The [Makefile](./Makefile) has convenience commands if Make is installed.
80
131
 
81
132
  ```bash
82
- make help
133
+ $ make help
83
134
  ```
84
135
 
85
136
  ## Versions supported
@@ -99,14 +150,17 @@ make help
99
150
  | 1.1.0-beta.1 |
100
151
  | 1.1.0 |
101
152
 
102
- ---
153
+ ## Usage
103
154
 
104
- # CLI
155
+ ### CLI
105
156
 
106
157
  **Basic Usage**
107
158
 
108
159
  ```bash
109
- stac-validator --help
160
+ $ stac-validator --help
161
+ ```
162
+
163
+ ```bash
110
164
  Usage: stac-validator [OPTIONS] STAC_FILE
111
165
 
112
166
  Options:
@@ -141,46 +195,12 @@ Options:
141
195
  --no_output Do not print output to console.
142
196
  --log_file TEXT Save full recursive output to log file
143
197
  (local filepath).
144
- --help Show this message and exit.```
145
-
146
- ---
147
-
148
- # Deployment
149
-
150
- ## Docker
151
-
152
- The validator can run using docker containers.
153
-
154
- ```bash
155
- docker build -t stac-validator .
156
- docker run stac-validator https://raw.githubusercontent.com/stac-extensions/projection/main/examples/item.json
157
- [
158
- {
159
- "version": "1.0.0",
160
- "path": "https://raw.githubusercontent.com/stac-extensions/projection/main/examples/item.json",
161
- "schema": [
162
- "https://stac-extensions.github.io/projection/v1.0.0/schema.json",
163
- "https://schemas.stacspec.org/v1.0.0/item-spec/json-schema/item.json"
164
- ],
165
- "valid_stac": true,
166
- "asset_type": "ITEM",
167
- "validation_method": "default"
168
- }
169
- ]
170
- ```
171
-
172
- ## AWS (CDK)
173
-
174
- An example [AWS CDK](https://aws.amazon.com/cdk/) deployment is available in [cdk-deployment](./cdk-deployment/README.md)
175
-
176
- ```bash
177
- cd cdk-deployment
178
- cdk diff
198
+ --pydantic Validate using stac-pydantic models for enhanced
199
+ type checking and validation.
200
+ --help Show this message and exit.
179
201
  ```
180
202
 
181
- ---
182
-
183
- # Python
203
+ ### Python
184
204
 
185
205
  **Remote source**
186
206
 
@@ -190,6 +210,8 @@ from stac_validator import stac_validator
190
210
  stac = stac_validator.StacValidate("https://raw.githubusercontent.com/stac-utils/pystac/main/tests/data-files/examples/0.9.0/collection-spec/examples/landsat-collection.json")
191
211
  stac.run()
192
212
  print(stac.message)
213
+ ```
214
+ ```python
193
215
  [
194
216
  {
195
217
  "version": "0.9.0",
@@ -212,6 +234,8 @@ from stac_validator import stac_validator
212
234
  stac = stac_validator.StacValidate("tests/test_data/1beta1/sentinel2.json", extensions=True)
213
235
  stac.run()
214
236
  print(stac.message)
237
+ ```
238
+ ```python
215
239
  [
216
240
  {
217
241
  "version": "1.0.0-beta.1",
@@ -246,26 +270,61 @@ stac.validate_item_collection_dict(item_collection_dict)
246
270
  print(stac.message)
247
271
  ```
248
272
 
249
- ---
273
+ ## Deployment
250
274
 
251
- # Testing
275
+ ### Docker
276
+
277
+ The validator can run using docker containers.
252
278
 
253
279
  ```bash
254
- make test
280
+ $ docker build -t stac-validator .
281
+ $ docker run stac-validator https://raw.githubusercontent.com/stac-extensions/projection/main/examples/item.json
282
+ ```
283
+
284
+ ```bash
285
+ [
286
+ {
287
+ "version": "1.0.0",
288
+ "path": "https://raw.githubusercontent.com/stac-extensions/projection/main/examples/item.json",
289
+ "schema": [
290
+ "https://stac-extensions.github.io/projection/v1.0.0/schema.json",
291
+ "https://schemas.stacspec.org/v1.0.0/item-spec/json-schema/item.json"
292
+ ],
293
+ "valid_stac": true,
294
+ "asset_type": "ITEM",
295
+ "validation_method": "default"
296
+ }
297
+ ]
298
+ ```
299
+
300
+ ### AWS (CDK)
301
+
302
+ An example [AWS CDK](https://aws.amazon.com/cdk/) deployment is available in [cdk-deployment](./cdk-deployment/README.md)
303
+
304
+ ```bash
305
+ $ cd cdk-deployment
306
+ $ cdk diff
307
+ ```
308
+
309
+ ## Testing
310
+
311
+ ```bash
312
+ $ make test
255
313
  # or
256
- pytest -v
314
+ $ pytest -v
257
315
  ```
258
316
 
259
317
  See the [tests](./tests/test_stac_validator.py) files for examples on different usages.
260
318
 
261
- ---
319
+ ## Additional Examples
262
320
 
263
- # Additional Examples
321
+ ### --core
264
322
 
265
- **--core**
323
+ ```bash
324
+ $ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json --core
325
+ ```
266
326
 
267
327
  ```bash
268
- stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json --core
269
328
  [
270
329
  {
271
330
  "version": "1.0.0",
@@ -280,10 +339,13 @@ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/e
280
339
  ]
281
340
  ```
282
341
 
283
- **--custom**
342
+ ### --custom
343
+
344
+ ```bash
345
+ $ stac-validator https://radarstac.s3.amazonaws.com/stac/catalog.json --custom https://cdn.staclint.com/v0.7.0/catalog.json
346
+ ```
284
347
 
285
348
  ```bash
286
- stac-validator https://radarstac.s3.amazonaws.com/stac/catalog.json --custom https://cdn.staclint.com/v0.7.0/catalog.json
287
349
  [
288
350
  {
289
351
  "version": "0.7.0",
@@ -298,10 +360,13 @@ stac-validator https://radarstac.s3.amazonaws.com/stac/catalog.json --custom htt
298
360
  ]
299
361
  ```
300
362
 
301
- **--extensions**
363
+ ### --extensions
364
+
365
+ ```bash
366
+ $ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json --extensions
367
+ ```
302
368
 
303
369
  ```bash
304
- stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json --extensions
305
370
  [
306
371
  {
307
372
  "version": "1.0.0",
@@ -320,10 +385,13 @@ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/e
320
385
  ]
321
386
  ```
322
387
 
323
- **--recursive**
388
+ ### --recursive
389
+
390
+ ```bash
391
+ $ stac-validator https://spot-canada-ortho.s3.amazonaws.com/catalog.json --recursive --max-depth 1 --verbose
392
+ ```
324
393
 
325
394
  ```bash
326
- stac-validator https://spot-canada-ortho.s3.amazonaws.com/catalog.json --recursive --max-depth 1 --verbose
327
395
  [
328
396
  {
329
397
  "version": "0.8.1",
@@ -352,24 +420,28 @@ stac-validator https://spot-canada-ortho.s3.amazonaws.com/catalog.json --recursi
352
420
  ]
353
421
  ```
354
422
 
355
- **--item-collection**
423
+ ### --item-collection
356
424
 
357
425
  ```bash
358
- stac-validator https://earth-search.aws.element84.com/v0/collections/sentinel-s2-l2a/items --item-collection --pages 2
426
+ $ stac-validator https://earth-search.aws.element84.com/v0/collections/sentinel-s2-l2a/items --item-collection --pages 2
359
427
  ```
360
428
 
361
- **--header**
429
+ ### --header
362
430
 
363
431
  ```bash
364
- stac-validator https://stac-catalog.eu/collections/sentinel-s2-l2a/items --header x-api-key $MY_API_KEY --header foo bar
432
+ $ stac-validator https://stac-catalog.eu/collections/sentinel-s2-l2a/items --header x-api-key $MY_API_KEY --header foo bar
365
433
  ```
366
434
 
367
- **--schema-map**
435
+ ### --schema-map
436
+
368
437
  Schema map allows stac-validator to replace a schema in a STAC json by a schema from another URL or local schema file.
369
438
  This is especially useful when developing a schema and testing validation against your local copy of the schema.
370
439
 
371
- ``` bash
372
- stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json --extensions --schema-map https://stac-extensions.github.io/projection/v1.0.0/schema.json stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/v1.0.0/examples/extended-item.json --extensions --schema-map https://stac-extensions.github.io/projection/v1.0.0/schema.json "tests/test_data/schema/v1.0.0/projection.json"
440
+ ```bash
441
+ $ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/v1.0.0/examples/extended-item.json --extensions --schema-map https://stac-extensions.github.io/projection/v1.0.0/schema.json "tests/test_data/schema/v1.0.0/projection.json"
442
+ ```
443
+
444
+ ```bash
373
445
  [
374
446
  {
375
447
  "version": "1.0.0",
@@ -391,7 +463,10 @@ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/e
391
463
  This option is also capable of replacing URLs to subschemas:
392
464
 
393
465
  ```bash
394
- stac-validator tests/test_data/v100/extended-item-local.json --custom tests/test_data/schema/v1.0.0/item_with_unreachable_url.json --schema-map https://geojson-wrong-url.org/schema/Feature.json https://geojson.org/schema/Feature.json --schema-map https://geojson-wrong-url.org/schema/Geometry.json https://geojson.org/schema/Geometry.json
466
+ $ stac-validator tests/test_data/v100/extended-item-local.json --custom tests/test_data/schema/v1.0.0/item_with_unreachable_url.json --schema-map https://geojson-wrong-url.org/schema/Feature.json https://geojson.org/schema/Feature.json --schema-map https://geojson-wrong-url.org/schema/Geometry.json https://geojson.org/schema/Geometry.json
467
+ ```
468
+
469
+ ```bash
395
470
  [
396
471
  {
397
472
  "version": "1.0.0",
@@ -406,4 +481,61 @@ stac-validator tests/test_data/v100/extended-item-local.json --custom tests/test
406
481
  ]
407
482
  ```
408
483
 
484
+ ### --pydantic
485
+
486
+ The `--pydantic` option provides enhanced validation using stac-pydantic models, which offer stronger type checking and more detailed error messages. To use this feature, you need to install the optional dependency:
487
+
488
+ ```bash
489
+ $ pip install stac-validator[pydantic]
490
+ ```
491
+
492
+ Then you can validate your STAC objects using Pydantic models:
493
+
494
+ ```bash
495
+ $ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json --pydantic
496
+ ```
497
+
498
+ ```bash
499
+ [
500
+ {
501
+ "version": "1.0.0",
502
+ "path": "https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json",
503
+ "schema": [
504
+ "stac-pydantic Item model"
505
+ ],
506
+ "valid_stac": true,
507
+ "asset_type": "ITEM",
508
+ "validation_method": "pydantic",
509
+ "extension_schemas": [
510
+ "https://stac-extensions.github.io/eo/v1.0.0/schema.json",
511
+ "https://stac-extensions.github.io/projection/v1.0.0/schema.json",
512
+ "https://stac-extensions.github.io/scientific/v1.0.0/schema.json",
513
+ "https://stac-extensions.github.io/view/v1.0.0/schema.json",
514
+ "https://stac-extensions.github.io/remote-data/v1.0.0/schema.json"
515
+ ],
516
+ "model_validation": "passed"
517
+ }
518
+ ]
519
+ ```
520
+
521
+ ## Sponsors and Supporters
522
+
523
+ The following organizations have contributed time and/or funding to support the development of this project:
524
+ - [Healy Hyperspatial](https://healy-hyperspatial.github.io/)
525
+ - [Radiant Earth Foundation](https://radiant.earth/)
526
+ - [Sparkgeo](https://sparkgeo.com/)
527
+
528
+ <p align="left">
529
+ <a href="https://healy-hyperspatial.github.io/"><img src="https://raw.githubusercontent.com/stac-utils/stac-fastapi-elasticsearch-opensearch/refs/heads/main/assets/hh-logo-blue.png" alt="Healy Hyperspatial" height="100" hspace="20"></a>
530
+ <a href="https://radiant.earth/"><img src="assets/radiant-earth.webp" alt="Radiant Earth Foundation" height="100" hspace="20"></a>
531
+ <a href="https://sparkgeo.com/"><img src="assets/sparkgeo_logo.jpeg" alt="Sparkgeo" height="100" hspace="20"></a>
532
+ </p>
533
+
534
+
535
+ ## Contributing
536
+
537
+ Contributions are welcome! Please feel free to submit a Pull Request.
538
+
539
+ ## License
409
540
 
541
+ This project is licensed under the Apache License 2.0.