1{ lib
2, appdirs
3, buildPythonPackage
4, fetchFromGitHub
5, importlib-metadata
6, poetry-core
7, pyee
8, pytest-xdist
9, pytestCheckHook
10, pythonOlder
11, syncer
12, tqdm
13, urllib3
14, websockets
15}:
16
17buildPythonPackage rec {
18 pname = "pyppeteer";
19 version = "0.2.6";
20 format = "pyproject";
21
22 disabled = pythonOlder "3.6";
23
24 src = fetchFromGitHub {
25 owner = pname;
26 repo = pname;
27 rev = version;
28 sha256 = "sha256-mMFQp8GMjKUc3yyB4c8Tgxut7LkMFa2cySO3iSA/aI4=";
29 };
30
31 nativeBuildInputs = [
32 poetry-core
33 ];
34
35 propagatedBuildInputs = [
36 appdirs
37 importlib-metadata
38 pyee
39 tqdm
40 urllib3
41 websockets
42 ];
43
44 checkInputs = [
45 syncer
46 pytest-xdist
47 pytestCheckHook
48 ];
49
50 postPatch = ''
51 substituteInPlace pyproject.toml \
52 --replace 'websockets = "^9.1"' 'websockets = "*"'
53 '';
54
55 disabledTestPaths = [
56 # Requires network access
57 "tests/test_browser.py"
58 "tests/test_browser_context.py"
59 "tests/test_connection.py"
60 "tests/test_coverage.py"
61 "tests/test_dialog.py"
62 "tests/test_element_handle.py"
63 "tests/test_execution_context.py"
64 "tests/test_frame.py"
65 "tests/test_input.py"
66 "tests/test_launcher.py"
67 "tests/test_network.py"
68 "tests/test_page.py"
69 "tests/test_pyppeteer.py"
70 "tests/test_target.py"
71 "tests/test_tracing.py"
72 "tests/test_worker.py"
73 ];
74
75 disabledTests = [
76 # Requires network access
77 "TestScreenShot"
78 "TestBrowserCrash"
79 "TestPDF"
80 ];
81
82 pythonImportsCheck = [
83 "pyppeteer"
84 ];
85
86 meta = with lib; {
87 description = "Headless chrome/chromium automation library (unofficial port of puppeteer)";
88 homepage = "https://github.com/pyppeteer/pyppeteer";
89 license = licenses.mit;
90 maintainers = with maintainers; [ kmein ];
91 };
92}