1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 cython,
6 oldest-supported-numpy,
7 setuptools,
8 wheel,
9 scipy,
10 numpy,
11 pytestCheckHook,
12}:
13
14buildPythonPackage rec {
15 pname = "dtw-python";
16 version = "1.7.2";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "DynamicTimeWarping";
21 repo = "dtw-python";
22 tag = "v${version}";
23 hash = "sha256-DaYqKvjbp2yjL0a5f+vkB4OFOCWqt+f1HUUfarbns3A=";
24 };
25
26 build-system = [
27 cython
28 oldest-supported-numpy
29 setuptools
30 wheel
31 ];
32
33 dependencies = [
34 scipy
35 numpy
36 ];
37
38 # We need to run tests on real built package: https://github.com/NixOS/nixpkgs/issues/255262
39 # tests/ are not included to output package, so we have to set path explicitly
40 preCheck = ''
41 appendToVar enabledTestPaths "$src/tests"
42 cd $out
43 '';
44
45 nativeCheckInputs = [ pytestCheckHook ];
46
47 pythonImportsCheck = [ "dtw" ];
48
49 meta = with lib; {
50 description = "Python port of R's Comprehensive Dynamic Time Warp algorithms package";
51 homepage = "https://github.com/DynamicTimeWarping/dtw-python";
52 changelog = "https://github.com/DynamicTimeWarping/dtw-python/blob/${src.tag}/CHANGELOG.md";
53 license = licenses.gpl3Only;
54 maintainers = with maintainers; [ mbalatsko ];
55 mainProgram = "dtw";
56 };
57}