Skip to main content

Python library for validating Digital Product Passports (DPP) according to EU ESPR regulations and CIRPASS/UNECE ontologies

Project description

dppvalidator

The open-source compliance engine for EU Digital Product Passports

PyPI version Python versions Downloads License CI Documentation

InstallationQuick StartFeaturesDocumentationContributing


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

Starting 2027, every textile and apparel product sold in the EU must have a Digital Product Passport. This library ensures your DPP data is compliant before it hits production — saving fashion brands from costly compliance failures and enabling seamless integration with the circular economy.

Why dppvalidator?

Challenge Solution
Complex JSON Schema validation Three-layer validation catches errors at schema, model, and semantic levels
Evolving UNTP specifications Built-in schema support for UNTP DPP 0.6.1 with easy version switching
Integration with existing systems CLI + Python API for pipelines, CI/CD, and application integration
Custom business rules Plugin system for domain-specific validators and exporters
Interoperability requirements JSON-LD export for W3C Verifiable Credentials compliance

Installation

# Using uv (recommended)
uv add dppvalidator

# Using pip
pip install dppvalidator

# With CLI extras (rich formatting)
pip install dppvalidator[cli]

Requirements: Python 3.10+

Quick Start

Validate a DPP

from dppvalidator.validators import ValidationEngine

engine = ValidationEngine()

result = engine.validate(
    {
        "id": "https://example.com/dpp/battery-001",
        "type": ["DigitalProductPassport", "VerifiableCredential"],
        "issuer": {
            "id": "https://example.com/manufacturer",
            "name": "Acme Battery Co.",
        },
        "credentialSubject": {
            "id": "https://example.com/product/battery-001",
            "product": {
                "name": "EV Battery Pack",
                "description": "High-capacity lithium-ion battery",
            },
        },
    }
)

if result.valid:
    print(f"✓ Valid in {result.validation_time_ms:.2f}ms")
else:
    for error in result.errors:
        print(f"✗ [{error.code}] {error.path}: {error.message}")

Command Line

# Validate a DPP file
dppvalidator validate passport.json

# Strict mode - warnings become errors
dppvalidator validate passport.json --strict

# Export to JSON-LD (W3C Verifiable Credential format)
dppvalidator export passport.json --format jsonld --output passport.jsonld

# Display schema information
dppvalidator schema --version 0.6.1

Export to JSON-LD

from dppvalidator.models import DigitalProductPassport, CredentialIssuer
from dppvalidator.exporters import JSONLDExporter

passport = DigitalProductPassport(
    id="https://example.com/dpp/product-001",
    issuer=CredentialIssuer(
        id="https://example.com/issuer", name="Sustainable Textiles Ltd."
    ),
)

exporter = JSONLDExporter()
jsonld_output = exporter.export(passport)
# Ready for W3C Verifiable Credentials ecosystem

Features

Three-Layer Validation Architecture

flowchart TD
    A[/"📄 Input Data (JSON)"/] --> B

    subgraph Layer1["🔷 Layer 1: Schema Validation"]
        B["JSON Schema Draft 2020-12<br/>Required fields, types, formats"]
    end

    B -->|"SCH001-SCH099"| C

    subgraph Layer2["🔶 Layer 2: Model Validation"]
        C["Pydantic v2 Models<br/>Type coercion, URL validation"]
    end

    C -->|"MOD001-MOD099"| D

    subgraph Layer3["🟢 Layer 3: Semantic Validation"]
        D["Business Rules & Vocabularies<br/>ISO codes, date logic, references"]
    end

    D -->|"SEM001-SEM099"| E[/"✅ ValidationResult<br/>.valid | .errors | .warnings"/]

Selective Layer Validation

from dppvalidator.validators import ValidationEngine

# Run all layers (default)
engine = ValidationEngine()

# Schema validation only (fastest)
engine = ValidationEngine(layers=["schema"])

# Skip schema, run model + semantic
engine = ValidationEngine(layers=["model", "semantic"])

Performance

Layer Time Throughput
Schema ~5μs 200,000 ops/sec
Model ~8μs 125,000 ops/sec
Semantic ~3μs 333,000 ops/sec
All ~13μs 80,000 ops/sec

Benchmarked on Apple M2, Python 3.12

Plugin System

Extend dppvalidator with custom validators following the SemanticRule protocol:

from dppvalidator.plugins import PluginRegistry


# Create a custom validator implementing SemanticRule protocol
class TextileFiberRule:
    """Custom rule to validate textile fiber composition."""

    rule_id = "TEX001"
    description = "Fiber composition must sum to 100%"
    severity = "error"
    suggestion = "Ensure all fiber percentages add up to 100"
    docs_url = "https://example.com/textile-rules"

    def check(self, passport):
        """Return list of (json_path, error_message) tuples."""
        violations = []
        # Add your validation logic here
        return violations


# Register with the plugin registry
registry = PluginRegistry(auto_discover=False)
registry.register_validator("textile", TextileFiberRule)

