1{
2 lib,
3 stdenv,
4 aiohttp,
5 buildPythonPackage,
6 setuptools,
7 eventlet,
8 fetchFromGitHub,
9 iana-etc,
10 libredirect,
11 mock,
12 pytestCheckHook,
13 pythonOlder,
14 requests,
15 simple-websocket,
16 tornado,
17 websocket-client,
18}:
19
20buildPythonPackage rec {
21 pname = "python-engineio";
22 version = "4.9.1";
23 pyproject = true;
24
25 disabled = pythonOlder "3.8";
26
27 src = fetchFromGitHub {
28 owner = "miguelgrinberg";
29 repo = "python-engineio";
30 rev = "refs/tags/v${version}";
31 hash = "sha256-wn2qiVkL05GTopGJeghHe9i+wyOQZbEeYDmEIIbXDS0=";
32 };
33
34 build-system = [ setuptools ];
35
36 dependencies = [ simple-websocket ];
37
38 passthru.optional-dependencies = {
39 client = [
40 requests
41 websocket-client
42 ];
43 asyncio_client = [ aiohttp ];
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 = [ "test_logger" ];
70
71 pythonImportsCheck = [ "engineio" ];
72
73 meta = with lib; {
74 description = "Python based Engine.IO client and server";
75 longDescription = ''
76 Engine.IO is a lightweight transport protocol that enables real-time
77 bidirectional event-based communication between clients and a server.
78 '';
79 homepage = "https://github.com/miguelgrinberg/python-engineio/";
80 changelog = "https://github.com/miguelgrinberg/python-engineio/blob/v${version}/CHANGES.md";
81 license = with licenses; [ mit ];
82 maintainers = with maintainers; [ mic92 ];
83 };
84}