Files
nixpkgs/pkgs/development/python-modules/locust/default.nix
magicquark 47ea10eaab locust: fix build errors
- Upstream moved from `yarn` to `yarn berry` in
a863a60d58

- The version bump of `locust` from 2.33.1 to 2.37.14 in
0c5bbee473,
did not update the `webui.nix` file that inherits the source in
`default.nix`. The
diff (https://github.com/locustio/locust/compare/2.33.1...2.37.14) shows
that the change to yarn berry was made in between the version bump.

- A new dependency was added during the version bump to `locust` of
  `locust-cloud`.

- Resolves: https://github.com/NixOS/nixpkgs/issues/441033

- Add back in a preBuild hook, slightly reworked, that was removed in
  PR 388942.
2025-09-23 21:06:40 +01:00

107 lines
2.1 KiB
Nix

{
lib,
buildPythonPackage,
python,
callPackage,
fetchFromGitHub,
hatchling,
hatch-vcs,
pytestCheckHook,
configargparse,
cryptography,
flask,
flask-cors,
flask-login,
gevent,
geventhttpclient,
msgpack,
locust-cloud,
psutil,
pyquery,
pyzmq,
requests,
retry,
tomli,
werkzeug,
}:
buildPythonPackage rec {
pname = "locust";
version = "2.37.14";
pyproject = true;
src = fetchFromGitHub {
owner = "locustio";
repo = "locust";
tag = version;
hash = "sha256-16pMl72OIZlAi6jNx0qv0TO9RTm6O9CgiE84sndsEhc=";
};
postPatch = ''
substituteInPlace locust/test/test_main.py \
--replace-fail '"locust"' '"${placeholder "out"}/bin/locust"'
substituteInPlace locust/test/test_log.py \
--replace-fail '"locust"' '"${placeholder "out"}/bin/locust"'
'';
webui = callPackage ./webui.nix {
inherit version;
src = "${src}/locust/webui";
};
preBuild = ''
mkdir -p $out/${python.sitePackages}/locust/webui/dist
ln -sf ${webui}/dist/* $out/${python.sitePackages}/locust/webui/dist
'';
build-system = [
hatchling
hatch-vcs
];
pythonRelaxDeps = [
# version 0.7.0.dev0 is not considered to be >= 0.6.3
"flask-login"
# version 6.0.1 is listed as 0.0.1 in the dependency check and 0.0.1 is not >= 3.0.10
"flask-cors"
];
dependencies = [
configargparse
flask
flask-cors
flask-login
gevent
geventhttpclient
msgpack
locust-cloud
psutil
pyzmq
requests
tomli
werkzeug
];
pythonImportsCheck = [ "locust" ];
nativeCheckInputs = [
cryptography
pyquery
pytestCheckHook
retry
];
# locust's test suite is very flaky, due to heavy reliance on timing-based tests and access to the
# network.
doCheck = false;
meta = {
description = "Developer-friendly load testing framework";
homepage = "https://docs.locust.io/";
changelog = "https://github.com/locustio/locust/blob/${src.tag}/CHANGELOG.md";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ jokatzke ];
};
}