1{ buildPythonPackage
2, certifi
3, fetchPypi
4, lib
5, python-dateutil
6, python-slugify
7, six
8, requests
9, tqdm
10, urllib3
11}:
12
13buildPythonPackage rec {
14 pname = "kaggle";
15 version = "1.5.12";
16
17 src = fetchPypi {
18 inherit pname version;
19 sha256 = "b4d87d107bff743aaa805c2b382c3661c4c175cdb159656d4972be2a9cef42cb";
20 };
21
22 # The version bounds in the setup.py file are unnecessarily restrictive.
23 # They have both python-slugify and slugify, don't know why
24 patchPhase = ''
25 substituteInPlace setup.py \
26 --replace 'urllib3 >= 1.21.1, < 1.25' 'urllib3' \
27 --replace " 'slugify'," " "
28 '';
29
30 propagatedBuildInputs = [
31 certifi
32 python-dateutil
33 python-slugify
34 requests
35 six
36 tqdm
37 urllib3
38 ];
39
40 # Tests try to access the network.
41 checkPhase = ''
42 export HOME="$TMP"
43 mkdir -p "$HOME/.kaggle/"
44 echo '{"username":"foobar","key":"00000000000000000000000000000000"}' > "$HOME/.kaggle/kaggle.json"
45 $out/bin/kaggle --help > /dev/null
46 '';
47 pythonImportsCheck = [ "kaggle" ];
48
49 meta = with lib; {
50 description = "Official API for https://www.kaggle.com, accessible using a command line tool implemented in Python 3";
51 homepage = "https://github.com/Kaggle/kaggle-api";
52 license = licenses.asl20;
53 maintainers = with maintainers; [ cdepillabout ];
54 };
55}