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