stac-validator 3.6.0__tar.gz → 3.8.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.8.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
@@ -17,16 +17,65 @@ Description-Content-Type: text/markdown
17
17
  Provides-Extra: dev
18
18
  License-File: LICENSE
19
19
 
20
- # SpatioTemporal Asset Catalog (STAC) Validator
20
+ # SpatioTemporal Asset Catalog Validator
21
+
22
+ <!-- markdownlint-disable MD033 MD041 -->
23
+
24
+ <p align="left">
25
+ <img src="https://raw.githubusercontent.com/stac-utils/stac-validator/main/assets/stac-validator.png" width=560>
26
+ </p>
27
+
28
+ [![Downloads](https://static.pepy.tech/badge/stac-validator?color=blue)](https://pepy.tech/project/stac-validator)
29
+ [![GitHub contributors](https://img.shields.io/github/contributors/stac-utils/stac-validator?color=blue)](https://github.com/stac-utils/stac-validator/graphs/contributors)
30
+ [![GitHub stars](https://img.shields.io/github/stars/stac-utils/stac-validator.svg?color=blue)](https://github.com/stac-utils/stac-validator/stargazers)
31
+ [![GitHub forks](https://img.shields.io/github/forks/stac-utils/stac-validator.svg?color=blue)](https://github.com/stac-utils/stac-validator/network/members)
32
+ [![PyPI version](https://img.shields.io/pypi/v/stac-validator.svg?color=blue)](https://pypi.org/project/stac-validator/)
33
+ [![STAC](https://img.shields.io/badge/STAC-1.1.0-blue.svg)](https://github.com/radiantearth/stac-spec/tree/v1.1.0)
34
+
35
+ ## Table of Contents
36
+
37
+ - [Overview](#overview)
38
+ - [Documentation](#documentation)
39
+ - [Requirements](#requirements)
40
+ - [Installation](#install)
41
+ - [Supported STAC Versions](#versions-supported)
42
+ - [Usage](#usage)
43
+ - [CLI](#cli)
44
+ - [Python](#python)
45
+ - [Examples](#additional-examples)
46
+ - [Core Validation](#--core)
47
+ - [Custom Schema](#--custom)
48
+ - [Extensions Validation](#--extensions)
49
+ - [Recursive Validation](#--recursive)
50
+ - [Item Collection Validation](#--item-collection)
51
+ - [Using Headers](#--header)
52
+ - [Schema Mapping](#--schema-map)
53
+ - [Schema Config](#--schema-config)
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,13 @@ 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
+ --schema-config TEXT Path to a YAML or JSON schema config file.
201
+ --help Show this message and exit.
179
202
  ```
180
203
 
181
- ---
182
-
183
- # Python
204
+ ### Python
184
205
 
185
206
  **Remote source**
186
207
 
@@ -190,6 +211,8 @@ from stac_validator import stac_validator
190
211
  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
212
  stac.run()
192
213
  print(stac.message)
214
+ ```
215
+ ```python
193
216
  [
194
217
  {
195
218
  "version": "0.9.0",
@@ -212,6 +235,8 @@ from stac_validator import stac_validator
212
235
  stac = stac_validator.StacValidate("tests/test_data/1beta1/sentinel2.json", extensions=True)
213
236
  stac.run()
214
237
  print(stac.message)
238
+ ```
239
+ ```python
215
240
  [
216
241
  {
217
242
  "version": "1.0.0-beta.1",
@@ -246,26 +271,61 @@ stac.validate_item_collection_dict(item_collection_dict)
246
271
  print(stac.message)
247
272
  ```
248
273
 
249
- ---
274
+ ## Deployment
275
+
276
+ ### Docker
277
+
278
+ The validator can run using docker containers.
279
+
280
+ ```bash
281
+ $ docker build -t stac-validator .
282
+ $ docker run stac-validator https://raw.githubusercontent.com/stac-extensions/projection/main/examples/item.json
283
+ ```
284
+
285
+ ```bash
286
+ [
287
+ {
288
+ "version": "1.0.0",
289
+ "path": "https://raw.githubusercontent.com/stac-extensions/projection/main/examples/item.json",
290
+ "schema": [
291
+ "https://stac-extensions.github.io/projection/v1.0.0/schema.json",
292
+ "https://schemas.stacspec.org/v1.0.0/item-spec/json-schema/item.json"
293
+ ],
294
+ "valid_stac": true,
295
+ "asset_type": "ITEM",
296
+ "validation_method": "default"
297
+ }
298
+ ]
299
+ ```
300
+
301
+ ### AWS (CDK)
250
302
 
251
- # Testing
303
+ An example [AWS CDK](https://aws.amazon.com/cdk/) deployment is available in [cdk-deployment](./cdk-deployment/README.md)
252
304
 
253
305
  ```bash
254
- make test
306
+ $ cd cdk-deployment
307
+ $ cdk diff
308
+ ```
309
+
310
+ ## Testing
311
+
312
+ ```bash
313
+ $ make test
255
314
  # or
256
- pytest -v
315
+ $ pytest -v
257
316
  ```
258
317
 
259
318
  See the [tests](./tests/test_stac_validator.py) files for examples on different usages.
260
319
 
261
- ---
320
+ ## Additional Examples
262
321
 
263
- # Additional Examples
322
+ ### --core
264
323
 
265
- **--core**
324
+ ```bash
325
+ $ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json --core
326
+ ```
266
327
 
267
328
  ```bash
268
- stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json --core
269
329
  [
270
330
  {
271
331
  "version": "1.0.0",
@@ -280,10 +340,13 @@ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/e
280
340
  ]
281
341
  ```
282
342
 
283
- **--custom**
343
+ ### --custom
344
+
345
+ ```bash
346
+ $ stac-validator https://radarstac.s3.amazonaws.com/stac/catalog.json --custom https://cdn.staclint.com/v0.7.0/catalog.json
347
+ ```
284
348
 
285
349
  ```bash
286
- stac-validator https://radarstac.s3.amazonaws.com/stac/catalog.json --custom https://cdn.staclint.com/v0.7.0/catalog.json
287
350
  [
288
351
  {
289
352
  "version": "0.7.0",
@@ -298,10 +361,13 @@ stac-validator https://radarstac.s3.amazonaws.com/stac/catalog.json --custom htt
298
361
  ]
299
362
  ```
300
363
 
301
- **--extensions**
364
+ ### --extensions
365
+
366
+ ```bash
367
+ $ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json --extensions
368
+ ```
302
369
 
303
370
  ```bash
304
- stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json --extensions
305
371
  [
306
372
  {
307
373
  "version": "1.0.0",
@@ -320,10 +386,13 @@ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/e
320
386
  ]
321
387
  ```
322
388
 
323
- **--recursive**
389
+ ### --recursive
390
+
391
+ ```bash
392
+ $ stac-validator https://spot-canada-ortho.s3.amazonaws.com/catalog.json --recursive --max-depth 1 --verbose
393
+ ```
324
394
 
325
395
  ```bash
326
- stac-validator https://spot-canada-ortho.s3.amazonaws.com/catalog.json --recursive --max-depth 1 --verbose
327
396
  [
328
397
  {
329
398
  "version": "0.8.1",
@@ -352,24 +421,28 @@ stac-validator https://spot-canada-ortho.s3.amazonaws.com/catalog.json --recursi
352
421
  ]
353
422
  ```
354
423
 
355
- **--item-collection**
424
+ ### --item-collection
356
425
 
357
426
  ```bash
358
- stac-validator https://earth-search.aws.element84.com/v0/collections/sentinel-s2-l2a/items --item-collection --pages 2
427
+ $ stac-validator https://earth-search.aws.element84.com/v0/collections/sentinel-s2-l2a/items --item-collection --pages 2
359
428
  ```
360
429
 
361
- **--header**
430
+ ### --header
362
431
 
363
432
  ```bash
364
- stac-validator https://stac-catalog.eu/collections/sentinel-s2-l2a/items --header x-api-key $MY_API_KEY --header foo bar
433
+ $ stac-validator https://stac-catalog.eu/collections/sentinel-s2-l2a/items --header x-api-key $MY_API_KEY --header foo bar
365
434
  ```
366
435
 
367
- **--schema-map**
436
+ ### --schema-map
437
+
368
438
  Schema map allows stac-validator to replace a schema in a STAC json by a schema from another URL or local schema file.
369
439
  This is especially useful when developing a schema and testing validation against your local copy of the schema.
370
440
 
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"
441
+ ```bash
442
+ $ 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"
443
+ ```
444
+
445
+ ```bash
373
446
  [
374
447
  {
375
448
  "version": "1.0.0",
@@ -391,7 +464,10 @@ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/e
391
464
  This option is also capable of replacing URLs to subschemas:
392
465
 
393
466
  ```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
467
+ $ 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
468
+ ```
469
+
470
+ ```bash
395
471
  [
396
472
  {
397
473
  "version": "1.0.0",
@@ -406,4 +482,80 @@ stac-validator tests/test_data/v100/extended-item-local.json --custom tests/test
406
482
  ]
407
483
  ```
408
484
 
485
+ ### --schema-config
486
+
487
+ The `--schema-config` option allows you to specify a YAML or JSON configuration file that maps remote schema URLs to local file paths. This is useful when you need to validate against multiple local schemas and want to avoid using multiple `--schema-map` arguments.
488
+
489
+ Example schema config file (YAML):
490
+ ```yaml
491
+ schemas:
492
+ "https://schemas.stacspec.org/v1.0.0/collection-spec/json-schema/collection.json": "local_schemas/v1.0.0/collection.json"
493
+ "https://schemas.stacspec.org/v1.0.0/item-spec/json-schema/item.json": "local_schemas/v1.0.0/item.json"
494
+ "https://stac-extensions.github.io/eo/v1.0.0/schema.json": "local_schemas/v1.0.0/eo.json"
495
+ ```
496
+
497
+ Usage:
498
+ ```bash
499
+ $ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/v1.0.0/examples/extended-item.json --schema-config path/to/schema_config.yaml
500
+ ```
501
+
502
+ The paths in the config file can be absolute or relative to the config file's location.
503
+
504
+ ### --pydantic
505
+
506
+ 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:
507
+
508
+ ```bash
509
+ $ pip install stac-validator[pydantic]
510
+ ```
511
+
512
+ Then you can validate your STAC objects using Pydantic models:
513
+
514
+ ```bash
515
+ $ stac-validator https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json --pydantic
516
+ ```
517
+
518
+ ```bash
519
+ [
520
+ {
521
+ "version": "1.0.0",
522
+ "path": "https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/extended-item.json",
523
+ "schema": [
524
+ "stac-pydantic Item model"
525
+ ],
526
+ "valid_stac": true,
527
+ "asset_type": "ITEM",
528
+ "validation_method": "pydantic",
529
+ "extension_schemas": [
530
+ "https://stac-extensions.github.io/eo/v1.0.0/schema.json",
531
+ "https://stac-extensions.github.io/projection/v1.0.0/schema.json",
532
+ "https://stac-extensions.github.io/scientific/v1.0.0/schema.json",
533
+ "https://stac-extensions.github.io/view/v1.0.0/schema.json",
534
+ "https://stac-extensions.github.io/remote-data/v1.0.0/schema.json"
535
+ ],
536
+ "model_validation": "passed"
537
+ }
538
+ ]
539
+ ```
540
+
541
+ ## Sponsors and Supporters
542
+
543
+ The following organizations have contributed time and/or funding to support the development of this project:
544
+ - [Healy Hyperspatial](https://healy-hyperspatial.github.io/)
545
+ - [Radiant Earth Foundation](https://radiant.earth/)
546
+ - [Sparkgeo](https://sparkgeo.com/)
547
+
548
+ <p align="left">
549
+ <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>
550
+ <a href="https://radiant.earth/"><img src="assets/radiant-earth.webp" alt="Radiant Earth Foundation" height="100" hspace="20"></a>
551
+ <a href="https://sparkgeo.com/"><img src="assets/sparkgeo_logo.jpeg" alt="Sparkgeo" height="100" hspace="20"></a>
552
+ </p>
553
+
554
+
555
+ ## Contributing
556
+
557
+ Contributions are welcome! Please feel free to submit a Pull Request.
558
+
559
+ ## License
409
560
 
561
+ This project is licensed under the Apache License 2.0.