Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python3Packages.locust: init at 2.31.2 #334644

Merged
merged 1 commit into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
python3Packages.locust: init at 2.31.2
  • Loading branch information
jokatzke committed Nov 19, 2024
commit be67987bf6145fd3e41e2161a56163272c9854d5
105 changes: 105 additions & 0 deletions pkgs/development/python-modules/locust/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
lib,
buildPythonPackage,
python,
callPackage,
fetchFromGitHub,
poetry-core,
poetry-dynamic-versioning,
pytestCheckHook,
configargparse,
cryptography,
flask,
flask-cors,
flask-login,
gevent,
geventhttpclient,
msgpack,
psutil,
pyquery,
pyzmq,
requests,
retry,
tomli,
werkzeug,
}:

buildPythonPackage rec {
pname = "locust";
version = "2.31.2";
pyproject = true;

src = fetchFromGitHub {
owner = "locustio";
repo = "locust";
rev = "refs/tags/${version}";
hash = "sha256-xDquVQjkWVER9h0a6DHWRZH6KtRf0jsThycSojDEdh4=";
};

postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail 'script = "pre_build.py"' ""

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}/${pname}
ln -sf ${webui} $out/${python.sitePackages}/${pname}/webui
'';

build-system = [
poetry-core
poetry-dynamic-versioning
];

pythonRelaxDeps = [
# version 0.7.0.dev0 is not considered to be >= 0.6.3
"flask-login"
];

dependencies = [
configargparse
flask
flask-cors
flask-login
gevent
geventhttpclient
msgpack
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/${version}/CHANGELOG.md";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ jokatzke ];
};
}
32 changes: 32 additions & 0 deletions pkgs/development/python-modules/locust/webui.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
stdenv,
fetchYarnDeps,
yarnConfigHook,
yarnBuildHook,
nodejs,
version,
src,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "locust-ui";
inherit version src;

yarnOfflineCache = fetchYarnDeps {
yarnLock = "${finalAttrs.src}/yarn.lock";
hash = "sha256-ek02mjB8DsBUOR28WSuqj6oVvxTq8EKTNXWFFI3OhuU=";
};

nativeBuildInputs = [
yarnConfigHook
yarnBuildHook
nodejs
];

dontNpmPrune = true;
yarnBuildScript = "build";
postInstall = ''
mkdir -p $out/dist
cp -r dist/** $out/dist
'';
})
2 changes: 2 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7550,6 +7550,8 @@ self: super: with self; {

lockfile = callPackage ../development/python-modules/lockfile { };

locust = callPackage ../development/python-modules/locust { };

log-symbols = callPackage ../development/python-modules/log-symbols { };

logbook = callPackage ../development/python-modules/logbook { };
Expand Down
Loading