1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 pytestCheckHook,
6 html5lib,
7 setuptools,
8 tinycss2,
9 packaging,
10 webencodings,
11}:
12
13buildPythonPackage rec {
14 pname = "bleach";
15 version = "6.2.0";
16 pyproject = true;
17
18 src = fetchPypi {
19 inherit pname version;
20 hash = "sha256-Ej6JQRi4pZn9gNPsGm1Mx85OWIKxMXp+G6abVulfmR8=";
21 };
22
23 nativeBuildInputs = [ setuptools ];
24
25 propagatedBuildInputs = [
26 html5lib
27 packaging
28 setuptools
29 webencodings
30 ];
31
32 optional-dependencies = {
33 css = [ tinycss2 ];
34 };
35
36 nativeCheckInputs = [ pytestCheckHook ];
37
38 disabledTests = [
39 # Disable network tests
40 "protocols"
41 ];
42
43 pythonImportsCheck = [ "bleach" ];
44
45 meta = with lib; {
46 description = "Easy, HTML5, whitelisting HTML sanitizer";
47 longDescription = ''
48 Bleach is an HTML sanitizing library that escapes or strips markup and
49 attributes based on a white list. Bleach can also linkify text safely,
50 applying filters that Django's urlize filter cannot, and optionally
51 setting rel attributes, even on links already in the text.
52
53 Bleach is intended for sanitizing text from untrusted sources. If you
54 find yourself jumping through hoops to allow your site administrators
55 to do lots of things, you're probably outside the use cases. Either
56 trust those users, or don't.
57 '';
58 homepage = "https://github.com/mozilla/bleach";
59 downloadPage = "https://github.com/mozilla/bleach/releases";
60 changelog = "https://github.com/mozilla/bleach/blob/v${version}/CHANGES";
61 license = licenses.asl20;
62 maintainers = with maintainers; [ prikhi ];
63 };
64}