# ValidationEngine auto-discovers plugins via entry points by default
engine = ValidationEngine(load_plugins=True)

Documentation

📚 Full documentation: artiso-ai.github.io/dppvalidator

Guide Description
Installation Setup and optional dependencies
Quick Start Get started in 5 minutes
CLI Reference Command-line interface
Validation Layers Understanding the three-layer architecture
API Reference Complete Python API

Built for Fashion & Textiles

The EU's Ecodesign for Sustainable Products Regulation (ESPR) mandates Digital Product Passports for textiles starting 2027. dppvalidator helps fashion brands prepare now:

DPP Requirement How dppvalidator Helps
Material composition & weights Validates fiber percentages sum to 100%
Manufacturing processes Validates supply chain node structure
Environmental indicators Supports LCA data validation
Chemical compliance (REACH) Semantic validation for substance references
Traceability information Validates production stage URIs
Durability & recyclability Custom validators via plugin system

Use Cases

dppvalidator serves diverse stakeholders across the product lifecycle:

Use Case Target User Value Proposition
Pre-production validation Brand product teams Catch errors before QR code generation
Supplier onboarding Procurement teams Validate supplier DPP submissions
CI/CD compliance gates DevOps teams Automated compliance checks in pipelines
Data migration IT teams Validate legacy data exports to DPP format
Consumer apps App developers DPP scanning, parsing, and display
Recycling facilities Waste management Material identification for sorting
Resale platforms Recommerce Product authentication and history
Customs & compliance Border control Import compliance verification

Example: CI/CD Integration

# .github/workflows/validate-dpp.yml
- name: Validate DPP files
  run: dppvalidator validate data/passports/*.json --strict

Example: Supplier Validation API

from dppvalidator.validators import ValidationEngine

engine = ValidationEngine(strict_mode=True)


def validate_supplier_submission(dpp_json: dict) -> bool:
    result = engine.validate(dpp_json)
    if not result.valid:
        raise ValueError(f"Invalid DPP: {result.errors}")
    return True

Related Standards

⚠️ Note on UNTP Specification: The UNTP Digital Product Passport specification is under active development and not yet ready for production implementation. We track the latest maintained releases and will update dppvalidator as the specification stabilizes. See the UNTP releases page for current status.

Contributing

We welcome contributions! Here's how to get started:

# Clone the repository
git clone https://github.com/artiso-ai/dppvalidator.git
cd dppvalidator

# Install dependencies with uv
uv sync --all-extras

# Run tests
uv run pytest

# Run linting
uv run ruff check .

See our Contributing Guide for more details.

About ARTISO

dppvalidator is developed and maintained by ARTISO, a Barcelona-based fashion technology company.

ARTISO

We believe the fashion industry's transition to sustainability requires open, accessible tools. By open-sourcing dppvalidator, we're enabling brands of all sizes - from emerging designers to global retailers - to meet EU compliance requirements without proprietary solutions.

Our commitment:

  • Open Source First - Core validation engine will always be free and MIT-licensed
  • Fashion Expertise - Built by a team with deep industry experience at major brands
  • Circular Economy - Enabling the data infrastructure for textile recycling and resale
  • Community Driven - We welcome contributions from brands, sustainability experts, and developers

"The circular economy can only work if recyclers can read the tags. dppvalidator ensures interoperability across the entire fashion supply chain."

License

MIT License — see LICENSE for details.


artiso.ai · Documentation · Issues

Built with ❤️ in Barcelona for a more sustainable fashion industry

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dppvalidator-0.2.2.tar.gz (402.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dppvalidator-0.2.2-py3-none-any.whl (113.8 kB view details)

Uploaded Python 3

File details

Details for the file dppvalidator-0.2.2.tar.gz.

File metadata

  • Download URL: dppvalidator-0.2.2.tar.gz
  • Upload date:
  • Size: 402.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dppvalidator-0.2.2.tar.gz
Algorithm Hash digest
SHA256 40f21f17d47b7b69431d21dab15dce144895e9d4cf98a9e1babefca734fe84f7
MD5 89b0a6a1fd3591644599127a0a03e687
BLAKE2b-256 cc6df547e2d29c4df7398fba38d9eb48f39717873d8f9c412fa613059456963f

See more details on using hashes here.

Provenance

The following attestation bundles were made for dppvalidator-0.2.2.tar.gz:

Publisher: release.yml on artiso-ai/dppvalidator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dppvalidator-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: dppvalidator-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 113.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dppvalidator-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 18181467ca0642af80d6ceac77ec109954b9c5cdb54a70b2be421901b8d051fa
MD5 d41489df9e61216235a99d1c6fe3e864
BLAKE2b-256 885ea904f05af4649cffa6d1f19eface3a271397000f277c2c3040d1e5b39922

See more details on using hashes here.

Provenance

The following attestation bundles were made for dppvalidator-0.2.2-py3-none-any.whl:

Publisher: release.yml on artiso-ai/dppvalidator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page