Skip to main content

SafeHTML

A simple package for safely rendering HTML using the new template string syntax (PEP 750), in Python 3.14.

Example

from safehtml import html

input = "Jacob <script>alert('xss')</script>"
print(html(t"<p>Hello {input}</p>"))

Output:

<p>Hello Jacob &lt;script&gt;alert(&#x27;xss&#x27;)&lt;/script&gt;</p>

Install

uv init
uv python pin 3.14.0rc1
uv add safehtml

Release files for safehtml 1.0.1

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

Source distribution (sdist)

Source distribution for safehtml 1.0.1
File Size Uploaded
safehtml-1.0.1.tar.gz 2.4 kB Details

Built distribution (wheel)

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

Total release size: 5.2 kB

Release files / safehtml-1.0.1.tar.gz

Download URL safehtml-1.0.1.tar.gz
Size 2.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a1d3b001977d48f9afdeaf2f0f05c80a93c597912b6cde9a189bf1bc58fa9981
BLAKE2b-256 checksum
How to use checksums
c0606e428764a0d45d1e56ae8b809012ae73d6e17e20e0f3da85d2ba01a944a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.3

Release files / safehtml-1.0.1-py3-none-any.whl

Download URL safehtml-1.0.1-py3-none-any.whl
Size 2.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b75d868ccc738ec743493adf18164b1fd969f047314461e1c96eae24c4eda829
BLAKE2b-256 checksum
How to use checksums
96efa224599b287f1c2207900eff5118aef5a7680720de61566b03f98740c298
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.3

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

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