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