Skip to content

Handle bleach deprecation by preferring nh3 with bleach fallback - #8480

Closed
Macdrita wants to merge 3 commits into
holoviz:mainfrom
Macdrita:bleach-deprecation-fix
Closed

Handle bleach deprecation by preferring nh3 with bleach fallback#8480
Macdrita wants to merge 3 commits into
holoviz:mainfrom
Macdrita:bleach-deprecation-fix

Conversation

@Macdrita

@Macdrita Macdrita commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #6206

This PR addresses the deprecation of the bleach library used for HTML sanitization in Panel.

The implementation updates the lazy sanitizer so that it attempts to use nh3 when available and falls back to bleach if nh3 is not installed. This approach allows Panel to remain compatible with environments where nh3 is available while maintaining support for environments such as Pyodide where nh3 may not yet be installable.

The change preserves the existing sanitizer interface and behavior while ensuring that Panel can transition away from relying solely on the deprecated bleach package.

How Has This Been Tested?

The change was tested locally by importing Panel after modifying the sanitizer implementation:
python3 -c "import panel"

This verifies that the module imports correctly and that the sanitizer initialization does not introduce runtime errors.

AI Disclosure

  • This PR contains AI-generated content.

Checklist

  • Tests added and is passing
  • Added documentation

@ahuang11

ahuang11 commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

Your changes from #8479 has been pushed to this branch too.

@philippjfr

Copy link
Copy Markdown
Member

Closing in favor of #8503

@philippjfr philippjfr closed this Mar 12, 2026
@github-actions

Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jun 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle bleach deprecation

3 participants