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