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