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