⚠️ IMPORTANT NOTICE: PyPI Package Renamed ⚠️ Due to an administrative transition, the PyPI package name for this project has changed. The stac-validator package on PyPI is no longer maintained. To get the latest updates, bug fixes, and features (v4.2.0 and beyond), you must now install stac-valid . 🛠️ What you need to do You only need to update your installation command or requirements.txt : # OLD pip install stac-validator # NEW pip install stac-valid Your existing Python code and CLI scripts DO NOT need to change. > You will still use import stac_validator and the stac-validator CLI command exactly as you did before.
⚠️ IMPORTANT NOTICE: PyPI Package Renamed ⚠️
Due to an administrative transition, the PyPI package name for this project has changed. The stac-validator package on PyPI is no longer maintained.
To get the latest updates, bug fixes, and features (v4.2.0 and beyond), you must now install stac-valid .
🛠️ What you need to do
You only need to update your installation command or requirements.txt :
Your existing Python code and CLI scripts DO NOT need to change. > You will still use import stac_validator and the stac-validator CLI command exactly as you did before.
Supported STAC Versions
Usage CLI Legacy Validation Batch Validation Fast Validation API Server (FastAPI) Python
CLI Legacy Validation
Schema Cache Settings
Performance Benchmarking
Examples Core Validation Custom Schema Extensions Validation Recursive Validation Item Collection Validation Using Headers Schema Mapping Schema Config Pydantic Validation
Extensions Validation
Item Collection Validation
Deployment Docker AWS (CDK)
Sponsors and Supporters
STAC Validator is a tool to validate STAC (SpatioTemporal Asset Catalog) json files against the official STAC specification. It provides both a command-line interface and a Python API for validating STAC objects.
For detailed documentation, please visit our GitHub Pages documentation site .
Validate STAC json files against the STAC spec .
Python 3.8+ Requests Click Jsonschema
Note: Stac-validator is also used in stac-check which adds linting messages based on the official STAC best practices document.
Installation from PyPi
Installation from Repo
or for local development
The Makefile has convenience commands if Make is installed.
The validate command is the main legacy validation tool with comprehensive options:
--core - Validate core STAC only (skip extensions)
--extensions - Validate extensions only
--links - Validate link objects
--assets - Validate asset objects
--recursive - Recursively validate related STAC objects
--custom - Validate against custom schema
--schema-map - Replace schema URLs during validation
--collections - Validate /collections endpoint response
--item-collection - Validate item collection responses
--pydantic - Use Pydantic models for validation
--schema-cache-size - Configure schema cache size
--batch-size - Configure batch size for chunked processing (batch command only)
And more (see stac-validator validate --help )
The batch command validates multiple STAC files concurrently using multiprocessing to bypass Python's Global Interpreter Lock (GIL). This enables 10-100x performance improvement over single-threaded validation by utilizing all available CPU cores.
Multiprocessing: Each CPU core runs an independent Python process
Per-worker schema cache: Each worker maintains its own LRU cache of downloaded schemas (default 16 per worker)
Cache warmup: First file on each worker downloads schemas, subsequent files use cached copies
Configurable cache: Use --schema-cache-size to adjust cache size per worker (0 = disabled)
Linear scaling: Performance scales linearly with available cores (e.g., 8 cores = ~8x faster)
Container-aware: Automatically detects Docker/ECS CPU limits via os.sched_getaffinity()
Batch Size Configuration
The --batch-size option controls how many items are processed in each chunk. This affects memory usage and performance:
Default (2000): Balanced memory usage and performance for most systems
Larger values (5000-10000): Faster processing on systems with abundant memory; reduces overhead from creating multiple worker pools
Smaller values (500-1000): Lower memory footprint; useful on memory-constrained systems or when validating very large items
Startup: Detects available CPU cores (respects Docker limits)
Distribution: Distributes files across worker processes
Validation: Each worker validates files independently
Schema Caching: Each worker maintains its own LRU cache (default 16 schemas per worker) First file on a worker: schemas are fetched and cached Subsequent files: schemas are reused from cache (no network/disk I/O) Total memory: up to cores × schema_cache_size schemas in memory
First file on a worker: schemas are fetched and cached
Subsequent files: schemas are reused from cache (no network/disk I/O)
Total memory: up to cores × schema_cache_size schemas in memory
Results: Aggregates results and displays summary statistics
Performance Characteristics
Times vary based on schema complexity and network latency for first download
Bulk ingestion: Validate thousands of STAC items from ESA, Copernicus, or other catalogs
CI/CD pipelines: Validate entire dataset collections in GitHub Actions or AWS CodePipeline
Data quality checks: Periodically validate all items in a STAC catalog
Migration validation: Verify all items when upgrading STAC versions
API preprocessing: Validate incoming FeatureCollections before storage (see FastAPI integration)
The fast command provides ultra-high-speed validation using fastjsonschema with intelligent caching. It's optimized for large FeatureCollections, delivering batch-like performance with significantly lower memory overhead by using a single-threaded, compiled validator approach instead of multiprocessing.
fastjsonschema: Compiled validators for 10-100x faster validation than standard jsonschema
Single-threaded: No multiprocessing overhead - ideal for memory-constrained environments
Batch-comparable speed: Similar throughput to batch command but with minimal memory footprint
Multi-tier caching: RAM → Disk → Network with automatic fallback
Local schema storage: Schemas cached locally under local_schemas/.schemas directory for instant reuse
Automatic detection: Detects STAC type (Item, Collection, Catalog, FeatureCollection) automatically
Recursive traversal: Supports --recursive for local catalog/collection graphs
STAC API traversal: Supports --api to follow STAC API data, child, item, and items links
Detailed metrics: Shows setup time, execution time, and cache hit status for each item
Error grouping: Groups validation errors by type and shows affected items
🐌 (Slow): First validation - schemas being fetched and compiled
⚡ (Lightning): Cached validator - instant execution using pre-compiled validator
Schema Caching & Performance Improvement
The fast validator uses a multi-tier caching strategy that dramatically speeds up subsequent runs:
First Run: Schemas are downloaded from the network and compiled with fastjsonschema Setup time: 5-6 seconds (includes network fetch for all schemas + compilation) Per-item execution: 0.25ms Total for 100 items: ~5.4 seconds Total for 1000 items: ~10-11 seconds
First Run: Schemas are downloaded from the network and compiled with fastjsonschema
Setup time: 5-6 seconds (includes network fetch for all schemas + compilation)
Per-item execution: 0.25ms
Total for 100 items: ~5.4 seconds
Total for 1000 items: ~10-11 seconds
Subsequent Runs: Schemas are loaded from local disk cache ( .schemas/ directory) Setup time: 100-200ms (instant disk read + compilation from cache) Per-item execution: 0.25ms Total for 100 items: ~150-200ms Total for 1000 items: ~400-500ms (0.4-0.5 seconds) Speedup: 20-25x faster compared to first run
Subsequent Runs: Schemas are loaded from local disk cache ( .schemas/ directory)
Setup time: 100-200ms (instant disk read + compilation from cache)
Per-item execution: 0.25ms
Total for 100 items: ~150-200ms
Total for 1000 items: ~400-500ms (0.4-0.5 seconds)
Speedup: 20-25x faster compared to first run
Schemas are automatically cached in local_schemas/.schemas/ directory:
✅ No network calls on subsequent validations
✅ Instant schema availability across multiple runs
✅ Persistent cache survives process restarts
✅ Minimal disk space usage (schemas are typically <100KB each)
Performance Characteristics
The fast validator is optimized for:
Large FeatureCollections (100-100,000+ items)
Memory-constrained environments (single-threaded, no multiprocessing)
Rapid iteration during development
CI/CD pipelines where speed and memory efficiency are critical
Typical performance (subsequent runs with disk cache):
Setup time: 100-200ms (disk read + compilation from cached schemas)
Per-item execution: 0.23-0.25ms (compiled fastjsonschema validator)
Total time for 100 items: ~150-200ms
Total time for 1000 items: ~400-500ms (0.4-0.5 seconds)
Memory footprint: Single process, minimal overhead (vs. batch's multiprocessing overhead)
Batch vs. Fast Comparison
Choosing the Right Command
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.
Running the Server (Local):
Running the Server (Docker):
Validate via local script:
Response Format: The API returns a detailed JSON summary including performance metrics and error breakdowns:
Single File Validation
Dictionary Validation
Batch Validation - List of Dictionaries
For validating dictionaries directly without managing temp files, use validate_dicts() :
items - List of STAC item dictionaries
max_workers - CPU cores to use (None = auto-detect, positive int = specific cores, negative int = all minus N)
show_progress - Display progress bar (default: True)
chunk_size - Number of items to process at a time to bound disk and memory usage (default: 1000)
Batch Validation - FeatureCollection (Concurrent with Multiprocessing)
For FeatureCollection validation with multiprocessing, use validate_concurrently() with feature_collection=True :
Batch Validation - Multiple Files
Batch Validation - FeatureCollection Files
Item Collection Validation
Fast Validation (High-Speed with Local Caching)
For large FeatureCollections or when you need maximum speed with minimal memory overhead:
Configure Schema Cache Size
Schema Cache Settings
Default schema cache size is 16 entries.
Use --schema-cache-size in the CLI or set_schema_cache_size(...) in Python to override it.
Use 0 to disable schema caching.
Use set_schema_cache_size once at application startup:
StacValidate() and validate_dict() do not accept a cache-size parameter.
Changing cache size at runtime replaces the cache instance and drops existing cached entries.
In multi-worker deployments, configure cache size in each worker process.
Performance Benchmarking
A benchmark script is included to compare the performance of batch validation vs legacy item-collection validation. This is useful for understanding the performance improvements of the multiprocessing batch validator.
Running the Benchmark
Speedup Factor : Shows how many times faster batch validation is compared to legacy validation
Time Saved : The absolute time difference in seconds
CPU Cores Used : Number of CPU cores utilized by batch validation (typically all available cores)
The batch validator's multiprocessing approach provides significant performance improvements, especially for large datasets. The speedup factor varies based on:
Number of CPU cores available
Complexity of validation (extensions, custom schemas, etc.)
The validator can run using docker containers.
An example AWS CDK deployment is available in cdk-deployment
See the tests files for examples on different usages.
Schema map allows stac-validator to replace a schema in a STAC json by a schema from another URL or local schema file. This is especially useful when developing a schema and testing validation against your local copy of the schema.
This option is also capable of replacing URLs to subschemas:
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.
Example schema config file (YAML):
The paths in the config file can be absolute or relative to the config file's location.
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:
Then you can validate your STAC objects using Pydantic models:
Sponsors and Supporters
The following organizations have contributed time and/or funding to support the development of this project:
Radiant Earth Foundation
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the Apache License 2.0.
The full story
This article is one source in a clustered incident — the cluster page carries the summary, timeline and every other outlet covering it.
