skillfed

types-bleach

Typing stubs for bleach

types-bleach v6.4.0.20260728 1.8M downloads/30d#3,493 on PyPI37
Permissive license Apache-2.0 Active released

What it is and what it does

types-bleach is a type stub package that provides static type information for the bleach HTML sanitization library. It allows type checkers like mypy, pyright, and ty to understand and validate code that calls bleach functions, catching type errors at development time rather than runtime. The stubs are maintained as part of the typeshed project and are generated from the official typeshed repository.

This package is a pure typing aid—it contains no runtime code and does not replace bleach itself. It is useful when you want strict type checking in projects that use bleach but do not want to add bleach as a direct dependency to your type-checking environment, or when bleach does not yet ship its own inline type hints. The package depends on types-html5lib to provide types for bleach's HTML parsing dependency.

Use it for:

  • Add type checking to a project that uses bleach for HTML sanitization without installing bleach in your type-checking environment.
  • Validate bleach function calls and return types in a mypy or pyright configuration before runtime.
  • Ensure type safety when passing user input through bleach.clean() or other bleach sanitization functions.
  • Integrate bleach into a strictly typed codebase that enforces type checking in CI/CD pipelines.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides type stubs for the bleach HTML sanitization library, enabling static type checkers to validate code that uses bleach without requiring the library itself to be installed.

Yes, if you use bleach and want static type checking. Install it alongside your type checker (mypy, pyright, or ty) in development or CI environments. The package is lightweight, actively maintained, has no known vulnerabilities, and carries a permissive license. It is only useful if you are already using a static type checker; it adds no runtime value.

Install

types-bleach on PyPI

pip

pip install types-bleach

uv

uv add types-bleach

poetry

poetry add types-bleach

Installing types-bleach

Before you install

Low friction installation with a single runtime dependency on types-html5lib. The package is actively maintained with a recent release and no known vulnerabilities.

License in practice

Licensed under Apache-2.0 (permissive), allowing use in most commercial and open-source projects without significant restrictions.

Quickstart

pip install types-bleach

# In your code, type checkers will now understand bleach imports:
import bleach
result: str = bleach.clean('<p>Hello</p>')

Requires Python 3.10 or later; type stubs are only useful when used with a type checker like mypy, pyright, or ty.

Verify before relying

  • Whether the stubs cover all bleach 6.4.* APIs or only a subset of the public surface.
  • Whether installing this package is necessary or if bleach itself now ships inline type hints.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 1 — types-html5lib
Maintenance actively maintained — 17 days since the last release
Last repo commit
First released
Downloads 1,849,346/month — #3,493 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: types_bleach-6.4.0.20260728-py3-none-any.whl

Programming Language :: Python :: 3Typing :: Stubs Only

Tags

type stubs for bleachbleach type hintsstatic type checking bleachmypy bleach annotationsbleach typing supportpyright bleach stubsbleach type annotations
type-stubsstatic-analysis

More Quality Assurance packages