Skip to main content

🛡️ Pynonymizer Core

License: MIT Security: Raptor Guard V2 MCP: Stdio Protocol Zero Dependencies Compliance: GDPR Art. 32

Pynonymizer Core is a native, zero-dependency in-memory SQLite database anonymization engine and GDPR/DSGVO test data generator designed for developers, CI/CD pipelines, and autonomous AI agents.

Freed from brittle host dependencies (pg_dump, mysql in $PATH) and heavy ORM overhead, Pynonymizer Core operates directly via Python's native sqlite3 runtime—either in-memory or on disk with safe copy-on-write isolation.


🌟 Key Features

  • Zero External Dependencies: Built purely on Python's standard library. Instant portability across Windows, Linux, and macOS without binary compilation.
  • Auto Strategy Inference: Intelligently detects PII columns (names, emails, phone numbers, addresses, salaries, tax IDs) and generates declarative masking strategies.
  • In-Memory & File-Safe Operations: Execute high-throughput anonymization entirely in RAM or create verified, scrubbed file copies.
  • Model Context Protocol (MCP) Ready: First-class Stdio JSON-RPC 2.0 interface for Claude Desktop, Cursor, Antigravity, and autonomous agent frameworks.
  • Raptor Guard V2 Certified: Hardened against SQL injection, column identifier tampering, and path traversal vectors.

🚀 Quickstart & Installation

Install directly via pip:

pip install .

Or install from distribution:

pip install pynonymizer-core

💻 CLI Usage

The command-line interface provides lightweight, modular commands for inspection, rule generation, and execution.

1. Inspect Database Schema

Inspect tables, columns, data types, and primary keys:

pynonymizer-core inspect /path/to/database.db

2. Auto-Generate Anonymization Strategy

Infer column semantics and export an editable strategy JSON file:

pynonymizer-core generate-strategy /path/to/database.db > strategy.json

Example strategy.json:

{
  "users": {
    "email": "unique_email",
    "name": "full_name",
    "phone": "phone_number"
  },
  "employees": {
    "salary": "random_int"
  }
}

3. Execute Anonymization

Anonymize a database file into a sanitized target output:

pynonymizer-core anonymize /path/to/database.db --strategy strategy.json --output /path/to/anonymized.db

🤖 Model Context Protocol (MCP) Server

Pynonymizer Core includes an embedded Stdio MCP server compliant with JSON-RPC 2.0, giving AI agents direct tools to inspect schemas and sanitize datasets on demand.

Provided Tools

Tool Name Description Required Arguments
db_inspect_schema Returns tables, columns, types, and primary keys db_path
db_generate_strategy Evaluates schema and generates recommended GDPR masking map db_path
db_anonymize Applies declarative strategy to sanitize database source_db, strategy (optional: target_db)

Claude Desktop / Cursor Setup

Add the following snippet to your claude_desktop_config.json:

{
  "mcpServers": {
    "pynonymizer-core": {
      "command": "python",
      "args": ["-m", "src.mcp.server"]
    }
  }
}

Or using Docker:

{
  "mcpServers": {
    "pynonymizer-core": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "pynonymizer-core"]
    }
  }
}

🧪 Testing & Security Verification

Run the test suite:

python -m unittest discover -s tests

Security Posture (Raptor Guard V2)

  • Zero Sinks / Leaks: No outbound socket requests or analytics telemetry.
  • Prepared Statements: Parameterized queries for deterministic execution.
  • Deterministic Tokenization: Safe synthetic data replacement conforming to GDPR Art. 32 requirements.

📄 License

MIT License. Developed and maintained by THE HIVE // BSO (diamantenschmiede).

Metadata

Release files for pynonymizer-core 1.0.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 pynonymizer-core 1.0.0
File Size Uploaded Provenance Actions
pynonymizer_core-1.0.0.tar.gz 11.3 kB Without provenance Details for pynonymizer_core-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pynonymizer-core 1.0.0
File Interpreter ABI Platform Actions
pynonymizer_core-1.0.0-py3-none-any.whl Python 3 none any Details for pynonymizer_core-1.0.0-py3-none-any.whl

Total release size: 22.2 kB

Release files / pynonymizer_core-1.0.0.tar.gz

Download URL pynonymizer_core-1.0.0.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
863273faf49655af0f9a20dff7bedb860564ae1340cb63491a674a650144f417
BLAKE2b-256 checksum
How to use checksums
5952053f79f9e160227b2c825a20f3832165e7bbf95a54ddfc349f1963049c40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Release files / pynonymizer_core-1.0.0-py3-none-any.whl

Download URL pynonymizer_core-1.0.0-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bd1d34b3b162e4fcf6e51a0031fa97735dcf94ab4c975ee9f9f4096b6b615ae4
BLAKE2b-256 checksum
How to use checksums
11d367db34f6d3fc5eac632cbcac2ad79845b84a98261b94777eb84bfdebc9f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.15

Security for pynonymizer-core 1.0.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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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