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