Skip to main content

dpm-xl

Parse and evaluate EBA DPM-XL validation rules in Python.

A Python parser and evaluator for DPM-XL, the expression language of EBA validation rules and similar checks. Give it a rule and your report data; it tells you which records fail and explains each failure in plain numbers.

dpm-xl is an independent project, not affiliated with or endorsed by the European Banking Authority.

Installation

pip install dpm-xl               # Python 3.11+, no dependencies
pip install "dpm-xl[columnar]"   # adds the polars evaluator

Quickstart

from dpmxl import MemoryProvider, Number, TableLayout, evaluate_rule, explain

layout = TableLayout("C_01.00", rows=("0010", "0020", "0030"), columns=("0010", "0020"))
values = {  # (table, row, column, sheet, open keys) -> value with XBRL decimals
    ("C_01.00", "0010", "0010", None, ()): Number.of(100, 0),
    ("C_01.00", "0020", "0010", None, ()): Number.of(60, 0),
    ("C_01.00", "0030", "0010", None, ()): Number.of(40, 0),
    ("C_01.00", "0010", "0020", None, ()): Number.of(1204, 0),
    ("C_01.00", "0020", "0020", None, ()): Number.of(1180, 0),
    ("C_01.00", "0030", "0020", None, ()): Number.of(31, 0),
}
provider = MemoryProvider([layout], values)

expression = (
    "with {tC_01.00, c*, default: 0, interval: true}: {r0010} = {r0020} + {r0030}"
)
result = evaluate_rule(expression, provider, precondition="{v_C_01.00}")

print(result.status, result.counts)
for outcome in result.failures:
    print(outcome.key, explain(result.evaluation, expression, outcome.key).summary)
failed {'passed': 1, 'failed': 1, 'null': 0}
{'c': '0020'} 1,204 should equal 1,211 (1,180 + 31): difference 7, at least 5.5 given the reported precision

On the command line, against a JSON data file:

dpm-xl check rules.json            # report every problem in every expression
dpm-xl eval rules.json data.json   # evaluate and explain every rule

Features

  • Parses every construct of the DPM-XL grammar, including every EBA validation rule and precondition of DPM releases 3.4–4.4 (14,000+ distinct expressions, about 0.1 ms each).
  • Evaluates them with EBA's interval arithmetic, null logic and key joins, and points each failure at the cells involved.
  • Finds problems before evaluation, for editors and CI: every syntax error, unknown functions and tables, coordinates a table lacks, keys and operand types, each with its position and, where one fits, a suggested fix.
  • Has no dependencies. The optional columnar extra adds a polars evaluator for reports with millions of open-table rows.
  • Reads no files and knows no DPM release: data comes through a three-method provider, so the same evaluator runs against a report upload, a database or test fixtures. dpm-xbrl reads xBRL-CSV and XBRL-XML reports.

Toolkit

Part of the dpm toolkit, three Python packages that work together:

Package What it does
dpm-xl Parse and evaluate DPM-XL validation rules (this package)
dpm-xbrl Read, write and check xBRL-CSV and XBRL-XML reports
dpm-synth Generate test reports that satisfy DPM-XL rules

The toolkit tour takes one report through all three: generated with dpm-synth, read with dpm-xbrl, then evaluated and explained with dpm-xl.

Documentation

Documentation: https://luukhopman.github.io/dpm-xl/

Development

uv sync
uv run pytest
uv run ruff check
uv run ruff format --check
uv run ty check
uv run python scripts/build_docs.py

See contributing.

Licence

MIT. See LICENSE.

Metadata

Release files for dpm-xl 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dpm-xl 1.2.0
File Size Uploaded Provenance
dpm_xl-1.2.0.tar.gz 117.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for dpm-xl 1.2.0
File Interpreter ABI Platform
dpm_xl-1.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 240.8 kB

Release files / dpm_xl-1.2.0.tar.gz

Download URL dpm_xl-1.2.0.tar.gz
Size 117.1 kB
Tags Source
SHA-256 checksum
How to use checksums
87944e8c45426f008070f940a1f9e42f08874466a83756d45b85e753a09f0965
BLAKE2b-256 checksum
How to use checksums
dc4c848856cda11d7ddf6cf8a31b3176834aa19bb1b68b05f4a348084ecc0142
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / dpm_xl-1.2.0-py3-none-any.whl

Download URL dpm_xl-1.2.0-py3-none-any.whl
Size 123.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ae3b6c1157ae2fa998cdefc6d9b96284aa9a7f9c8edb3a3d73f5752d6b7d941b
BLAKE2b-256 checksum
How to use checksums
5e56d987f23392fdd1a44c5342c0ca830e20e3f7ef515b1082428b81facc4cd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for dpm-xl 1.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page