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