nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 python,
5 callPackage,
6 fetchFromGitHub,
7 hatchling,
8 hatch-vcs,
9 pytestCheckHook,
10 configargparse,
11 cryptography,
12 flask,
13 flask-cors,
14 flask-login,
15 gevent,
16 geventhttpclient,
17 msgpack,
18 locust-cloud,
19 psutil,
20 pyquery,
21 pytest,
22 pyzmq,
23 requests,
24 retry,
25 tomli,
26 werkzeug,
27}:
28
29buildPythonPackage rec {
30 pname = "locust";
31 version = "2.43.1";
32 pyproject = true;
33
34 src = fetchFromGitHub {
35 owner = "locustio";
36 repo = "locust";
37 tag = version;
38 hash = "sha256-+0B4S524UjvaYl7VTZ1IY7UuBuDjUBqOvjHu0UVOi6A=";
39 };
40
41 postPatch = ''
42 substituteInPlace locust/test/test_main.py \
43 --replace-fail '"locust"' '"${placeholder "out"}/bin/locust"'
44
45 substituteInPlace locust/test/test_log.py \
46 --replace-fail '"locust"' '"${placeholder "out"}/bin/locust"'
47 '';
48
49 webui = callPackage ./webui.nix {
50 inherit version;
51 src = "${src}/locust/webui";
52 };
53
54 preBuild = ''
55 mkdir -p $out/${python.sitePackages}/locust/webui/dist
56 ln -sf ${webui}/dist/* $out/${python.sitePackages}/locust/webui/dist
57 '';
58
59 build-system = [
60 hatchling
61 hatch-vcs
62 ];
63
64 pythonRelaxDeps = [
65 # version 0.7.0.dev0 is not considered to be >= 0.6.3
66 "flask-login"
67 # version 6.0.1 is listed as 0.0.1 in the dependency check and 0.0.1 is not >= 3.0.10
68 "flask-cors"
69 "requests"
70 ];
71
72 dependencies = [
73 configargparse
74 flask
75 flask-cors
76 flask-login
77 gevent
78 geventhttpclient
79 msgpack
80 locust-cloud
81 psutil
82 pyzmq
83 requests
84 tomli
85 werkzeug
86 pytest
87 ];
88
89 pythonImportsCheck = [ "locust" ];
90
91 nativeCheckInputs = [
92 cryptography
93 pyquery
94 pytestCheckHook
95 retry
96 ];
97
98 # locust's test suite is very flaky, due to heavy reliance on timing-based tests and access to the
99 # network.
100 doCheck = false;
101
102 meta = {
103 description = "Developer-friendly load testing framework";
104 homepage = "https://docs.locust.io/";
105 changelog = "https://github.com/locustio/locust/blob/${src.tag}/CHANGELOG.md";
106 license = lib.licenses.mit;
107 maintainers = with lib.maintainers; [ jokatzke ];
108 };
109}