Skip to main content

PyTagShield

Python bindings for the PyTagShield pipeline: a fast, consent-aware, privacy-minimizing event pipeline written in Rust.

The core runs the latency-sensitive stages of a tagging pipeline — ingestion validation, consent resolution, deterministic transforms, data minimization, and routing to destinations — while staying free of network I/O until the delivery stage. These bindings expose the synchronous pipeline so you can validate, minimize, and route events from Python without running a server.

Install

pip install pytagshield

Requires CPython 3.10+ (abi3 wheel).

Quick start

import pytagshield

CONFIG = """
minimization:
  pseudonymize_salt: "change-me"
destinations:
  - name: ph
    type: posthog
    purpose: analytics
    posthog:
      api_key: "phc_..."
routes:
  - name: all
    destinations: [ph]
"""

config = pytagshield.Config.from_yaml(CONFIG)
pipeline = pytagshield.Pipeline(config)

result = pipeline.process(
    {
        "event": "page_view",
        "distinct_id": "user-42",
        "properties": {"email": "a@b.c", "url": "/home"},
        "consent": {"analytics": True},
    }
)

print(result["routing"]["destinations"])        # ['ph']
print(result["event"]["distinct_id"])           # 'sha256:...' (pseudonymized)
print(result["minimization"]["properties_dropped"])  # 1 (email dropped)

Design

  • Consent-first. Nothing routes to a destination unless its purpose is granted. The default policy is deny; consent resolves with precedence event payload > stored consent > configured default.
  • Privacy by default. Identifiers are pseudonymized (SHA-256 + salt) and PII such as IP addresses and email is cleared or dropped before egress.
  • Explicit backpressure. process() is pure and side-effect free. Queueing to destinations is the transport layer's responsibility, so overload is never silent.

API

Object Members
Config from_yaml, from_path, purposes, default_policy
Pipeline process, set_consent, get_consent, consent_entries, metrics

ValidationError (with a .errors list) is raised for rejected payloads; ConfigError is raised for invalid configuration.

License

Apache-2.0. See LICENSE.

Metadata

Release files for pytagshield 0.2.0

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

Built distribution (wheel)

Table of built distributions (wheels) for pytagshield 0.2.0
File Interpreter ABI Platform
pytagshield-0.2.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details

Release files / pytagshield-0.2.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL pytagshield-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
Size 524.2 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b525a9538967771a125770fe1072a78e0d5551dfbcf3f948447fce0442c8b77a
BLAKE2b-256 checksum
How to use checksums
f61bb03fbc5ab5d9a08be39860e97cb71dba5411187e59ee93f9aea297b22600
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Security for pytagshield 0.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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file 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