Skip to main content

hedron-native

PyPI Python CI License: MIT

Optional Rust acceleration for Hedron bulk HTML escaping.

Pure Python remains the semantic reference and Supported fallback. Absence of the extension never changes public rendering semantics — hedron-core uses these helpers when the package is installed and falls back otherwise.

Also available as the flagship extra hedron[native].

Package maturity: Beta (0.1.x) · pin >=0.1.1,<0.2 and expect churn

Install

pip install "hedron-native>=0.1.1,<0.2"
# or
uv add "hedron-native>=0.1.1,<0.2"
# via flagship:
pip install "hedron[native]>=0.28.0,<0.29"

Requires Python 3.11–3.14. Prebuilt wheels are published for common platforms; if a wheel is unavailable, pip may build from the Rust source (requires a Rust toolchain) or you can rely on the pure-Python path without this package.

Quick start

from hedron_native import (
    escape_attr,
    escape_attr_python,
    escape_text,
    escape_text_python,
    native_available,
)

assert escape_text("<x>") == "&lt;x&gt;"
assert escape_attr('"') == "&quot;"

# Always available, even when the extension did not load:
assert escape_text_python("<x>") == "&lt;x&gt;"
assert escape_attr_python('"') == "&quot;"

print("native extension loaded:", native_available())

Public API

Symbol Role
escape_text / escape_attr Prefer native when loaded; else Python
escape_text_python / escape_attr_python Pure-Python reference
native_available True when the Rust extension loaded
__version__ Package version string

Links

License

MIT. See the repository license.

Download files

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

Source Distribution

hedron_native-0.1.1.tar.gz (6.9 kB view details)

Uploaded Source

File details

Details for the file hedron_native-0.1.1.tar.gz.

File metadata

  • Download URL: hedron_native-0.1.1.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for hedron_native-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a3c801be2f01c3e0b2c2239a8097ae2d32608b46597c9420acfbd21785cc6d12
MD5 737164c8c65b659727ac3c88280513f3
BLAKE2b-256 a2f86a4bc968e66399df763ac996e2f328bfcc2d0bff599b3670975c71959c42

See more details on using hashes here.

Supported by

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