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