This release is a pre-release and may not be stable for production use.
dpdpkit-core
The rules engine behind dpdpkit. It provides a consent ledger, versioned notices, rights requests and grievances, retention and erasure, audit evidence, and a CLI for India's Digital Personal Data Protection Act, 2023 and DPDP Rules, 2025.
Disclaimer. dpdpkit is software that helps you implement obligations under India's Digital Personal Data Protection Act, 2023 and the DPDP Rules, 2025. It does not provide legal advice and does not guarantee compliance. Decisions about notices, purposes, retention and incident reporting must be made by you or your counsel.
Core has no web framework and no database driver. Framework adapters
(dpdpkit-fastapi, dpdpkit-django) implement its
Repository protocol and expose it over the REST contract defined in
dpdpkit-spec.
Install
pip install dpdpkit # core + policy packs + CLI
pip install "dpdpkit[fastapi]" # with the FastAPI adapter
Use
from dpdpkit import InMemoryRepository, MemoryNotifier, kit_from_config, load_config, sync_notice
config = load_config("dpdpkit.yaml") # `dpdpkit init` writes a starter file
kit = kit_from_config(config, InMemoryRepository(), notifier=MemoryNotifier(), signing_key="change-me")
sync_notice(kit, config) # publishes the notice if its text changed
kit.consent.grant("u_42", "marketing") # recorded against the current notice version
kit.consent.check("u_42", "marketing") # True
kit.consent.withdraw("u_42", "marketing") # one call, same as granting
kit.rights.open("u_42", "erasure") # due dates come from the policy pack
kit.retention.run() # warns, then erases only after a delivered warning
kit.ledger.verify() # raises LedgerTampered(row_id) if a row was edited
Modules
| Module | Responsibility |
|---|---|
dpdpkit.policy |
Load and validate a policy pack; typed accessors for every legal number |
dpdpkit.registry |
Purposes, data items, legal basis (consent / DPDP Act s.7), processors, data stores |
dpdpkit.notices |
Versioned notices, content hash, locale fallback, required-link check |
dpdpkit.ledger |
Append-only SHA-256 hash chains (consent + audit) per tenant, verify(), root-hash export |
dpdpkit.consent |
grant, deny, withdraw, check, current state, signed receipts |
dpdpkit.rights |
Access, correction, completion, updating, erasure, nomination and grievance requests |
dpdpkit.retention |
Erasure schedules, pre-erasure warnings, legal holds, needs_attention, processor fan-out |
dpdpkit.events |
In-process event bus and HMAC-signed webhooks |
dpdpkit.notify |
Notifier protocol with delivery receipts; memory, console and SMTP transports |
dpdpkit.ses |
Amazon SES email transport (dpdpkit-core[ses]); optional tracked delivery from SES events via SQS |
dpdpkit.export |
Principal export (JSON, HTML) and evidence packs (CSV + PDF zip) |
dpdpkit.templates |
Industry purpose templates: ed-tech, health, e-commerce, fintech, SaaS |
dpdpkit.review |
Notice review packs for counsel: automated Rule 3 checks, questions, sign-off bound to content hashes |
dpdpkit.workbook |
Data-mapping workbook (.xlsx, dpdpkit-core[workbook]): import to dpdpkit.yaml, PII scan report |
dpdpkit.telemetry |
Opt-in anonymous usage telemetry; off by default (see below) |
Fail-safe rules
- An erasure runs only after its warning is recorded as delivered, and only once the full warning
period has passed since delivery. Otherwise it moves to a
needs_attentionqueue. - Missing contact details, failed deliveries, failing erasure handlers and legal holds all stop erasure.
- Every state change writes a ledger or audit entry before it takes effect.
- A missing or invalid policy pack means the kit refuses to start. There are no built-in defaults.
- There is no function that submits anything to an authority.
CLI
dpdpkit init # starter dpdpkit.yaml
dpdpkit init --template edtech # industry purpose template (--list-templates)
dpdpkit notice check # automated notice checks; exit 1 on a failed check
dpdpkit notice review --out notice-review.md # review pack for counsel (or --template edtech)
dpdpkit workbook new --template edtech # data-mapping workbook (needs the workbook extra)
dpdpkit workbook import data-mapping.xlsx --base dpdpkit.yaml --out dpdpkit.yaml
dpdpkit workbook report data-mapping.xlsx --out scan-report.md
dpdpkit policy show | list | diff OLD NEW
dpdpkit ledger verify --kit myapp.dpdp:kit # exit code 2 if tampered
dpdpkit retention preview --kit myapp.dpdp:kit
dpdpkit export --principal u_42 --format html --kit myapp.dpdp:kit
dpdpkit export --evidence --out evidence.zip --kit myapp.dpdp:kit
dpdpkit telemetry status | enable | disable | show
Telemetry
dpdpkit does not call home. Telemetry is off by default and stays off unless you opt in.
| To | Do |
|---|---|
| See whether it is on, and why | dpdpkit telemetry status |
| Opt in for your user | dpdpkit telemetry enable (stores a random install id in telemetry.json) |
| Opt out and delete the install id | dpdpkit telemetry disable |
| Opt in for one process or container | DPDPKIT_TELEMETRY=1 (a fresh random id per process unless you ran enable) |
| Force it off, whatever is stored | DPDPKIT_TELEMETRY=0 or DO_NOT_TRACK=1 |
| Choose the collector | DPDPKIT_TELEMETRY_URL=https://… (HTTPS only) |
| See exactly what would be sent | dpdpkit telemetry show |
telemetry.json lives in DPDPKIT_CONFIG_DIR if set, else %APPDATA%\dpdpkit on Windows, else
$XDG_CONFIG_HOME/dpdpkit or ~/.config/dpdpkit.
There is no default collector yet, so opting in sends nothing until DPDPKIT_TELEMETRY_URL is set.
When it is on and a collector is set, dpdpkit posts one small JSON document per event per process. It sends
kit_started when a Kit is created and cli when a dpdpkit command runs. Each document is sent from a
background thread with a 2-second timeout, and failures are ignored. A document holds only these fields:
| Field | Example |
|---|---|
schema |
1 |
install_id |
random hex id, not derived from your machine |
event |
kit_started or cli |
dpdpkit_core, packages |
installed dpdpkit* distributions and versions |
python, os |
3.12, Linux |
policy (kit_started) |
a shipped pack id such as dpdp-rules-2025.v1, or custom |
command (cli) |
the top-level command name, such as ledger |
It never includes principals, tenants, consent or request data, configuration, notice text, file paths or host names. The code refuses any other field. Any HTTP request reveals the sender's IP address to the collector. A collector for dpdpkit must not store it.
Writing an adapter
Implement dpdpkit.repository.Repository (see its docstring for the rules) and run the
dpdpkit-conformance suite from dpdpkit-spec against your HTTP layer.
Development
uv venv && uv pip install -e ../dpdpkit-policies -e ".[dev]"
pytest && ruff check . && mypy
Licence
Apache-2.0.
Metadata
Release files for dpdpkit-core 0.1.0a2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dpdpkit_core-0.1.0a2.tar.gz | 137.5 kB | With provenance | Details for dpdpkit_core-0.1.0a2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dpdpkit_core-0.1.0a2-py3-none-any.whl | Python 3 | none | any | Details for dpdpkit_core-0.1.0a2-py3-none-any.whl |
Total release size: 260.8 kB
Release files / dpdpkit_core-0.1.0a2.tar.gz
| Download URL | dpdpkit_core-0.1.0a2.tar.gz |
|---|---|
| Size | 137.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b0ba6256b5c9cffc0da0a3e607493ac566db535acc72c2f0f3616409887cc11
|
|
BLAKE2b-256 checksum How to use checksums |
3e8acc75145a79e5d1fd4e34b57f3ab176cb4eb3e118c8307e14fc846c7e5bed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logRelease files / dpdpkit_core-0.1.0a2-py3-none-any.whl
| Download URL | dpdpkit_core-0.1.0a2-py3-none-any.whl |
|---|---|
| Size | 123.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1beb9183b88bf6e9e5d7085609a1e66233fc32ef01b81012e8d3351e029c3159
|
|
BLAKE2b-256 checksum How to use checksums |
6b9a37c889ffdcc992ca370631fd0918341c075e848219f667d962cc630eef4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logSecurity for dpdpkit-core 0.1.0a2
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for dpdpkit_core-0.1.0a2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logA 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.