Skip to main content

blanch

Drop-in replacement for bleach, the deprecated HTML sanitization library.

Features

  • Same API as bleach (clean, linkify, Cleaner, Linker, CSSSanitizer)
  • Zero dependencies — uses html.parser from stdlib
  • Python 3.10+
  • Full type annotations

Installation

pip install blanch

Usage

import blanch

# Sanitize HTML
blanch.clean("<script>alert('xss')</script><b>hello</b>")
# '&lt;script&gt;alert(\'xss\')&lt;/script&gt;<b>hello</b>'

# Linkify URLs
blanch.linkify("Visit https://example.com")
# 'Visit <a href="https://example.com" rel="nofollow">https://example.com</a>'

Migrating from bleach

# Option 1: Replace import
# Before: import bleach
import blanch as bleach

# Option 2: Use compatibility layer
import blanch.compat.bleach as bleach

License

MIT

Metadata

Release files for blanch 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for blanch 0.1.0
File Size Uploaded
blanch-0.1.0.tar.gz 39.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for blanch 0.1.0
File Interpreter ABI Platform
blanch-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 52.3 kB

Release files / blanch-0.1.0.tar.gz

Download URL blanch-0.1.0.tar.gz
Size 39.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9c42f39cc7405bfb809f6b80064e61aa23e32e67cbbbc95f35fcbf4bb8970a8b
BLAKE2b-256 checksum
How to use checksums
752ed031041e6a16d8ec599cf82d0c069a19d9c9238debb6029e7c42ca4ca783
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","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}

Release files / blanch-0.1.0-py3-none-any.whl

Download URL blanch-0.1.0-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0dbc083d0b3ce79a54714063ccf46cf19176a26d810f64954d3148de5716fb7
BLAKE2b-256 checksum
How to use checksums
faaca6b51e5296bac5e299a3822c7ac95429e725103d8fecb962b703e2b8efc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","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}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page