summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/moviepy/default.nix
blob: 1c19771956998ca6d8999fe9259721ade1bb36bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  setuptools,

  # dependencies
  decorator,
  imageio,
  imageio-ffmpeg,
  numpy,
  proglog,
  python-dotenv,
  requests,
  tqdm,

  # optional-dependencies
  matplotlib,
  scikit-image,
  scikit-learn,
  scipy,
  yt-dlp,

  # tests
  pytest-timeout,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "moviepy";
  version = "2.2.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "Zulko";
    repo = "moviepy";
    tag = "v${version}";
    hash = "sha256-3vt/EyEOv6yNPgewkgcWcjM0TbQ6IfkR6nytS/WpRyg=";
  };

  build-system = [ setuptools ];

  pythonRelaxDeps = [ "pillow" ];

  dependencies = [
    decorator
    imageio
    imageio-ffmpeg
    numpy
    proglog
    python-dotenv
    requests
    tqdm
  ];

  optional-dependencies = {
    optionals = [
      matplotlib
      scikit-image
      scikit-learn
      scipy
      yt-dlp
    ];
  };

  nativeCheckInputs = [
    pytest-timeout
    pytestCheckHook
  ]
  ++ lib.concatAttrValues optional-dependencies;

  # See https://github.com/NixOS/nixpkgs/issues/381908 and https://github.com/NixOS/nixpkgs/issues/385450.
  pytestFlags = [ "--timeout=600" ];

  pythonImportsCheck = [ "moviepy" ];

  disabledTests = [
    # stalls
    "test_doc_examples"
    # video orientation mismatch, 0 != 180
    "test_PR_529"
    # video orientation [1920, 1080] != [1080, 1920]
    "test_ffmpeg_parse_video_rotation"
    "test_correct_video_rotation"
    # media duration mismatch: assert 230.0 == 30.02
    "test_ffmpeg_parse_infos_decode_file"
    # Failed: DID NOT RAISE <class 'OSError'>
    "test_ffmpeg_resize"
    "test_ffmpeg_stabilize_video"
  ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [
    # Failed: Timeout >30.0s
    "test_issue_1682"
  ];

  disabledTestPaths = [
    "tests/test_compositing.py"
    "tests/test_fx.py"
    "tests/test_ImageSequenceClip.py"
    "tests/test_TextClip.py"
    "tests/test_VideoClip.py"
    "tests/test_videotools.py"
  ];

  meta = {
    description = "Video editing with Python";
    homepage = "https://zulko.github.io/moviepy/";
    changelog = "https://github.com/Zulko/moviepy/blob/${src.tag}/CHANGELOG.md";
    license = lib.licenses.mit;
    maintainers = [ ];
  };
}