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