1{ stdenv 2, lib 3, buildPythonPackage 4, fetchFromGitHub 5, pythonOlder 6, python 7, py-multiaddr 8, requests 9, pytestCheckHook 10, pytest-cov 11, pytest-dependency 12, pytest-localserver 13, pytest-mock 14, pytest-order 15, pytest-cid 16, mock 17, kubo 18, httpx 19, httpcore 20}: 21 22buildPythonPackage rec { 23 pname = "ipfshttpclient"; 24 version = "0.8.0a2"; 25 format = "flit"; 26 disabled = pythonOlder "3.6"; 27 28 src = fetchFromGitHub { 29 owner = "ipfs-shipyard"; 30 repo = "py-ipfs-http-client"; 31 rev = version; 32 sha256 = "sha256-OmC67pN2BbuGwM43xNDKlsLhwVeUbpvfOazyIDvoMEA="; 33 }; 34 35 propagatedBuildInputs = [ 36 py-multiaddr 37 requests 38 ]; 39 40 checkInputs = [ 41 pytestCheckHook 42 pytest-cov 43 pytest-dependency 44 pytest-localserver 45 pytest-mock 46 pytest-order 47 pytest-cid 48 mock 49 kubo 50 httpcore 51 httpx 52 ]; 53 54 postPatch = '' 55 # This can be removed for the 0.8.0 release 56 # Use pytest-order instead of pytest-ordering since the latter is unmaintained and broken 57 substituteInPlace test/run-tests.py \ 58 --replace 'pytest_ordering' 'pytest_order' 59 substituteInPlace test/functional/test_miscellaneous.py \ 60 --replace '@pytest.mark.last' '@pytest.mark.order("last")' 61 62 # Until a proper fix is created, just skip these tests 63 # and ignore any breakage that may result from the API change in IPFS 64 # See https://github.com/ipfs-shipyard/py-ipfs-http-client/issues/308 65 substituteInPlace test/functional/test_pubsub.py \ 66 --replace '# the message that will be published' 'pytest.skip("This test fails because of an incompatibility with the experimental PubSub feature in IPFS>=0.11.0")' \ 67 --replace '# subscribe to the topic testing' 'pytest.skip("This test fails because of an incompatibility with the experimental PubSub feature in IPFS>=0.11.0")' 68 substituteInPlace test/functional/test_other.py \ 69 --replace 'import ipfshttpclient' 'import ipfshttpclient; import pytest' \ 70 --replace 'assert ipfs_is_available' 'pytest.skip("Unknown test failure with IPFS >=0.11.0"); assert ipfs_is_available' 71 substituteInPlace test/run-tests.py \ 72 --replace '--cov-fail-under=90' '--cov-fail-under=75' 73 ''; 74 75 checkPhase = '' 76 runHook preCheck 77 78 ${python.interpreter} -X utf8 test/run-tests.py 79 80 runHook postCheck 81 ''; 82 83 doCheck = false; 84 85 pythonImportsCheck = [ "ipfshttpclient" ]; 86 87 meta = with lib; { 88 broken = stdenv.isDarwin; 89 description = "A python client library for the IPFS API"; 90 homepage = "https://github.com/ipfs-shipyard/py-ipfs-http-client"; 91 license = licenses.mit; 92 maintainers = with maintainers; [ mguentner Luflosi ]; 93 }; 94}