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