nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
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 redis,
25 valkey,
26 pytest-asyncio,
27
28}:
29
30buildPythonPackage rec {
31 pname = "python-socketio";
32 version = "5.16.0";
33 pyproject = true;
34
35 src = fetchFromGitHub {
36 owner = "miguelgrinberg";
37 repo = "python-socketio";
38 tag = "v${version}";
39 hash = "sha256-20qTND62sIrWuJ7kY+4Pf9qP9Z5+CrItPiXnTDhmcME=";
40 };
41
42 build-system = [ setuptools ];
43
44 dependencies = [
45 bidict
46 python-engineio
47 ];
48
49 optional-dependencies = {
50 client = [
51 requests
52 websocket-client
53 ];
54 asyncio_client = [ aiohttp ];
55 };
56
57 nativeCheckInputs = [
58 msgpack
59 pytestCheckHook
60 uvicorn
61 simple-websocket
62 redis
63 valkey
64 pytest-asyncio
65 ]
66 ++ lib.concatAttrValues optional-dependencies;
67
68 pythonImportsCheck = [ "socketio" ];
69
70 disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [
71 # Use fixed ports which leads to failures when building concurrently
72 "tests/async/test_admin.py"
73 "tests/common/test_admin.py"
74 ];
75
76 __darwinAllowLocalNetworking = true;
77
78 meta = {
79 description = "Python Socket.IO server and client";
80 longDescription = ''
81 Socket.IO is a lightweight transport protocol that enables real-time
82 bidirectional event-based communication between clients and a server.
83 '';
84 homepage = "https://github.com/miguelgrinberg/python-socketio/";
85 changelog = "https://github.com/miguelgrinberg/python-socketio/blob/${src.tag}/CHANGES.md";
86 license = with lib.licenses; [ mit ];
87 maintainers = with lib.maintainers; [ mic92 ];
88 };
89}