Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / python-modules / fastdtw / default.nix
blob1ceaf3b875a3afd1dc610dac462f3acd8d12368f
1 { lib
2 , buildPythonPackage
3 , fetchFromGitHub
4 , fetchpatch
5 , cython
6 , numpy
7   # Check Inputs
8 , pytestCheckHook
9 , python
12 buildPythonPackage rec {
13   pname = "fastdtw";
14   version = "0.3.4";
16   src = fetchFromGitHub {
17     owner = "slaypni";
18     repo = pname;
19     rev = "v${version}";
20     sha256 = "0irc5x4ahfp7f7q4ic97qa898s2awi0vdjznahxrfjirn8b157dw";
21   };
23   patches = [
24     # Removes outdated cythonized C++ file, which doesn't match CPython. Will be auto-used if left.
25     # Remove when PR 40 merged
26     (fetchpatch {
27       url = "https://patch-diff.githubusercontent.com/raw/slaypni/fastdtw/pull/40.patch";
28       sha256 = "0xjma0h84bk1n32wgk99rwfc85scp187a7fykhnylmcc73ppal9q";
29     })
30   ];
32   nativeBuildInputs = [
33     cython
34   ];
36   propagatedBuildInputs = [
37     numpy
38   ];
40   pythonImportsCheck = [ "fastdtw.fastdtw" ];
41   nativeCheckInputs = [ pytestCheckHook ];
42   dontUseSetuptoolsCheck = true;  # looks for pytest-runner
43   preCheck = ''
44     echo "Temporarily moving tests to $OUT to find cython modules"
45     export PACKAGEDIR=$out/${python.sitePackages}
46     cp -r $TMP/source/tests $PACKAGEDIR
47     pushd $PACKAGEDIR
48   '';
49   postCheck = ''
50     rm -rf tests
51     popd
52   '';
55   meta = with lib; {
56     description = "Python implementation of FastDTW (Dynamic Time Warping)";
57     longDescription = ''
58       FastDTW is an approximate Dynamic Time Warping (DTW) algorithm that provides
59       optimal or near-optimal alignments with an O(N) time and memory complexity.
60     '';
61     homepage = "https://github.com/slaypni/fastdtw";
62     license = licenses.mit;
63     maintainers = with maintainers; [ drewrisinger ];
64   };