1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 flit-core, 6 pythonOlder, 7 python, 8 py-multiaddr, 9 requests, 10 pytestCheckHook, 11 pytest-cov-stub, 12 pytest-dependency, 13 pytest-localserver, 14 pytest-mock, 15 pytest-order, 16 pytest-cid, 17 mock, 18 kubo, 19 httpx, 20 httpcore, 21}: 22 23buildPythonPackage rec { 24 pname = "ipfshttpclient"; 25 version = "0.8.0a2"; 26 format = "pyproject"; 27 disabled = pythonOlder "3.6"; 28 29 src = fetchFromGitHub { 30 owner = "ipfs-shipyard"; 31 repo = "py-ipfs-http-client"; 32 rev = version; 33 hash = "sha256-OmC67pN2BbuGwM43xNDKlsLhwVeUbpvfOazyIDvoMEA="; 34 }; 35 36 nativeBuildInputs = [ flit-core ]; 37 38 propagatedBuildInputs = [ 39 py-multiaddr 40 requests 41 ]; 42 43 nativeCheckInputs = [ 44 pytestCheckHook 45 pytest-cov-stub 46 pytest-dependency 47 pytest-localserver 48 pytest-mock 49 pytest-order 50 pytest-cid 51 mock 52 kubo 53 httpcore 54 httpx 55 ]; 56 57 postPatch = '' 58 # This can be removed for the 0.8.0 release 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 # Until a proper fix is created, just skip these tests 66 # and ignore any breakage that may result from the API change in IPFS 67 # See https://github.com/ipfs-shipyard/py-ipfs-http-client/issues/308 68 substituteInPlace test/functional/test_pubsub.py \ 69 --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")' \ 70 --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")' 71 substituteInPlace test/functional/test_other.py \ 72 --replace 'import ipfshttpclient' 'import ipfshttpclient; import pytest' \ 73 --replace 'assert ipfs_is_available' 'pytest.skip("Unknown test failure with IPFS >=0.11.0"); assert ipfs_is_available' 74 ''; 75 76 checkPhase = '' 77 runHook preCheck 78 79 ${python.interpreter} -X utf8 test/run-tests.py 80 81 runHook postCheck 82 ''; 83 84 doCheck = false; 85 86 pythonImportsCheck = [ "ipfshttpclient" ]; 87 88 meta = with lib; { 89 description = "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; [ 93 mguentner 94 Luflosi 95 ]; 96 }; 97}