stac-valid 4.2.2__tar.gz → 4.3.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.egg-info → stac_valid-4.3.0}/PKG-INFO +52 -2
- {stac_valid-4.2.2 → stac_valid-4.3.0}/README.md +46 -1
- {stac_valid-4.2.2 → stac_valid-4.3.0}/pyproject.toml +9 -1
- {stac_valid-4.2.2 → stac_valid-4.3.0/stac_valid.egg-info}/PKG-INFO +52 -2
- {stac_valid-4.2.2 → stac_valid-4.3.0}/stac_valid.egg-info/requires.txt +4 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/stac_validator/fast_validator.py +4 -4
- {stac_valid-4.2.2 → stac_valid-4.3.0}/stac_validator/utilities.py +2 -2
- {stac_valid-4.2.2 → stac_valid-4.3.0}/LICENSE +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/setup.cfg +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/stac_valid.egg-info/SOURCES.txt +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/stac_valid.egg-info/dependency_links.txt +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/stac_valid.egg-info/entry_points.txt +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/stac_valid.egg-info/top_level.txt +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/stac_validator/__init__.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/stac_validator/batch_validator.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/stac_validator/stac_validator.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/stac_validator/validate.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/tests/test_assets.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/tests/test_batch_validator.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/tests/test_config.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/tests/test_core.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/tests/test_custom.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/tests/test_default.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/tests/test_extensions.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/tests/test_fast_validator.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/tests/test_header.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/tests/test_links.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/tests/test_pydantic.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/tests/test_recursion.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/tests/test_schema_cache.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/tests/test_sys_exit.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/tests/test_validate_collections.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.0}/tests/test_validate_dict.py +0 -0
- {stac_valid-4.2.2 → stac_valid-4.3.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.3.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)
|
|
@@ -710,6 +716,50 @@ else:
|
|
|
710
716
|
| Development/testing | `fast` | Instant feedback, detailed metrics, minimal overhead |
|
|
711
717
|
| Complex validation rules | `validate` | Full control over validation options, recursive validation |
|
|
712
718
|
|
|
719
|
+
#### API Server (FastAPI)
|
|
720
|
+
|
|
721
|
+
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.
|
|
722
|
+
|
|
723
|
+
**Running the Server (Local):**
|
|
724
|
+
```bash
|
|
725
|
+
# Requires fastapi and uvicorn
|
|
726
|
+
pip install "stac-valid[server]"
|
|
727
|
+
python server/server.py
|
|
728
|
+
```
|
|
729
|
+
|
|
730
|
+
**Running the Server (Docker):**
|
|
731
|
+
```bash
|
|
732
|
+
# Pull and run the official GitHub container image
|
|
733
|
+
docker run -p 8000:8000 ghcr.io/stac-utils/stac-validator:latest
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
**Validate via local script:**
|
|
737
|
+
```bash
|
|
738
|
+
python server/test_api.py sample_data/item.json
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
**Validate via curl:**
|
|
742
|
+
```bash
|
|
743
|
+
curl -X POST http://localhost:8000/validate \
|
|
744
|
+
-H "Content-Type: application/json" \
|
|
745
|
+
-d @sample_data/item.json
|
|
746
|
+
```
|
|
747
|
+
|
|
748
|
+
**Response Format:**
|
|
749
|
+
The API returns a detailed JSON summary including performance metrics and error breakdowns:
|
|
750
|
+
```json
|
|
751
|
+
{
|
|
752
|
+
"path": "request_body",
|
|
753
|
+
"valid_stac": true,
|
|
754
|
+
"total_objects": 100,
|
|
755
|
+
"valid_objects": 100,
|
|
756
|
+
"invalid_objects": 0,
|
|
757
|
+
"setup_time_ms": 0.25,
|
|
758
|
+
"execution_time_ms": 25.4,
|
|
759
|
+
"errors": []
|
|
760
|
+
}
|
|
761
|
+
```
|
|
762
|
+
|
|
713
763
|
### Python
|
|
714
764
|
|
|
715
765
|
**Single File Validation**
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
[](https://github.com/stac-utils/stac-validator/graphs/contributors)
|
|
11
11
|
[](https://github.com/stac-utils/stac-validator/stargazers)
|
|
12
12
|
[](https://github.com/stac-utils/stac-validator/network/members)
|
|
13
|
-
[](https://pypi.org/project/stac-valid/)
|
|
14
14
|
[](https://github.com/radiantearth/stac-spec/tree/v1.1.0)
|
|
15
15
|
|
|
16
16
|
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
- [Legacy Validation](#legacy-validation)
|
|
47
47
|
- [Batch Validation](#batch-validation)
|
|
48
48
|
- [Fast Validation](#fast-validation)
|
|
49
|
+
- [API Server (FastAPI)](#api-server-fastapi)
|
|
49
50
|
- [Python](#python)
|
|
50
51
|
- [Schema Cache Settings](#schema-cache-settings)
|
|
51
52
|
- [Performance Benchmarking](#performance-benchmarking)
|
|
@@ -668,6 +669,50 @@ else:
|
|
|
668
669
|
| Development/testing | `fast` | Instant feedback, detailed metrics, minimal overhead |
|
|
669
670
|
| Complex validation rules | `validate` | Full control over validation options, recursive validation |
|
|
670
671
|
|
|
672
|
+
#### API Server (FastAPI)
|
|
673
|
+
|
|
674
|
+
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.
|
|
675
|
+
|
|
676
|
+
**Running the Server (Local):**
|
|
677
|
+
```bash
|
|
678
|
+
# Requires fastapi and uvicorn
|
|
679
|
+
pip install "stac-valid[server]"
|
|
680
|
+
python server/server.py
|
|
681
|
+
```
|
|
682
|
+
|
|
683
|
+
**Running the Server (Docker):**
|
|
684
|
+
```bash
|
|
685
|
+
# Pull and run the official GitHub container image
|
|
686
|
+
docker run -p 8000:8000 ghcr.io/stac-utils/stac-validator:latest
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
**Validate via local script:**
|
|
690
|
+
```bash
|
|
691
|
+
python server/test_api.py sample_data/item.json
|
|
692
|
+
```
|
|
693
|
+
|
|
694
|
+
**Validate via curl:**
|
|
695
|
+
```bash
|
|
696
|
+
curl -X POST http://localhost:8000/validate \
|
|
697
|
+
-H "Content-Type: application/json" \
|
|
698
|
+
-d @sample_data/item.json
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
**Response Format:**
|
|
702
|
+
The API returns a detailed JSON summary including performance metrics and error breakdowns:
|
|
703
|
+
```json
|
|
704
|
+
{
|
|
705
|
+
"path": "request_body",
|
|
706
|
+
"valid_stac": true,
|
|
707
|
+
"total_objects": 100,
|
|
708
|
+
"valid_objects": 100,
|
|
709
|
+
"invalid_objects": 0,
|
|
710
|
+
"setup_time_ms": 0.25,
|
|
711
|
+
"execution_time_ms": 25.4,
|
|
712
|
+
"errors": []
|
|
713
|
+
}
|
|
714
|
+
```
|
|
715
|
+
|
|
671
716
|
### Python
|
|
672
717
|
|
|
673
718
|
**Single File Validation**
|
|
@@ -4,12 +4,16 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "stac_valid"
|
|
7
|
-
version = "4.
|
|
7
|
+
version = "4.3.0"
|
|
8
8
|
description = "A package to validate STAC files"
|
|
9
9
|
authors = [
|
|
10
10
|
{name = "James Banting"},
|
|
11
11
|
{name = "Jonathan Healy", email = "jon@healy-hyperspatial.dev"}
|
|
12
12
|
]
|
|
13
|
+
maintainers = [
|
|
14
|
+
{name = "Jonathan Healy", email = "jon@healy-hyperspatial.dev"},
|
|
15
|
+
{name = "Healy Hyperspatial"}
|
|
16
|
+
]
|
|
13
17
|
license = {text = "Apache-2.0"}
|
|
14
18
|
classifiers = [
|
|
15
19
|
"Intended Audience :: Information Technology",
|
|
@@ -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,9 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: stac_valid
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.3.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)
|
|
@@ -710,6 +716,50 @@ else:
|
|
|
710
716
|
| Development/testing | `fast` | Instant feedback, detailed metrics, minimal overhead |
|
|
711
717
|
| Complex validation rules | `validate` | Full control over validation options, recursive validation |
|
|
712
718
|
|
|
719
|
+
#### API Server (FastAPI)
|
|
720
|
+
|
|
721
|
+
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.
|
|
722
|
+
|
|
723
|
+
**Running the Server (Local):**
|
|
724
|
+
```bash
|
|
725
|
+
# Requires fastapi and uvicorn
|
|
726
|
+
pip install "stac-valid[server]"
|
|
727
|
+
python server/server.py
|
|
728
|
+
```
|
|
729
|
+
|
|
730
|
+
**Running the Server (Docker):**
|
|
731
|
+
```bash
|
|
732
|
+
# Pull and run the official GitHub container image
|
|
733
|
+
docker run -p 8000:8000 ghcr.io/stac-utils/stac-validator:latest
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
**Validate via local script:**
|
|
737
|
+
```bash
|
|
738
|
+
python server/test_api.py sample_data/item.json
|
|
739
|
+
```
|
|
740
|
+
|
|
741
|
+
**Validate via curl:**
|
|
742
|
+
```bash
|
|
743
|
+
curl -X POST http://localhost:8000/validate \
|
|
744
|
+
-H "Content-Type: application/json" \
|
|
745
|
+
-d @sample_data/item.json
|
|
746
|
+
```
|
|
747
|
+
|
|
748
|
+
**Response Format:**
|
|
749
|
+
The API returns a detailed JSON summary including performance metrics and error breakdowns:
|
|
750
|
+
```json
|
|
751
|
+
{
|
|
752
|
+
"path": "request_body",
|
|
753
|
+
"valid_stac": true,
|
|
754
|
+
"total_objects": 100,
|
|
755
|
+
"valid_objects": 100,
|
|
756
|
+
"invalid_objects": 0,
|
|
757
|
+
"setup_time_ms": 0.25,
|
|
758
|
+
"execution_time_ms": 25.4,
|
|
759
|
+
"errors": []
|
|
760
|
+
}
|
|
761
|
+
```
|
|
762
|
+
|
|
713
763
|
### Python
|
|
714
764
|
|
|
715
765
|
**Single File Validation**
|
|
@@ -3,7 +3,7 @@ import os
|
|
|
3
3
|
import time
|
|
4
4
|
import urllib.error
|
|
5
5
|
import urllib.request
|
|
6
|
-
from typing import Any, Dict, List
|
|
6
|
+
from typing import Any, Dict, List, Set
|
|
7
7
|
|
|
8
8
|
import click
|
|
9
9
|
import fastjsonschema # type: ignore
|
|
@@ -110,7 +110,7 @@ def get_validator(stac_type: str, stac_version: str, extensions: List[str]):
|
|
|
110
110
|
import jsonschema
|
|
111
111
|
|
|
112
112
|
# Create a validator using the same custom logic
|
|
113
|
-
def fallback_validator(data):
|
|
113
|
+
def fallback_validator(data: Dict[str, Any]) -> None:
|
|
114
114
|
# We need a resolver to handle the remote $refs
|
|
115
115
|
resolver = jsonschema.RefResolver(
|
|
116
116
|
base_uri="",
|
|
@@ -200,8 +200,8 @@ class FastValidator:
|
|
|
200
200
|
valid_count = 0
|
|
201
201
|
invalid_count = 0
|
|
202
202
|
error_registry: Dict[str, List[str]] = {}
|
|
203
|
-
stac_versions_found:
|
|
204
|
-
schemas_checked:
|
|
203
|
+
stac_versions_found: Set[str] = set()
|
|
204
|
+
schemas_checked: Set[str] = set()
|
|
205
205
|
|
|
206
206
|
for index, item in enumerate(items_to_validate):
|
|
207
207
|
# Determine specific STAC attributes for this object
|
|
@@ -3,7 +3,7 @@ import json
|
|
|
3
3
|
import logging
|
|
4
4
|
import os
|
|
5
5
|
import ssl
|
|
6
|
-
from typing import Dict, Optional, Tuple
|
|
6
|
+
from typing import Dict, Optional, Set, Tuple
|
|
7
7
|
from urllib.parse import urlparse
|
|
8
8
|
from urllib.request import Request, urlopen
|
|
9
9
|
|
|
@@ -233,7 +233,7 @@ def _fetch_and_parse_schema_cache_clear() -> None:
|
|
|
233
233
|
_schema_cache.cache_clear()
|
|
234
234
|
|
|
235
235
|
|
|
236
|
-
_cached_schemas = set()
|
|
236
|
+
_cached_schemas: Set[str] = set()
|
|
237
237
|
|
|
238
238
|
|
|
239
239
|
def _map_extension_url_to_local(url: str) -> str:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|