Skip to main content

Python bindings for stella anonymization core

Project description

stella-anonymize-core

Python bindings for the stella anonymization Rust core.

Install

Prebuilt wheels are published to PyPI (this activates with the next release). Wheels ship the bundled native pipeline packages, so no monorepo checkout is needed:

uv add stella-anonymize-core
# or: pip install stella-anonymize-core

Wheels target Python 3.11+ (abi3) on manylinux x64/aarch64, macOS x64/arm64, and Windows x64. Only wheels are published; there is no source distribution. The build.rs step needs the monorepo's generated .stlanonpkg native pipeline packages, so a source build cannot be self-contained. To build from a checkout instead, run bun run build first so those packages exist, then:

uv add ./crates/anonymize-py

Usage

Prepare or load the anonymizer once, then reuse it for documents.

import stella_anonymize as anonymize

languages = anonymize.available_default_native_pipeline_languages()
prepared = anonymize.preload_default_native_pipeline(
    language="en" if "en" in languages else None
)
result = prepared.redact_text(text, redact_string="***")

print(result.redaction.redacted_text)

Regional codes use the exact package when present and otherwise fall back to the base language package, so en-US can use the shipped en artifact.

For caller-owned configs, prepare package bytes before serving documents and load them at runtime:

import stella_anonymize as anonymize

package_bytes = anonymize.prepare_search_package(config_json)
prepared = anonymize.load_prepared_package(package_bytes)
prepared.warm_lazy_regex()
result = prepared.redact_text(text, redact_string="***")

get_default_native_pipeline() defers lazy regex warmup by default so the first call only pays for regexes the document actually touches. Use preload_default_native_pipeline() or pass warmup="lazy-regex" when startup can absorb that cost before serving documents. Top-level redact_text() and redact_text_json() are available for one-off calls, but they prepare from config on each invocation. Use load_prepared_package() or load_prepared_package_file() for repeated document processing.

API

  • prepare_search_package(config_json | config_bytes | config_mapping, compressed=True) -> bytes
  • load_prepared_package(package_bytes) -> PreparedAnonymizer
  • load_prepared_package_file(package_path) -> PreparedAnonymizer
  • available_default_native_pipeline_languages() -> tuple[str, ...]
  • read_default_native_pipeline_package_file(language=None) -> bytes
  • get_default_native_pipeline(language=None, package_path=None, warmup="none") -> PreparedAnonymizer
  • preload_default_native_pipeline(language=None, package_path=None) -> PreparedAnonymizer
  • PreparedAnonymizer.warm_lazy_regex()
  • PreparedAnonymizer.warm_lazy_regex_diagnostics_json()
  • PreparedAnonymizer.redact_text(text, operators=None, redact_string=None)
  • PreparedAnonymizer.redact_text_json(text, operators=None, redact_string=None)
  • PreparedAnonymizer.diagnostics_json(text, operators=None, redact_string=None)

PreparedSearch is an alias for PreparedAnonymizer.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

stella_anonymize_core-2.0.1-cp311-abi3-win_amd64.whl (26.1 MB view details)

Uploaded CPython 3.11+Windows x86-64

stella_anonymize_core-2.0.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (26.2 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64

stella_anonymize_core-2.0.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (26.0 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

stella_anonymize_core-2.0.1-cp311-abi3-macosx_11_0_arm64.whl (25.9 MB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

stella_anonymize_core-2.0.1-cp311-abi3-macosx_10_12_x86_64.whl (26.1 MB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

Details for the file stella_anonymize_core-2.0.1-cp311-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for stella_anonymize_core-2.0.1-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 34ced477e94fc374130740a4fdf541d113ad67ec3006c249d8baf6b6f162901f
MD5 fac26844a7bedd6bd4f3197edad08d48
BLAKE2b-256 1f110df0542e20a70b625c6dbc829242cfba356e97fcdb7b0b5a07309b33d73f

See more details on using hashes here.

Provenance

The following attestation bundles were made for stella_anonymize_core-2.0.1-cp311-abi3-win_amd64.whl:

Publisher: release.yml on stella/anonymize

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stella_anonymize_core-2.0.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for stella_anonymize_core-2.0.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 98a54a11150b4730951e2ba959551f32f1ba115358c7be1fd7f90d247e6a1179
MD5 e7624b596e64ed8fa949e5c38902d62d
BLAKE2b-256 f0f6cf656d0c7089b3a76591a6dea16a77ce56afa353218086ba49d00ec05521

See more details on using hashes here.

Provenance

The following attestation bundles were made for stella_anonymize_core-2.0.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on stella/anonymize

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stella_anonymize_core-2.0.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for stella_anonymize_core-2.0.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 eef4e45cca8549bd6f07aa97040f1a3de460da2b124cc0d783987e72fa2ec5df
MD5 79931386f71419cae0baa952df69b7ff
BLAKE2b-256 0775482cbabdf9b4c2f21a5b1187349d841c96474b57406cf4242059e6aea429

See more details on using hashes here.

Provenance

The following attestation bundles were made for stella_anonymize_core-2.0.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on stella/anonymize

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stella_anonymize_core-2.0.1-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for stella_anonymize_core-2.0.1-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5fc607329dd43c042aeafe1fe9acdcc8627644f1585e38593f5a28c3a774528c
MD5 a5981b7e8970a10fa7805c67512f2015
BLAKE2b-256 ff65c6c71835cfe081635b62ed6a537eadec7cc1d28d6b0a5a4f67fce895e2bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for stella_anonymize_core-2.0.1-cp311-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on stella/anonymize

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stella_anonymize_core-2.0.1-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for stella_anonymize_core-2.0.1-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b41cd57997e92575a512e9f444b504c746add684e7598972a8129ed695fab5b7
MD5 2772384dae6b6de70a85db9976643e82
BLAKE2b-256 a148d3178f35febbfc7860cc9c816a168db2ef8cf584181dbd5530b345540474

See more details on using hashes here.

Provenance

The following attestation bundles were made for stella_anonymize_core-2.0.1-cp311-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on stella/anonymize

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page