Skip to content

Validate EU Digital Product Passports with Python - 80k ops/sec.

dppvalidator

PyPI version Python versions Downloads License CI Platform

A Python library for validating Digital Product Passports (DPP) according to EU ESPR regulations and UNTP standards.


Features

  • Seven-Layer Validation — Schema, Model, Semantic, JSON-LD, Vocabulary, Plugin, and Signature validation
  • UNTP DPP Schema Support — Both 0.6.x and 0.7.0 (default) wire formats; auto-detected from @context / $schema URLs. See UNTP DPP versions.
  • Compat shim 0.6 → 0.7dppvalidator migrate upgrades v0.6.x payloads to v0.7.0 shape with structured warnings. See the migration guide.
  • High Performance — 80,000+ validations per second
  • Plugin System — Extensible with custom validators and exporters; version-aware rules with applies_to_versions opt-in.
  • JSON-LD Export — W3C Verifiable Credentials compliant output
  • CLI & API — Use from command line or programmatically

Quick Install

Text Only
```
uv add dppvalidator
```
Text Only
```
pip install dppvalidator
```

Quick Start

Validate a DPP file

Python
from dppvalidator.validators import ValidationEngine

engine = ValidationEngine()
result = engine.validate(
    {
        "id": "https://example.com/dpp/12345",
        "issuer": {"id": "https://example.com/issuer", "name": "Acme Corp"},
    }
)

if result.valid:
    print("DPP is valid!")
else:
    for error in result.errors:
        print(f"{error.path}: {error.message}")

Command Line

Bash
# Validate a DPP JSON file (auto-detects version from the payload)
dppvalidator validate passport.json

# Pin a specific UNTP version
dppvalidator validate passport.json --schema-version 0.7.0

# Upgrade a v0.6.x payload to v0.7.0 shape
dppvalidator migrate passport.json -o passport-v07.json

# Validate-after-upgrade in one shot
dppvalidator validate passport.json --upgrade-from 0.6.1 --schema-version 0.7.0

# Export to JSON-LD
dppvalidator export passport.json --format jsonld

# List every registered UNTP version
dppvalidator schema list

Documentation

For AI Assistants

Contributing

We welcome contributions! See our Contributing Guide to get started.

License

MIT License - see LICENSE for details.