1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 chardet,
6 hatchling,
7 html5lib,
8 lxml,
9 pytestCheckHook,
10 pythonOlder,
11 soupsieve,
12 sphinxHook,
13
14 # for passthru.tests
15 html-sanitizer,
16 markdownify,
17 mechanicalsoup,
18 nbconvert,
19 subliminal,
20 wagtail,
21}:
22
23buildPythonPackage rec {
24 pname = "beautifulsoup4";
25 version = "4.12.3";
26 pyproject = true;
27
28 outputs = [
29 "out"
30 "doc"
31 ];
32
33 disabled = pythonOlder "3.6";
34
35 src = fetchPypi {
36 inherit pname version;
37 hash = "sha256-dOPRko7cBw0hdIGFxG4/szSQ8i9So63e6a7g9Pd4EFE=";
38 };
39
40 nativeBuildInputs = [
41 hatchling
42 sphinxHook
43 ];
44
45 propagatedBuildInputs = [
46 chardet
47 soupsieve
48 ];
49
50 passthru.optional-dependencies = {
51 html5lib = [ html5lib ];
52 lxml = [ lxml ];
53 };
54
55 nativeCheckInputs = [
56 pytestCheckHook
57 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
58
59 pythonImportsCheck = [ "bs4" ];
60
61 passthru.tests = {
62 inherit
63 html-sanitizer
64 markdownify
65 mechanicalsoup
66 nbconvert
67 subliminal
68 wagtail
69 ;
70 };
71
72 meta = with lib; {
73 changelog = "https://git.launchpad.net/beautifulsoup/tree/CHANGELOG?h=${version}";
74 description = "HTML and XML parser";
75 homepage = "http://crummy.com/software/BeautifulSoup/bs4/";
76 license = licenses.mit;
77 maintainers = with maintainers; [ domenkozar ];
78 };
79}