1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6
7 # build-system
8 setuptools,
9
10 # dependencies
11 bidict,
12 python-engineio,
13
14 # optional-dependencies
15 aiohttp,
16 requests,
17 websocket-client,
18
19 # tests
20 msgpack,
21 pytestCheckHook,
22 simple-websocket,
23 uvicorn,
24
25}:
26
27buildPythonPackage rec {
28 pname = "python-socketio";
29 version = "5.11.3";
30 pyproject = true;
31
32 disabled = pythonOlder "3.6";
33
34 src = fetchFromGitHub {
35 owner = "miguelgrinberg";
36 repo = "python-socketio";
37 rev = "refs/tags/v${version}";
38 hash = "sha256-8LpTrDxugZS6skSRCcDK4+sbSYV9ZBRSma4QfIXFJT8=";
39 };
40
41 nativeBuildInputs = [ setuptools ];
42
43 propagatedBuildInputs = [
44 bidict
45 python-engineio
46 ];
47
48 passthru.optional-dependencies = {
49 client = [
50 requests
51 websocket-client
52 ];
53 asyncio_client = [ aiohttp ];
54 };
55
56 nativeCheckInputs = [
57 msgpack
58 pytestCheckHook
59 uvicorn
60 simple-websocket
61 ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);
62
63 pythonImportsCheck = [ "socketio" ];
64
65 meta = with lib; {
66 description = "Python Socket.IO server and client";
67 longDescription = ''
68 Socket.IO is a lightweight transport protocol that enables real-time
69 bidirectional event-based communication between clients and a server.
70 '';
71 homepage = "https://github.com/miguelgrinberg/python-socketio/";
72 changelog = "https://github.com/miguelgrinberg/python-socketio/blob/v${version}/CHANGES.md";
73 license = with licenses; [ mit ];
74 maintainers = with maintainers; [ mic92 ];
75 };
76}