summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/simple-websocket/default.nix
blob: 66de62481a044e77db4a4b3aa55301137fa71f66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  wsproto,
  pythonAtLeast,
  pytestCheckHook,
}:

buildPythonPackage (finalAttrs: {
  pname = "simple-websocket";
  version = "1.1.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "miguelgrinberg";
    repo = "simple-websocket";
    tag = "v${finalAttrs.version}";
    hash = "sha256-dwL6GUyygNGBXqkkTnsHwFFpa1JAaeWc9ycQNRgTN4I=";
  };

  build-system = [ setuptools ];

  dependencies = [ wsproto ];

  nativeCheckInputs = [ pytestCheckHook ];

  pythonImportsCheck = [ "simple_websocket" ];

  disabledTests = [
    # Tests require network access
    "SimpleWebSocketClientTestCase"
  ]
  ++ lib.optionals (pythonAtLeast "3.14") [
    # RuntimeError: There is no current event loop in thread 'MainThread'
    "AioSimpleWebSocketServerTestCase"
  ];

  meta = {
    description = "Simple WebSocket server and client for Python";
    homepage = "https://github.com/miguelgrinberg/simple-websocket";
    changelog = "https://github.com/miguelgrinberg/simple-websocket/blob/${finalAttrs.src.tag}/CHANGES.md";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ fab ];
  };
})