1{
2 buildPythonPackage,
3 lib,
4 setuptools,
5 stdenv,
6 fetchFromGitHub,
7 installShellFiles,
8 git,
9 coreutils,
10 versioneer,
11 # core
12 platformdirs,
13 chardet,
14 iso8601,
15 humanize,
16 fasteners,
17 packaging,
18 patool,
19 tqdm,
20 annexremote,
21 looseversion,
22 git-annex,
23 # downloaders
24 boto3,
25 keyrings-alt,
26 keyring,
27 msgpack,
28 requests,
29 # publish
30 python-gitlab,
31 # misc
32 argcomplete,
33 pyperclip,
34 python-dateutil,
35 # duecredit
36 duecredit,
37 distro,
38 # win
39 colorama,
40 # python-version-dependent
41 pythonOlder,
42 importlib-metadata,
43 typing-extensions,
44 # tests
45 pytest-xdist,
46 pytestCheckHook,
47 p7zip,
48 curl,
49 httpretty,
50}:
51
52buildPythonPackage rec {
53 pname = "datalad";
54 version = "1.1.5";
55 pyproject = true;
56
57 src = fetchFromGitHub {
58 owner = "datalad";
59 repo = "datalad";
60 tag = version;
61 hash = "sha256-XwzYlSP2MbEb0U3tuVOq3NNqLTS08UzSfSFBidHbpAY=";
62 };
63
64 postPatch = ''
65 substituteInPlace datalad/distribution/create_sibling.py \
66 --replace-fail "/bin/ls" "${coreutils}/bin/ls"
67 # Remove vendorized versioneer.py
68 rm versioneer.py
69 '';
70
71 nativeBuildInputs = [
72 installShellFiles
73 git
74 ];
75
76 build-system = [
77 setuptools
78 versioneer
79 ];
80
81 dependencies =
82 optional-dependencies.core ++ optional-dependencies.downloaders ++ optional-dependencies.publish;
83
84 optional-dependencies = {
85 core =
86 [
87 platformdirs
88 chardet
89 distro
90 iso8601
91 humanize
92 fasteners
93 packaging
94 patool
95 tqdm
96 annexremote
97 looseversion
98 ]
99 ++ lib.optionals stdenv.hostPlatform.isWindows [ colorama ]
100 ++ lib.optionals (pythonOlder "3.10") [ importlib-metadata ]
101 ++ lib.optionals (pythonOlder "3.11") [ typing-extensions ];
102 downloaders = [
103 boto3
104 keyrings-alt
105 keyring
106 msgpack
107 requests
108 ];
109 downloaders-extra = [
110 # requests-ftp # not in nixpkgs yet
111 ];
112 publish = [ python-gitlab ];
113 misc = [
114 argcomplete
115 pyperclip
116 python-dateutil
117 ];
118 duecredit = [ duecredit ];
119 };
120
121 postInstall = ''
122 installShellCompletion --cmd datalad \
123 --bash <($out/bin/datalad shell-completion) \
124 --zsh <($out/bin/datalad shell-completion)
125 wrapProgram $out/bin/datalad --prefix PYTHONPATH : "$PYTHONPATH"
126 '';
127
128 preCheck = ''
129 export HOME=$TMPDIR
130 '';
131
132 # tests depend on apps in $PATH which only will get installed after the test
133 disabledTests = [
134 # No such file or directory: 'datalad'
135 "test_script_shims"
136 "test_cfg_override"
137 "test_completion"
138 "test_nested_pushclone_cycle_allplatforms"
139 "test_create_sub_gh3463"
140 "test_create_sub_dataset_dot_no_path"
141 "test_cfg_passthrough"
142 "test_addurls_stdin_input_command_line"
143 "test_run_datalad_help"
144 "test_status_custom_summary_no_repeats"
145 "test_quoting"
146
147 # No such file or directory: 'git-annex-remote-[...]"
148 "test_create"
149 "test_ensure_datalad_remote_maybe_enable"
150
151 # "git-annex: unable to use external special remote git-annex-remote-datalad"
152 "test_ria_postclonecfg"
153 "test_ria_postclone_noannex"
154 "test_ria_push"
155 "test_basic_scenario"
156 "test_annex_get_from_subdir"
157 "test_ensure_datalad_remote_init_and_enable_needed"
158 "test_ensure_datalad_remote_maybe_enable[False]"
159 "test_ensure_datalad_remote_maybe_enable[True]"
160 "test_create_simple"
161 "test_create_alias"
162 "test_storage_only"
163 "test_initremote"
164 "test_read_access"
165 "test_ephemeral"
166 "test_initremote_basic_fileurl"
167 "test_initremote_basic_httpurl"
168 "test_remote_layout"
169 "test_version_check"
170 "test_gitannex_local"
171 "test_push_url"
172 "test_url_keys"
173 "test_obtain_permission_root"
174 "test_source_candidate_subdataset"
175 "test_update_fetch_all"
176 "test_add_archive_dirs"
177 "test_add_archive_content"
178 "test_add_archive_content_strip_leading"
179 "test_add_archive_content_zip"
180 "test_add_archive_content_absolute_path"
181 "test_add_archive_use_archive_dir"
182 "test_add_archive_single_file"
183 "test_add_delete"
184 "test_add_archive_leading_dir"
185 "test_add_delete_after_and_drop"
186 "test_add_delete_after_and_drop_subdir"
187 "test_override_existing_under_git"
188 "test_copy_file_datalad_specialremote"
189 "test_download_url_archive"
190 "test_download_url_archive_from_subdir"
191 "test_download_url_archive_trailing_separator"
192 "test_download_url_need_datalad_remote"
193 "test_datalad_credential_helper - assert False"
194
195 # need internet access
196 "test_clone_crcns"
197 "test_clone_datasets_root"
198 "test_reckless"
199 "test_autoenabled_remote_msg"
200 "test_ria_http_storedataladorg"
201 "test_gin_cloning"
202 "test_nonuniform_adjusted_subdataset"
203 "test_install_datasets_root"
204 "test_install_simple_local"
205 "test_install_dataset_from_just_source"
206 "test_install_dataset_from_just_source_via_path"
207 "test_datasets_datalad_org"
208 "test_get_cached_dataset"
209 "test_cached_dataset"
210 "test_cached_url"
211 "test_anonymous_s3"
212 "test_protocols"
213 "test_get_versioned_url_anon"
214 "test_install_recursive_github"
215 "test_failed_install_multiple"
216
217 # pbcopy not found
218 "test_wtf"
219
220 # CommandError: 'git -c diff.ignoreSubmodules=none -c core.quotepath=false ls-files -z -m -d' failed with exitcode 128
221 "test_subsuperdataset_save"
222 ];
223
224 nativeCheckInputs = [
225 p7zip
226 pytest-xdist
227 pytestCheckHook
228 git-annex
229 curl
230 httpretty
231 ];
232
233 pytestFlagsArray = [
234 # Deprecated in 3.13. Use exc_type_str instead.
235 "-W"
236 "ignore::DeprecationWarning"
237 ];
238
239 pythonImportsCheck = [ "datalad" ];
240
241 meta = {
242 description = "Keep code, data, containers under control with git and git-annex";
243 homepage = "https://www.datalad.org";
244 license = lib.licenses.mit;
245 maintainers = with lib.maintainers; [ renesat ];
246 };
247}