1{
2 lib,
3 stdenv,
4 aiohttp,
5 ansicolors,
6 azure-datalake-store,
7 azure-identity,
8 azure-storage-blob,
9 boto3,
10 buildPythonPackage,
11 click,
12 entrypoints,
13 fetchFromGitHub,
14 gcsfs,
15 ipykernel,
16 moto,
17 nbclient,
18 nbformat,
19 pyarrow,
20 pygithub,
21 pytest-mock,
22 pytestCheckHook,
23 pythonAtLeast,
24 pythonOlder,
25 pyyaml,
26 requests,
27 setuptools,
28 tenacity,
29 tqdm,
30}:
31
32buildPythonPackage rec {
33 pname = "papermill";
34 version = "2.6.0";
35 pyproject = true;
36
37 disabled = pythonOlder "3.8";
38
39 src = fetchFromGitHub {
40 owner = "nteract";
41 repo = "papermill";
42 rev = "refs/tags/${version}";
43 hash = "sha256-NxC5+hRDdMCl/7ZIho5ml4hdENrgO+wzi87GRPeMv8Q=";
44 };
45
46 build-system = [ setuptools ];
47
48 dependencies = [
49 click
50 pyyaml
51 nbformat
52 nbclient
53 tqdm
54 requests
55 entrypoints
56 tenacity
57 ansicolors
58 ] ++ lib.optionals (pythonAtLeast "3.12") [ aiohttp ];
59
60 passthru.optional-dependencies = {
61 azure = [
62 azure-datalake-store
63 azure-identity
64 azure-storage-blob
65 ];
66 gcs = [ gcsfs ];
67 github = [ pygithub ];
68 hdfs = [ pyarrow ];
69 s3 = [ boto3 ];
70 };
71
72 nativeCheckInputs =
73 [
74 ipykernel
75 moto
76 pytest-mock
77 pytestCheckHook
78 ]
79 ++ passthru.optional-dependencies.azure
80 ++ passthru.optional-dependencies.s3
81 ++ passthru.optional-dependencies.gcs;
82
83 preCheck = ''
84 export HOME=$(mktemp -d)
85 '';
86
87 pythonImportsCheck = [ "papermill" ];
88
89 disabledTests =
90 [
91 # pytest 8 compat
92 "test_read_with_valid_file_extension"
93 ]
94 ++ lib.optionals stdenv.isDarwin [
95 # might fail due to the sandbox
96 "test_end2end_autosave_slow_notebook"
97 ];
98
99 disabledTestPaths = [
100 # ImportError: cannot import name 'mock_s3' from 'moto'
101 "papermill/tests/test_s3.py"
102 ];
103
104 __darwinAllowLocalNetworking = true;
105
106 meta = with lib; {
107 description = "Parametrize and run Jupyter and interact with notebooks";
108 homepage = "https://github.com/nteract/papermill";
109 license = licenses.bsd3;
110 maintainers = [ ];
111 mainProgram = "papermill";
112 };
113}