nixpkgs/pkgs/development/python-modules/dtw-python/default.nix
Wolfgang Walther c23f21bead
python3Packages.dtw-python: set pytestFlagsArray in preCheck hook
This flag relies on bash eval of pytestFlagsArray, which we'd like to
get rid of. By moving the evaluation of $src into the preCheck hook, we
achieve the same.
2024-11-12 21:09:43 +01:00

60 lines
1.3 KiB
Nix

{
lib,
buildPythonPackage,
fetchFromGitHub,
cython,
oldest-supported-numpy,
setuptools,
wheel,
scipy,
numpy,
pytestCheckHook,
pythonOlder,
}:
buildPythonPackage rec {
pname = "dtw-python";
version = "1.5.3";
format = "pyproject";
disabled = pythonOlder "3.6";
src = fetchFromGitHub {
owner = "DynamicTimeWarping";
repo = "dtw-python";
rev = "refs/tags/v${version}";
hash = "sha256-Q2TffroAGS6DeU5hUE/M2Luuxa5VfU+wxbGdfhcioSA=";
};
nativeBuildInputs = [
cython
oldest-supported-numpy
setuptools
wheel
];
propagatedBuildInputs = [
scipy
numpy
];
# We need to run tests on real built package: https://github.com/NixOS/nixpkgs/issues/255262
# tests/ are not included to output package, so we have to set path explicitly
preCheck = ''
appendToVar pytestFlagsArray "$src/tests"
cd $out
'';
nativeCheckInputs = [ pytestCheckHook ];
pythonImportsCheck = [ "dtw" ];
meta = with lib; {
description = "Python port of R's Comprehensive Dynamic Time Warp algorithms package";
mainProgram = "dtw";
homepage = "https://github.com/DynamicTimeWarping/dtw-python";
changelog = "https://github.com/DynamicTimeWarping/dtw-python/blob/${src.rev}/CHANGELOG.md";
license = licenses.gpl3Only;
maintainers = with maintainers; [ mbalatsko ];
};
}