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: Alpha (0.1.x) · pin >=0.1.0,<0.2 and expect churn

Install

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

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 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.0.tar.gz (5.4 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: hedron_native-0.1.0.tar.gz
  • Upload date:
  • Size: 5.4 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.0.tar.gz
Algorithm Hash digest
SHA256 641c109b72d096da1d29a4a1121462bff305e3d07e49a4ce55757c6b0aee5608
MD5 7f5b7a8e8e93e038d7b4fe7d304808bb
BLAKE2b-256 d794877122b0cf3cf4735a3a285f5c4c023ed309f72cf3602487a6c1438ffd5a

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