1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 hatchling,
6 lxml,
7 beautifulsoup4,
8 pytestCheckHook,
9 pythonOlder,
10}:
11
12buildPythonPackage rec {
13 pname = "html-sanitizer";
14 version = "2.3.1";
15 pyproject = true;
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchFromGitHub {
20 owner = "matthiask";
21 repo = "html-sanitizer";
22 rev = "refs/tags/${version}";
23 hash = "sha256-NWJLD70783Ie6efyCvGopxMIlP3rLz0uM/D1rLQwBXE=";
24 };
25
26 nativeBuildInputs = [ hatchling ];
27
28 propagatedBuildInputs = [
29 lxml
30 beautifulsoup4
31 ];
32
33 nativeCheckInputs = [ pytestCheckHook ];
34
35 pytestFlagsArray = [ "html_sanitizer/tests.py" ];
36
37 disabledTests = [
38 # Tests are sensitive to output
39 "test_billion_laughs"
40 "test_10_broken_html"
41 ];
42
43 pythonImportsCheck = [ "html_sanitizer" ];
44
45 meta = with lib; {
46 description = "Allowlist-based and very opinionated HTML sanitizer";
47 homepage = "https://github.com/matthiask/html-sanitizer";
48 changelog = "https://github.com/matthiask/html-sanitizer/blob/${version}/CHANGELOG.rst";
49 license = with licenses; [ bsd3 ];
50 maintainers = with maintainers; [ fab ];
51 };
52}