1{
2 lib,
3 appdirs,
4 buildPythonPackage,
5 certifi,
6 fetchFromGitHub,
7 importlib-metadata,
8 poetry-core,
9 pyee,
10 pytest-xdist,
11 pytestCheckHook,
12 pythonOlder,
13 syncer,
14 tqdm,
15 urllib3,
16 websockets,
17}:
18
19buildPythonPackage rec {
20 pname = "pyppeteer";
21 version = "1.0.2";
22 pyproject = true;
23
24 disabled = pythonOlder "3.7";
25
26 src = fetchFromGitHub {
27 owner = "pyppeteer";
28 repo = "pyppeteer";
29 tag = version;
30 hash = "sha256-izMaWtJdkLHMQbyq7o7n46xB8dOHXZ5uO0UXt+twjL4=";
31 };
32
33 postPatch = ''
34 substituteInPlace pyproject.toml \
35 --replace 'pyee = "^8.1.0"' 'pyee = "*"' \
36 --replace 'urllib3 = "^1.25.8"' 'urllib3 = "*"' \
37 --replace 'websockets = "^10.0"' 'websockets = "*"'
38 '';
39
40 nativeBuildInputs = [ poetry-core ];
41
42 propagatedBuildInputs = [
43 appdirs
44 certifi
45 importlib-metadata
46 pyee
47 tqdm
48 urllib3
49 websockets
50 ];
51
52 nativeCheckInputs = [
53 syncer
54 pytest-xdist
55 pytestCheckHook
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 = [ "pyppeteer" ];
86
87 meta = with lib; {
88 description = "Headless chrome/chromium automation library (unofficial port of puppeteer)";
89 mainProgram = "pyppeteer-install";
90 homepage = "https://github.com/pyppeteer/pyppeteer";
91 changelog = "https://github.com/pyppeteer/pyppeteer/blob/${version}/CHANGELOG.md";
92 license = licenses.mit;
93 maintainers = with maintainers; [ kmein ];
94 };
95}