1{ lib
2, stdenv
3, aiohttp
4, buildPythonPackage
5, eventlet
6, fetchFromGitHub
7, iana-etc
8, libredirect
9, mock
10, pytestCheckHook
11, pythonOlder
12, requests
13, simple-websocket
14, tornado
15, websocket-client
16}:
17
18buildPythonPackage rec {
19 pname = "python-engineio";
20 version = "4.7.1";
21 format = "setuptools";
22
23 disabled = pythonOlder "3.6";
24
25 src = fetchFromGitHub {
26 owner = "miguelgrinberg";
27 repo = "python-engineio";
28 rev = "refs/tags/v${version}";
29 hash = "sha256-jHXpPnrQlIpmQ2sY4y6AUx/6W8Pf+683s4NmmlwZO58=";
30 };
31
32 propagatedBuildInputs = [
33 simple-websocket
34 ];
35
36 passthru.optional-dependencies = {
37 client = [
38 requests
39 websocket-client
40 ];
41 asyncio_client = [
42 aiohttp
43 ];
44 };
45
46 nativeCheckInputs = [
47 aiohttp
48 eventlet
49 mock
50 requests
51 tornado
52 websocket-client
53 pytestCheckHook
54 ];
55
56 doCheck = !stdenv.isDarwin;
57
58 preCheck = lib.optionalString stdenv.isLinux ''
59 echo "nameserver 127.0.0.1" > resolv.conf
60 export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf) \
61 LD_PRELOAD=${libredirect}/lib/libredirect.so
62 '';
63
64 postCheck = ''
65 unset NIX_REDIRECTS LD_PRELOAD
66 '';
67
68 # somehow effective log level does not change?
69 disabledTests = [
70 "test_logger"
71 ];
72
73 pythonImportsCheck = [
74 "engineio"
75 ];
76
77 meta = with lib; {
78 description = "Python based Engine.IO client and server";
79 longDescription = ''
80 Engine.IO is a lightweight transport protocol that enables real-time
81 bidirectional event-based communication between clients and a server.
82 '';
83 homepage = "https://github.com/miguelgrinberg/python-engineio/";
84 changelog = "https://github.com/miguelgrinberg/python-engineio/blob/v${version}/CHANGES.md";
85 license = with licenses; [ mit ];
86 maintainers = with maintainers; [ mic92 ];
87 };
88}