1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pythonOlder
5, python
6, py-multiaddr
7, requests
8, pytestCheckHook
9, pytest-cov
10, pytest-dependency
11, pytest-localserver
12, pytest-mock
13, pytest-order
14, pytest-cid
15, mock
16, ipfs
17, httpx
18, httpcore
19}:
20
21buildPythonPackage rec {
22 pname = "ipfshttpclient";
23 version = "0.7.0";
24 format = "flit";
25 disabled = pythonOlder "3.5";
26
27 src = fetchFromGitHub {
28 owner = "ipfs-shipyard";
29 repo = "py-ipfs-http-client";
30 rev = version;
31 sha256 = "sha256-0lMoZo/9kZUXkaKvD9ZAZDQdGX7eNLzJVszZdlM/3Qs=";
32 };
33
34 propagatedBuildInputs = [
35 py-multiaddr
36 requests
37 ];
38
39 checkInputs = [
40 pytestCheckHook
41 pytest-cov
42 pytest-dependency
43 pytest-localserver
44 pytest-mock
45 pytest-order
46 pytest-cid
47 mock
48 ipfs
49 httpcore
50 httpx
51 ];
52
53 postPatch = ''
54 # Remove when the package supports the latest IPFS version by default
55 substituteInPlace ipfshttpclient/client/__init__.py \
56 --replace 'VERSION_MAXIMUM = "0.8.0"' \
57 'VERSION_MAXIMUM = "0.9.0"'
58
59 # Use pytest-order instead of pytest-ordering since the latter is unmaintained and broken
60 substituteInPlace test/run-tests.py \
61 --replace 'pytest_ordering' 'pytest_order'
62 substituteInPlace test/functional/test_miscellaneous.py \
63 --replace '@pytest.mark.last' '@pytest.mark.order("last")'
64 '';
65
66 checkPhase = ''
67 runHook preCheck
68
69 ${python.interpreter} -X utf8 test/run-tests.py
70
71 runHook postCheck
72 '';
73
74 pythonImportsCheck = [ "ipfshttpclient" ];
75
76 meta = with lib; {
77 description = "A python client library for the IPFS API";
78 homepage = "https://github.com/ipfs-shipyard/py-ipfs-http-client";
79 license = licenses.mit;
80 maintainers = with maintainers; [ mguentner Luflosi ];
81 };
82}