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.0-cp311-abi3-win_amd64.whl (26.1 MB view details)

Uploaded CPython 3.11+Windows x86-64

stella_anonymize_core-2.0.0-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.0-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.0-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.0-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.0-cp311-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for stella_anonymize_core-2.0.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 a0158d54b97b1e069ddc6dcba161a1dcbfec5d38bded6e6dd4dad47c6db9f6d3
MD5 c978a4ea33b39155ab75164b44987c69
BLAKE2b-256 b158721b8410c6ce9aa7bf469a0ac083a3bcdd90c1b9216165d6381a3e36120f

See more details on using hashes here.

Provenance

The following attestation bundles were made for stella_anonymize_core-2.0.0-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.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for stella_anonymize_core-2.0.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1f9787c52105296d0df32590279e1edbab8165bfab23d42ebf095e1db8458395
MD5 b295f053bad0e7df233f7b9875b71952
BLAKE2b-256 f2d8537b5e1a5f44205809abc2802803186eaea1c843ef07940ebd47f171f728

See more details on using hashes here.

Provenance

The following attestation bundles were made for stella_anonymize_core-2.0.0-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.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for stella_anonymize_core-2.0.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3e7073a28028943b3331a36a88bb59c185fffd218380983a4113cf2830540b55
MD5 2c3d99d71204bbf9d02a486c0e328f16
BLAKE2b-256 d47c3730bf2db2ef61ab4031673bb839006862e70849fcb9da8251c8954ab0f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for stella_anonymize_core-2.0.0-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.0-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for stella_anonymize_core-2.0.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f4abfc0115f5c7064b8d2d7085a3326430aa1b2ce2f8d77508d7456335e6e1d1
MD5 163c34d9a9b23d9d05d1614c6a6c24b2
BLAKE2b-256 168d313d1feece0c276c02f31d6f6109fc19e3f5fdcce799ccd536f105d950dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for stella_anonymize_core-2.0.0-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.0-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for stella_anonymize_core-2.0.0-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a3ea8cd910460975511ae489878c17c061ce055bb783b7aecc8846d491a4b784
MD5 7de83e8beb30168539b158c65e2e10cb
BLAKE2b-256 2969580dc8b6187730899dec0639241e4526d346e8a0564eee7e133c4037de5c

See more details on using hashes here.

Provenance

The following attestation bundles were made for stella_anonymize_core-2.0.0-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