1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 pythonOlder, 7 setuptools, 8 exceptiongroup, 9 pytest-trio, 10 pytestCheckHook, 11 trio, 12 trustme, 13 wsproto, 14}: 15 16buildPythonPackage rec { 17 pname = "trio-websocket"; 18 version = "0.12.2"; 19 pyproject = true; 20 21 src = fetchFromGitHub { 22 owner = "HyperionGray"; 23 repo = "trio-websocket"; 24 rev = version; 25 hash = "sha256-TGFf4WUeZDrjp/UiQ9O/GoaK5BRC2aaGZVPfqZ4Ip9I="; 26 }; 27 28 build-system = [ setuptools ]; 29 30 dependencies = [ 31 trio 32 wsproto 33 ] 34 ++ lib.optionals (pythonOlder "3.11") [ exceptiongroup ]; 35 36 nativeCheckInputs = [ 37 pytest-trio 38 pytestCheckHook 39 trustme 40 ]; 41 42 disabledTests = [ 43 # https://github.com/python-trio/trio-websocket/issues/187 44 "test_handshake_exception_before_accept" 45 "test_reject_handshake" 46 "test_reject_handshake_invalid_info_status" 47 "test_client_open_timeout" 48 "test_client_close_timeout" 49 "test_client_connect_networking_error" 50 "test_finalization_dropped_exception" 51 ] 52 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 53 # Failed: DID NOT RAISE <class 'ValueError'> 54 "test_finalization_dropped_exception" 55 # Timing related 56 "test_client_close_timeout" 57 "test_cm_exit_with_pending_messages" 58 "test_server_close_timeout" 59 "test_server_handler_exit" 60 "test_server_open_timeout" 61 ]; 62 63 __darwinAllowLocalNetworking = true; 64 65 pythonImportsCheck = [ "trio_websocket" ]; 66 67 meta = with lib; { 68 changelog = "https://github.com/HyperionGray/trio-websocket/blob/${version}/CHANGELOG.md"; 69 description = "WebSocket client and server implementation for Python Trio"; 70 homepage = "https://github.com/HyperionGray/trio-websocket"; 71 license = licenses.mit; 72 maintainers = [ ]; 73 }; 74}