Migrating from the established
datafog package? Start with Migrate from
DataFog Python before translating API
calls.Type checking
Starting with 0.3.1, the wheel includes PEP 561 typing metadata and stubs for all public functions, result objects, exceptions, and awaitable manager methods. Pyright and mypy can infer finding and result types and check configuration literals without a separate stub package. Configuration and provider helper types in the stub are prefixed with_ and
exist only for type checking. If you use them in annotations, import them inside
if TYPE_CHECKING: and use postponed annotations (from __future__ import annotations); they are not runtime exports. Runtime validation still enforces
value constraints such as recognized locale aliases, nonnegative ranges, and valid keys.
Synchronous functions
transform uses explicit findings. scan_and_transform accepts the divided
configuration envelope with scan and transform sections.
Result objects
Python exposes immutable objects with snake_case attributes:TextRange(start, end)FindingTransformationTransformResultRestorationRestoreResult
Asynchronous manager
Exceptions
DataFogConfigurationErrorDataFogFindingErrorDataFogKeyProviderErrorDataFogInternalError
code, optional reason, optional path, and
optional finding_index attributes. See Errors.
Structured JSON and PERSON fields
Usediscover_fields(data, config=None), scan_structured(data, config=None),
transform_structured(data, findings, config), and
scan_and_transform_structured(data, config). Results expose .mappings and
.findings, or .data and .transformations. PrivacyManager also exposes
transform_structured, scan_and_transform_structured, and restore_structured
for provider-backed work.
Paths are JSON Pointers. All ranges, including JavaScript UTF-16 ranges,
address the decoded string at that path. See person-field discovery
for aliases, policy configuration, input limits, and examples.
German locale routing and the seven additional entity labels are documented in
the German entity reference.
Capability discovery (0.4.0+)
Usecapabilities() to inspect the runtime registry, including supported entities, default detectors, locale aliases, and activation settings. See the capabilities contract and generated inventory and 0.4.x compatibility policy.
Email source context
Use the optional scanformat setting ("text", "env", or "sql") to
delimit emails in environment assignments or standard SQL quoted strings.
See email boundaries for examples and syntax limits.