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