stac-valid 4.2.2__tar.gz → 4.4.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.
- {stac_valid-4.2.2 → stac_valid-4.4.0}/PKG-INFO +74 -3
- stac_valid-4.2.2/stac_valid.egg-info/PKG-INFO → stac_valid-4.4.0/README.md +68 -44
- {stac_valid-4.2.2 → stac_valid-4.4.0}/pyproject.toml +11 -3
- stac_valid-4.2.2/README.md → stac_valid-4.4.0/stac_valid.egg-info/PKG-INFO +115 -2
- {stac_valid-4.2.2 → stac_valid-4.4.0}/stac_valid.egg-info/requires.txt +4 -0
- stac_valid-4.4.0/stac_validator/fast_validator.py +1158 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/stac_validator/stac_validator.py +41 -3
- {stac_valid-4.2.2 → stac_valid-4.4.0}/stac_validator/utilities.py +2 -2
- stac_valid-4.4.0/tests/test_fast_validator.py +1080 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/tests/test_sys_exit.py +16 -0
- stac_valid-4.2.2/stac_validator/fast_validator.py +0 -359
- stac_valid-4.2.2/tests/test_fast_validator.py +0 -408
- {stac_valid-4.2.2 → stac_valid-4.4.0}/LICENSE +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/setup.cfg +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/stac_valid.egg-info/SOURCES.txt +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/stac_valid.egg-info/dependency_links.txt +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/stac_valid.egg-info/entry_points.txt +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/stac_valid.egg-info/top_level.txt +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/stac_validator/__init__.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/stac_validator/batch_validator.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/stac_validator/validate.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/tests/test_assets.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/tests/test_batch_validator.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/tests/test_config.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/tests/test_core.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/tests/test_custom.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/tests/test_default.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/tests/test_extensions.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/tests/test_header.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/tests/test_links.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/tests/test_pydantic.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/tests/test_recursion.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/tests/test_schema_cache.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/tests/test_validate_collections.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/tests/test_validate_dict.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.4.0}/tests/test_validate_item_collection.py +0 -0
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: stac_valid
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.4.0
|
|
4
4
|
Summary: A package to validate STAC files
|
|
5
5
|
Author: James Banting
|
|
6
6
|
Author-email: Jonathan Healy <jon@healy-hyperspatial.dev>
|
|
7
|
+
Maintainer: Healy Hyperspatial
|
|
8
|
+
Maintainer-email: Jonathan Healy <jon@healy-hyperspatial.dev>
|
|
7
9
|
License: Apache-2.0
|
|
8
10
|
Project-URL: Homepage, https://github.com/stac-utils/stac-validator
|
|
9
11
|
Project-URL: Repository, https://github.com/stac-utils/stac-validator
|
|
@@ -38,6 +40,9 @@ Requires-Dist: types-jsonschema; extra == "dev"
|
|
|
38
40
|
Requires-Dist: types-tqdm; extra == "dev"
|
|
39
41
|
Provides-Extra: pydantic
|
|
40
42
|
Requires-Dist: stac-pydantic>=3.3.0; extra == "pydantic"
|
|
43
|
+
Provides-Extra: server
|
|
44
|
+
Requires-Dist: fastapi>=0.111.0; extra == "server"
|
|
45
|
+
Requires-Dist: uvicorn>=0.30.0; extra == "server"
|
|
41
46
|
Dynamic: license-file
|
|
42
47
|
|
|
43
48
|
# SpatioTemporal Asset Catalog Validator
|
|
@@ -52,7 +57,7 @@ Dynamic: license-file
|
|
|
52
57
|
[](https://github.com/stac-utils/stac-validator/graphs/contributors)
|
|
53
58
|
[](https://github.com/stac-utils/stac-validator/stargazers)
|
|
54
59
|
[](https://github.com/stac-utils/stac-validator/network/members)
|
|
55
|
-
[](https://pypi.org/project/stac-valid/)
|
|
56
61
|
[](https://github.com/radiantearth/stac-spec/tree/v1.1.0)
|
|
57
62
|
|
|
58
63
|
|
|
@@ -88,6 +93,7 @@ Dynamic: license-file
|
|
|
88
93
|
- [Legacy Validation](#legacy-validation)
|
|
89
94
|
- [Batch Validation](#batch-validation)
|
|
90
95
|
- [Fast Validation](#fast-validation)
|
|
96
|
+
- [API Server (FastAPI)](#api-server-fastapi)
|
|
91
97
|
- [Python](#python)
|
|
92
98
|
- [Schema Cache Settings](#schema-cache-settings)
|
|
93
99
|
- [Performance Benchmarking](#performance-benchmarking)
|
|
@@ -352,6 +358,12 @@ Options:
|
|
|
352
358
|
-q, --quiet Suppress individual item logs.
|
|
353
359
|
-v, --verbose Show full validation logs for all items. By default, only
|
|
354
360
|
invalid items are shown.
|
|
361
|
+
-r, --recursive Recursively validate all child catalogs, collections,
|
|
362
|
+
and items.
|
|
363
|
+
-a, --api Validate a STAC API catalog recursively (follows data,
|
|
364
|
+
child, item, and items links).
|
|
365
|
+
--limit INTEGER RANGE Limit number of STAC objects to validate.
|
|
366
|
+
[x>=1]
|
|
355
367
|
--help Show this message and exit.
|
|
356
368
|
```
|
|
357
369
|
|
|
@@ -554,6 +566,8 @@ The `fast` command provides ultra-high-speed validation using `fastjsonschema` w
|
|
|
554
566
|
- **Multi-tier caching:** RAM → Disk → Network with automatic fallback
|
|
555
567
|
- **Local schema storage:** Schemas cached locally under `local_schemas/.schemas` directory for instant reuse
|
|
556
568
|
- **Automatic detection:** Detects STAC type (Item, Collection, Catalog, FeatureCollection) automatically
|
|
569
|
+
- **Recursive traversal:** Supports `--recursive` for local catalog/collection graphs
|
|
570
|
+
- **STAC API traversal:** Supports `--api` to follow STAC API data, child, item, and items links
|
|
557
571
|
- **Detailed metrics:** Shows setup time, execution time, and cache hit status for each item
|
|
558
572
|
- **Error grouping:** Groups validation errors by type and shows affected items
|
|
559
573
|
|
|
@@ -582,8 +596,17 @@ $ stac-validator fast item.json --quiet
|
|
|
582
596
|
# Show detailed output for all items (default shows first 5)
|
|
583
597
|
$ stac-validator fast collection.json --verbose
|
|
584
598
|
|
|
599
|
+
# Validate only first 25 objects in a large FeatureCollection
|
|
600
|
+
$ stac-validator fast collection.json --limit 25
|
|
601
|
+
|
|
602
|
+
# Recursively validate a local catalog graph
|
|
603
|
+
$ stac-validator fast catalog.json --recursive
|
|
604
|
+
|
|
605
|
+
# Recursively validate a STAC API root endpoint
|
|
606
|
+
$ stac-validator fast https://api.example.com --api
|
|
607
|
+
|
|
585
608
|
# Combine options
|
|
586
|
-
$ stac-validator fast collection.json --verbose --
|
|
609
|
+
$ stac-validator fast collection.json --verbose --limit 50
|
|
587
610
|
```
|
|
588
611
|
|
|
589
612
|
**Example Output**
|
|
@@ -710,6 +733,50 @@ else:
|
|
|
710
733
|
| Development/testing | `fast` | Instant feedback, detailed metrics, minimal overhead |
|
|
711
734
|
| Complex validation rules | `validate` | Full control over validation options, recursive validation |
|
|
712
735
|
|
|
736
|
+
#### API Server (FastAPI)
|
|
737
|
+
|
|
738
|
+
The `fast` validation engine can be deployed as a high-performance REST API, ideal for validating STAC objects during ingestion or as part of a microservices architecture.
|
|
739
|
+
|
|
740
|
+
**Running the Server (Local):**
|
|
741
|
+
```bash
|
|
742
|
+
# Requires fastapi and uvicorn
|
|
743
|
+
pip install "stac-valid[server]"
|
|
744
|
+
python server/server.py
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
**Running the Server (Docker):**
|
|
748
|
+
```bash
|
|
749
|
+
# Pull and run the official GitHub container image
|
|
750
|
+
docker run -p 8000:8000 ghcr.io/staclabs/stac-validator:latest
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
**Validate via local script:**
|
|
754
|
+
```bash
|
|
755
|
+
python server/api_client_example.py sample_data/sentinel-cogs_0_100.json
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
**Validate via curl:**
|
|
759
|
+
```bash
|
|
760
|
+
curl -X POST http://localhost:8000/validate \
|
|
761
|
+
-H "Content-Type: application/json" \
|
|
762
|
+
-d @sample_data/sentinel-cogs_0_100.json
|
|
763
|
+
```
|
|
764
|
+
|
|
765
|
+
**Response Format:**
|
|
766
|
+
The API returns a detailed JSON summary including performance metrics and error breakdowns:
|
|
767
|
+
```json
|
|
768
|
+
{
|
|
769
|
+
"path": "request_body",
|
|
770
|
+
"valid_stac": true,
|
|
771
|
+
"total_objects": 100,
|
|
772
|
+
"valid_objects": 100,
|
|
773
|
+
"invalid_objects": 0,
|
|
774
|
+
"setup_time_ms": 0.25,
|
|
775
|
+
"execution_time_ms": 25.4,
|
|
776
|
+
"errors": []
|
|
777
|
+
}
|
|
778
|
+
```
|
|
779
|
+
|
|
713
780
|
### Python
|
|
714
781
|
|
|
715
782
|
**Single File Validation**
|
|
@@ -865,6 +932,10 @@ import json
|
|
|
865
932
|
fv = FastValidator("large_collection.json", quiet=True)
|
|
866
933
|
fv.run()
|
|
867
934
|
|
|
935
|
+
# Optionally cap validation to the first N objects
|
|
936
|
+
fv_limited = FastValidator("large_collection.json", quiet=True, limit=100)
|
|
937
|
+
fv_limited.run()
|
|
938
|
+
|
|
868
939
|
# Access validation results via the message attribute
|
|
869
940
|
print(json.dumps(fv.message, indent=2))
|
|
870
941
|
|
|
@@ -1,45 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: stac_valid
|
|
3
|
-
Version: 4.2.2
|
|
4
|
-
Summary: A package to validate STAC files
|
|
5
|
-
Author: James Banting
|
|
6
|
-
Author-email: Jonathan Healy <jon@healy-hyperspatial.dev>
|
|
7
|
-
License: Apache-2.0
|
|
8
|
-
Project-URL: Homepage, https://github.com/stac-utils/stac-validator
|
|
9
|
-
Project-URL: Repository, https://github.com/stac-utils/stac-validator
|
|
10
|
-
Keywords: STAC,validation,raster
|
|
11
|
-
Classifier: Intended Audience :: Information Technology
|
|
12
|
-
Classifier: Intended Audience :: Science/Research
|
|
13
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
-
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
16
|
-
Requires-Python: >=3.8
|
|
17
|
-
Description-Content-Type: text/markdown
|
|
18
|
-
License-File: LICENSE
|
|
19
|
-
Requires-Dist: requests>=2.32.3
|
|
20
|
-
Requires-Dist: jsonschema>=4.23.0
|
|
21
|
-
Requires-Dist: fastjsonschema>=2.21.1
|
|
22
|
-
Requires-Dist: click>=8.1.8
|
|
23
|
-
Requires-Dist: referencing>=0.35.1
|
|
24
|
-
Requires-Dist: pyYAML>=6.0.1
|
|
25
|
-
Requires-Dist: tqdm>=4.66.0
|
|
26
|
-
Provides-Extra: dev
|
|
27
|
-
Requires-Dist: black; extra == "dev"
|
|
28
|
-
Requires-Dist: pytest; extra == "dev"
|
|
29
|
-
Requires-Dist: pytest-mypy; extra == "dev"
|
|
30
|
-
Requires-Dist: pre-commit; extra == "dev"
|
|
31
|
-
Requires-Dist: requests-mock; extra == "dev"
|
|
32
|
-
Requires-Dist: types-setuptools; extra == "dev"
|
|
33
|
-
Requires-Dist: stac-pydantic>=3.3.0; extra == "dev"
|
|
34
|
-
Requires-Dist: mypy; extra == "dev"
|
|
35
|
-
Requires-Dist: types-attrs; extra == "dev"
|
|
36
|
-
Requires-Dist: types-requests; extra == "dev"
|
|
37
|
-
Requires-Dist: types-jsonschema; extra == "dev"
|
|
38
|
-
Requires-Dist: types-tqdm; extra == "dev"
|
|
39
|
-
Provides-Extra: pydantic
|
|
40
|
-
Requires-Dist: stac-pydantic>=3.3.0; extra == "pydantic"
|
|
41
|
-
Dynamic: license-file
|
|
42
|
-
|
|
43
1
|
# SpatioTemporal Asset Catalog Validator
|
|
44
2
|
|
|
45
3
|
<!-- markdownlint-disable MD033 MD041 -->
|
|
@@ -52,7 +10,7 @@ Dynamic: license-file
|
|
|
52
10
|
[](https://github.com/stac-utils/stac-validator/graphs/contributors)
|
|
53
11
|
[](https://github.com/stac-utils/stac-validator/stargazers)
|
|
54
12
|
[](https://github.com/stac-utils/stac-validator/network/members)
|
|
55
|
-
[](https://pypi.org/project/stac-valid/)
|
|
56
14
|
[](https://github.com/radiantearth/stac-spec/tree/v1.1.0)
|
|
57
15
|
|
|
58
16
|
|
|
@@ -88,6 +46,7 @@ Dynamic: license-file
|
|
|
88
46
|
- [Legacy Validation](#legacy-validation)
|
|
89
47
|
- [Batch Validation](#batch-validation)
|
|
90
48
|
- [Fast Validation](#fast-validation)
|
|
49
|
+
- [API Server (FastAPI)](#api-server-fastapi)
|
|
91
50
|
- [Python](#python)
|
|
92
51
|
- [Schema Cache Settings](#schema-cache-settings)
|
|
93
52
|
- [Performance Benchmarking](#performance-benchmarking)
|
|
@@ -352,6 +311,12 @@ Options:
|
|
|
352
311
|
-q, --quiet Suppress individual item logs.
|
|
353
312
|
-v, --verbose Show full validation logs for all items. By default, only
|
|
354
313
|
invalid items are shown.
|
|
314
|
+
-r, --recursive Recursively validate all child catalogs, collections,
|
|
315
|
+
and items.
|
|
316
|
+
-a, --api Validate a STAC API catalog recursively (follows data,
|
|
317
|
+
child, item, and items links).
|
|
318
|
+
--limit INTEGER RANGE Limit number of STAC objects to validate.
|
|
319
|
+
[x>=1]
|
|
355
320
|
--help Show this message and exit.
|
|
356
321
|
```
|
|
357
322
|
|
|
@@ -554,6 +519,8 @@ The `fast` command provides ultra-high-speed validation using `fastjsonschema` w
|
|
|
554
519
|
- **Multi-tier caching:** RAM → Disk → Network with automatic fallback
|
|
555
520
|
- **Local schema storage:** Schemas cached locally under `local_schemas/.schemas` directory for instant reuse
|
|
556
521
|
- **Automatic detection:** Detects STAC type (Item, Collection, Catalog, FeatureCollection) automatically
|
|
522
|
+
- **Recursive traversal:** Supports `--recursive` for local catalog/collection graphs
|
|
523
|
+
- **STAC API traversal:** Supports `--api` to follow STAC API data, child, item, and items links
|
|
557
524
|
- **Detailed metrics:** Shows setup time, execution time, and cache hit status for each item
|
|
558
525
|
- **Error grouping:** Groups validation errors by type and shows affected items
|
|
559
526
|
|
|
@@ -582,8 +549,17 @@ $ stac-validator fast item.json --quiet
|
|
|
582
549
|
# Show detailed output for all items (default shows first 5)
|
|
583
550
|
$ stac-validator fast collection.json --verbose
|
|
584
551
|
|
|
552
|
+
# Validate only first 25 objects in a large FeatureCollection
|
|
553
|
+
$ stac-validator fast collection.json --limit 25
|
|
554
|
+
|
|
555
|
+
# Recursively validate a local catalog graph
|
|
556
|
+
$ stac-validator fast catalog.json --recursive
|
|
557
|
+
|
|
558
|
+
# Recursively validate a STAC API root endpoint
|
|
559
|
+
$ stac-validator fast https://api.example.com --api
|
|
560
|
+
|
|
585
561
|
# Combine options
|
|
586
|
-
$ stac-validator fast collection.json --verbose --
|
|
562
|
+
$ stac-validator fast collection.json --verbose --limit 50
|
|
587
563
|
```
|
|
588
564
|
|
|
589
565
|
**Example Output**
|
|
@@ -710,6 +686,50 @@ else:
|
|
|
710
686
|
| Development/testing | `fast` | Instant feedback, detailed metrics, minimal overhead |
|
|
711
687
|
| Complex validation rules | `validate` | Full control over validation options, recursive validation |
|
|
712
688
|
|
|
689
|
+
#### API Server (FastAPI)
|
|
690
|
+
|
|
691
|
+
The `fast` validation engine can be deployed as a high-performance REST API, ideal for validating STAC objects during ingestion or as part of a microservices architecture.
|
|
692
|
+
|
|
693
|
+
**Running the Server (Local):**
|
|
694
|
+
```bash
|
|
695
|
+
# Requires fastapi and uvicorn
|
|
696
|
+
pip install "stac-valid[server]"
|
|
697
|
+
python server/server.py
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
**Running the Server (Docker):**
|
|
701
|
+
```bash
|
|
702
|
+
# Pull and run the official GitHub container image
|
|
703
|
+
docker run -p 8000:8000 ghcr.io/staclabs/stac-validator:latest
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
**Validate via local script:**
|
|
707
|
+
```bash
|
|
708
|
+
python server/api_client_example.py sample_data/sentinel-cogs_0_100.json
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
**Validate via curl:**
|
|
712
|
+
```bash
|
|
713
|
+
curl -X POST http://localhost:8000/validate \
|
|
714
|
+
-H "Content-Type: application/json" \
|
|
715
|
+
-d @sample_data/sentinel-cogs_0_100.json
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
**Response Format:**
|
|
719
|
+
The API returns a detailed JSON summary including performance metrics and error breakdowns:
|
|
720
|
+
```json
|
|
721
|
+
{
|
|
722
|
+
"path": "request_body",
|
|
723
|
+
"valid_stac": true,
|
|
724
|
+
"total_objects": 100,
|
|
725
|
+
"valid_objects": 100,
|
|
726
|
+
"invalid_objects": 0,
|
|
727
|
+
"setup_time_ms": 0.25,
|
|
728
|
+
"execution_time_ms": 25.4,
|
|
729
|
+
"errors": []
|
|
730
|
+
}
|
|
731
|
+
```
|
|
732
|
+
|
|
713
733
|
### Python
|
|
714
734
|
|
|
715
735
|
**Single File Validation**
|
|
@@ -865,6 +885,10 @@ import json
|
|
|
865
885
|
fv = FastValidator("large_collection.json", quiet=True)
|
|
866
886
|
fv.run()
|
|
867
887
|
|
|
888
|
+
# Optionally cap validation to the first N objects
|
|
889
|
+
fv_limited = FastValidator("large_collection.json", quiet=True, limit=100)
|
|
890
|
+
fv_limited.run()
|
|
891
|
+
|
|
868
892
|
# Access validation results via the message attribute
|
|
869
893
|
print(json.dumps(fv.message, indent=2))
|
|
870
894
|
|
|
@@ -4,11 +4,15 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "stac_valid"
|
|
7
|
-
version = "4.
|
|
7
|
+
version = "4.4.0"
|
|
8
8
|
description = "A package to validate STAC files"
|
|
9
9
|
authors = [
|
|
10
|
-
{name = "
|
|
11
|
-
{name = "
|
|
10
|
+
{name = "Jonathan Healy", email = "jon@healy-hyperspatial.dev"},
|
|
11
|
+
{name = "James Banting"}
|
|
12
|
+
]
|
|
13
|
+
maintainers = [
|
|
14
|
+
{name = "Jonathan Healy", email = "jon@healy-hyperspatial.dev"},
|
|
15
|
+
{name = "Healy Hyperspatial"}
|
|
12
16
|
]
|
|
13
17
|
license = {text = "Apache-2.0"}
|
|
14
18
|
classifiers = [
|
|
@@ -48,6 +52,10 @@ dev = [
|
|
|
48
52
|
pydantic = [
|
|
49
53
|
"stac-pydantic>=3.3.0"
|
|
50
54
|
]
|
|
55
|
+
server = [
|
|
56
|
+
"fastapi>=0.111.0",
|
|
57
|
+
"uvicorn>=0.30.0"
|
|
58
|
+
]
|
|
51
59
|
|
|
52
60
|
[project.urls]
|
|
53
61
|
Homepage = "https://github.com/stac-utils/stac-validator"
|
|
@@ -1,3 +1,50 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: stac_valid
|
|
3
|
+
Version: 4.4.0
|
|
4
|
+
Summary: A package to validate STAC files
|
|
5
|
+
Author: James Banting
|
|
6
|
+
Author-email: Jonathan Healy <jon@healy-hyperspatial.dev>
|
|
7
|
+
Maintainer: Healy Hyperspatial
|
|
8
|
+
Maintainer-email: Jonathan Healy <jon@healy-hyperspatial.dev>
|
|
9
|
+
License: Apache-2.0
|
|
10
|
+
Project-URL: Homepage, https://github.com/stac-utils/stac-validator
|
|
11
|
+
Project-URL: Repository, https://github.com/stac-utils/stac-validator
|
|
12
|
+
Keywords: STAC,validation,raster
|
|
13
|
+
Classifier: Intended Audience :: Information Technology
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
18
|
+
Requires-Python: >=3.8
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: requests>=2.32.3
|
|
22
|
+
Requires-Dist: jsonschema>=4.23.0
|
|
23
|
+
Requires-Dist: fastjsonschema>=2.21.1
|
|
24
|
+
Requires-Dist: click>=8.1.8
|
|
25
|
+
Requires-Dist: referencing>=0.35.1
|
|
26
|
+
Requires-Dist: pyYAML>=6.0.1
|
|
27
|
+
Requires-Dist: tqdm>=4.66.0
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: black; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-mypy; extra == "dev"
|
|
32
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
33
|
+
Requires-Dist: requests-mock; extra == "dev"
|
|
34
|
+
Requires-Dist: types-setuptools; extra == "dev"
|
|
35
|
+
Requires-Dist: stac-pydantic>=3.3.0; extra == "dev"
|
|
36
|
+
Requires-Dist: mypy; extra == "dev"
|
|
37
|
+
Requires-Dist: types-attrs; extra == "dev"
|
|
38
|
+
Requires-Dist: types-requests; extra == "dev"
|
|
39
|
+
Requires-Dist: types-jsonschema; extra == "dev"
|
|
40
|
+
Requires-Dist: types-tqdm; extra == "dev"
|
|
41
|
+
Provides-Extra: pydantic
|
|
42
|
+
Requires-Dist: stac-pydantic>=3.3.0; extra == "pydantic"
|
|
43
|
+
Provides-Extra: server
|
|
44
|
+
Requires-Dist: fastapi>=0.111.0; extra == "server"
|
|
45
|
+
Requires-Dist: uvicorn>=0.30.0; extra == "server"
|
|
46
|
+
Dynamic: license-file
|
|
47
|
+
|
|
1
48
|
# SpatioTemporal Asset Catalog Validator
|
|
2
49
|
|
|
3
50
|
<!-- markdownlint-disable MD033 MD041 -->
|
|
@@ -10,7 +57,7 @@
|
|
|
10
57
|
[](https://github.com/stac-utils/stac-validator/graphs/contributors)
|
|
11
58
|
[](https://github.com/stac-utils/stac-validator/stargazers)
|
|
12
59
|
[](https://github.com/stac-utils/stac-validator/network/members)
|
|
13
|
-
[](https://pypi.org/project/stac-valid/)
|
|
14
61
|
[](https://github.com/radiantearth/stac-spec/tree/v1.1.0)
|
|
15
62
|
|
|
16
63
|
|
|
@@ -46,6 +93,7 @@
|
|
|
46
93
|
- [Legacy Validation](#legacy-validation)
|
|
47
94
|
- [Batch Validation](#batch-validation)
|
|
48
95
|
- [Fast Validation](#fast-validation)
|
|
96
|
+
- [API Server (FastAPI)](#api-server-fastapi)
|
|
49
97
|
- [Python](#python)
|
|
50
98
|
- [Schema Cache Settings](#schema-cache-settings)
|
|
51
99
|
- [Performance Benchmarking](#performance-benchmarking)
|
|
@@ -310,6 +358,12 @@ Options:
|
|
|
310
358
|
-q, --quiet Suppress individual item logs.
|
|
311
359
|
-v, --verbose Show full validation logs for all items. By default, only
|
|
312
360
|
invalid items are shown.
|
|
361
|
+
-r, --recursive Recursively validate all child catalogs, collections,
|
|
362
|
+
and items.
|
|
363
|
+
-a, --api Validate a STAC API catalog recursively (follows data,
|
|
364
|
+
child, item, and items links).
|
|
365
|
+
--limit INTEGER RANGE Limit number of STAC objects to validate.
|
|
366
|
+
[x>=1]
|
|
313
367
|
--help Show this message and exit.
|
|
314
368
|
```
|
|
315
369
|
|
|
@@ -512,6 +566,8 @@ The `fast` command provides ultra-high-speed validation using `fastjsonschema` w
|
|
|
512
566
|
- **Multi-tier caching:** RAM → Disk → Network with automatic fallback
|
|
513
567
|
- **Local schema storage:** Schemas cached locally under `local_schemas/.schemas` directory for instant reuse
|
|
514
568
|
- **Automatic detection:** Detects STAC type (Item, Collection, Catalog, FeatureCollection) automatically
|
|
569
|
+
- **Recursive traversal:** Supports `--recursive` for local catalog/collection graphs
|
|
570
|
+
- **STAC API traversal:** Supports `--api` to follow STAC API data, child, item, and items links
|
|
515
571
|
- **Detailed metrics:** Shows setup time, execution time, and cache hit status for each item
|
|
516
572
|
- **Error grouping:** Groups validation errors by type and shows affected items
|
|
517
573
|
|
|
@@ -540,8 +596,17 @@ $ stac-validator fast item.json --quiet
|
|
|
540
596
|
# Show detailed output for all items (default shows first 5)
|
|
541
597
|
$ stac-validator fast collection.json --verbose
|
|
542
598
|
|
|
599
|
+
# Validate only first 25 objects in a large FeatureCollection
|
|
600
|
+
$ stac-validator fast collection.json --limit 25
|
|
601
|
+
|
|
602
|
+
# Recursively validate a local catalog graph
|
|
603
|
+
$ stac-validator fast catalog.json --recursive
|
|
604
|
+
|
|
605
|
+
# Recursively validate a STAC API root endpoint
|
|
606
|
+
$ stac-validator fast https://api.example.com --api
|
|
607
|
+
|
|
543
608
|
# Combine options
|
|
544
|
-
$ stac-validator fast collection.json --verbose --
|
|
609
|
+
$ stac-validator fast collection.json --verbose --limit 50
|
|
545
610
|
```
|
|
546
611
|
|
|
547
612
|
**Example Output**
|
|
@@ -668,6 +733,50 @@ else:
|
|
|
668
733
|
| Development/testing | `fast` | Instant feedback, detailed metrics, minimal overhead |
|
|
669
734
|
| Complex validation rules | `validate` | Full control over validation options, recursive validation |
|
|
670
735
|
|
|
736
|
+
#### API Server (FastAPI)
|
|
737
|
+
|
|
738
|
+
The `fast` validation engine can be deployed as a high-performance REST API, ideal for validating STAC objects during ingestion or as part of a microservices architecture.
|
|
739
|
+
|
|
740
|
+
**Running the Server (Local):**
|
|
741
|
+
```bash
|
|
742
|
+
# Requires fastapi and uvicorn
|
|
743
|
+
pip install "stac-valid[server]"
|
|
744
|
+
python server/server.py
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
**Running the Server (Docker):**
|
|
748
|
+
```bash
|
|
749
|
+
# Pull and run the official GitHub container image
|
|
750
|
+
docker run -p 8000:8000 ghcr.io/staclabs/stac-validator:latest
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
**Validate via local script:**
|
|
754
|
+
```bash
|
|
755
|
+
python server/api_client_example.py sample_data/sentinel-cogs_0_100.json
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
**Validate via curl:**
|
|
759
|
+
```bash
|
|
760
|
+
curl -X POST http://localhost:8000/validate \
|
|
761
|
+
-H "Content-Type: application/json" \
|
|
762
|
+
-d @sample_data/sentinel-cogs_0_100.json
|
|
763
|
+
```
|
|
764
|
+
|
|
765
|
+
**Response Format:**
|
|
766
|
+
The API returns a detailed JSON summary including performance metrics and error breakdowns:
|
|
767
|
+
```json
|
|
768
|
+
{
|
|
769
|
+
"path": "request_body",
|
|
770
|
+
"valid_stac": true,
|
|
771
|
+
"total_objects": 100,
|
|
772
|
+
"valid_objects": 100,
|
|
773
|
+
"invalid_objects": 0,
|
|
774
|
+
"setup_time_ms": 0.25,
|
|
775
|
+
"execution_time_ms": 25.4,
|
|
776
|
+
"errors": []
|
|
777
|
+
}
|
|
778
|
+
```
|
|
779
|
+
|
|
671
780
|
### Python
|
|
672
781
|
|
|
673
782
|
**Single File Validation**
|
|
@@ -823,6 +932,10 @@ import json
|
|
|
823
932
|
fv = FastValidator("large_collection.json", quiet=True)
|
|
824
933
|
fv.run()
|
|
825
934
|
|
|
935
|
+
# Optionally cap validation to the first N objects
|
|
936
|
+
fv_limited = FastValidator("large_collection.json", quiet=True, limit=100)
|
|
937
|
+
fv_limited.run()
|
|
938
|
+
|
|
826
939
|
# Access validation results via the message attribute
|
|
827
940
|
print(json.dumps(fv.message, indent=2))
|
|
828
941
|
|