initial commit

This commit is contained in:
Davidson Gomes
2024-10-30 11:19:09 -03:00
commit 8654a31a4d
3744 changed files with 585542 additions and 0 deletions

View File

@@ -0,0 +1 @@
pip

View File

@@ -0,0 +1,57 @@
Metadata-Version: 2.3
Name: nh3
Version: 0.2.18
Summary: Python bindings to the ammonia HTML sanitization library.
Author: messense <messense@icloud.com>
Author-email: messense <messense@icloud.com>
License: MIT
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Source Code, https://github.com/messense/nh3
# nh3
![CI](https://github.com/messense/nh3/workflows/CI/badge.svg)
[![PyPI](https://img.shields.io/pypi/v/nh3.svg)](https://pypi.org/project/nh3)
[![Documentation Status](https://readthedocs.org/projects/nh3/badge/?version=latest)](https://nh3.readthedocs.io/en/latest/?badge=latest)
Python bindings to the [ammonia](https://github.com/rust-ammonia/ammonia) HTML sanitization library.
## Installation
```bash
pip install nh3
```
## Usage
See [the documentation](https://nh3.readthedocs.io/en/latest/).
## Performance
A quick benchmark showing that nh3 is about 20 times faster than the deprecated [bleach](https://pypi.org/project/bleach/) package.
Measured on a MacBook Air (M2, 2022).
```ipython
Python 3.11.0 (main, Oct 25 2022, 16:25:24) [Clang 14.0.0 (clang-1400.0.29.102)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.9.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import requests
In [2]: import bleach
In [3]: import nh3
In [4]: html = requests.get("https://www.google.com").text
In [5]: %timeit bleach.clean(html)
2.85 ms ± 22.8 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
In [6]: %timeit nh3.clean(html)
138 µs ± 860 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)
```
## License
This work is released under the MIT license. A copy of the license is provided in the [LICENSE](./LICENSE) file.

View File

@@ -0,0 +1,9 @@
nh3-0.2.18.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
nh3-0.2.18.dist-info/METADATA,sha256=BrN8gvKpJ66F1uHCDALQVJ-t1z8Q3Fn7toDeEipMrFM,1737
nh3-0.2.18.dist-info/RECORD,,
nh3-0.2.18.dist-info/WHEEL,sha256=4tvqmvFYtVIGIiiM-a6ZCSZxPyFOipZ7XuefR8XmFZo,127
nh3/__init__.py,sha256=VbJi5tZirAK6HAbQpF4aZYp0_ScVJF7YB50E6NNLQw4,95
nh3/__init__.pyi,sha256=HaK-e3QqtUhKQQ4I1m2Gyt8uETKUOmrK0evABVgQRhI,789
nh3/__pycache__/__init__.cpython-310.pyc,,
nh3/nh3.abi3.so,sha256=Cukn8wp11vXw515pkiXsId0s_hGVZa8FScDY5uWrlV4,2187112
nh3/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0

View File

@@ -0,0 +1,4 @@
Wheel-Version: 1.0
Generator: maturin (1.7.0)
Root-Is-Purelib: false
Tag: cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64