Change the package and import
datafog-core), while the Python import
uses an underscore (datafog_core). The two distributions can be installed at
the same time while an application is migrated incrementally.
Update scan results
DataFog Python returns aScanResult wrapper. DataFog Core returns a list of
Finding objects directly.
codepoint_range when slicing a Python string. Use byte_range when
addressing the UTF-8 encoded input. Both ranges are zero-based and
end-exclusive.
Rule-based Core findings can have
confidence=None. Do not assume every
finding has a numeric confidence score.
Replace scan-and-redact calls
DataFog Core separates detection configuration from transformation policy.transform requires explicit findings; scan_and_transform is the convenience
operation that performs both steps.
Transformation records describe what was applied, including source and output
ranges, but intentionally omit the original matched PII.
Choose the intended transformation
Do not migrate strategy names mechanically. In particular, legacytoken and
Core tokenize have different security and reversibility semantics.
Core also adds
remove, which deletes only the exact finding span.
For a strictly non-reversible first pass, choose
redact, mask, or
remove. Core pseudonymize is keyed and one-way but intentionally linkable;
Core tokenize is reversible through the configured token provider.Remove legacy engine selection
Do not translateengine="regex", "smart", "spacy", or "gliner" into
Core configuration. DataFog Core 0.3 owns detector composition and exposes
locale as its scan setting. Detector provenance appears on each finding.
Entity names are exact and case-sensitive. The built-in Core entities are:
EMAIL, PHONE, SSN, CREDIT_CARD, IP_ADDRESS, DATE, and ZIP_CODE.
Use canonical names such as DATE and ZIP_CODE rather than legacy aliases
such as DOB or ZIP. Entity selection belongs in the transformation config,
not the scan config.
Migration checklist
- Replace the
datafogdistribution anddatafog.engineimports. - Consume the list returned by
scaninstead ofScanResult.entities. - Rename entity fields and select
codepoint_rangeorbyte_rangeexplicitly. - Replace
scan_and_redactwithscan_and_transformand a transformation envelope. - Remove legacy engine selectors and normalize entity names.
- Select a Core strategy by behavior, especially for
tokenandpseudonymize. - Stop depending on plaintext mappings or original PII in transformation records.
- Update error handling for the DataFog Core exceptions.
German detection migration
The seven German labels are implemented in Core, with shared Rust, installed Python/Node and browser/WASM conformance fixtures. This is format/context compatibility, not exact regex parity with Python 4.8.1. The comparison baseline is the published 4.8.1 contract and itstests/test_de_pii_regex.py; those legacy
fixtures remain unchanged. fixtures/german.jsonl records the new contract.
All matching preserves source casing and separators. Allowlist entries must use
that source representation. Required context stays in the output, except postal
prefixes, which are part of the finding and are replaced too.
The Python adapter may translate explicit German entity requests into locale
de and then filter results, but must separately test legacy overlap and
selection semantics. Core adds no plural locales, engine switch or scan-time
entity selector. The capability-aware higher-level adapter and its
datafog-core>=0.4.0,<0.5 dependency were merged in
PR #179. The higher-level
Python package has its own release process; see the
reviewed legacy NPI selection limitation.
Credential detector migration (0.4.1)
Core 0.4.1 adds API keys, explicit Bearer header tokens, and scoped PostgreSQL credential URIs. Python 4.9 retains its existing default backend and legacy overlap-before-selection behavior. A same-span API key can suppress a Bearer token, a Bearer token can suppress a JWT, and a containing credential URI can suppress an inner API key or JWT before legacy selection runs. Explicit selection can therefore return empty. Native Core anddatafog.v5 retain scan candidates and apply selection before overlap during transformation. See the compatibility matrix and exact-wheel integration results.