1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 setuptools,
9
10 # dependencies
11 decorator,
12 imageio,
13 imageio-ffmpeg,
14 numpy,
15 proglog,
16 python-dotenv,
17 requests,
18 tqdm,
19
20 # optional-dependencies
21 matplotlib,
22 scikit-image,
23 scikit-learn,
24 scipy,
25 yt-dlp,
26
27 # tests
28 pytest-timeout,
29 pytestCheckHook,
30}:
31
32buildPythonPackage rec {
33 pname = "moviepy";
34 version = "2.2.1";
35 pyproject = true;
36
37 src = fetchFromGitHub {
38 owner = "Zulko";
39 repo = "moviepy";
40 tag = "v${version}";
41 hash = "sha256-3vt/EyEOv6yNPgewkgcWcjM0TbQ6IfkR6nytS/WpRyg=";
42 };
43
44 build-system = [ setuptools ];
45
46 pythonRelaxDeps = [ "pillow" ];
47
48 dependencies = [
49 decorator
50 imageio
51 imageio-ffmpeg
52 numpy
53 proglog
54 python-dotenv
55 requests
56 tqdm
57 ];
58
59 optional-dependencies = {
60 optionals = [
61 matplotlib
62 scikit-image
63 scikit-learn
64 scipy
65 yt-dlp
66 ];
67 };
68
69 nativeCheckInputs = [
70 pytest-timeout
71 pytestCheckHook
72 ]
73 ++ lib.flatten (lib.attrValues optional-dependencies);
74
75 # See https://github.com/NixOS/nixpkgs/issues/381908 and https://github.com/NixOS/nixpkgs/issues/385450.
76 pytestFlags = [ "--timeout=600" ];
77
78 pythonImportsCheck = [ "moviepy" ];
79
80 disabledTests = [
81 # stalls
82 "test_doc_examples"
83 # video orientation mismatch, 0 != 180
84 "test_PR_529"
85 # video orientation [1920, 1080] != [1080, 1920]
86 "test_ffmpeg_parse_video_rotation"
87 "test_correct_video_rotation"
88 # media duration mismatch: assert 230.0 == 30.02
89 "test_ffmpeg_parse_infos_decode_file"
90 # Failed: DID NOT RAISE <class 'OSError'>
91 "test_ffmpeg_resize"
92 "test_ffmpeg_stabilize_video"
93 ]
94 ++ lib.optionals stdenv.hostPlatform.isDarwin [
95 # Failed: Timeout >30.0s
96 "test_issue_1682"
97 ];
98
99 disabledTestPaths = [
100 "tests/test_compositing.py"
101 "tests/test_fx.py"
102 "tests/test_ImageSequenceClip.py"
103 "tests/test_TextClip.py"
104 "tests/test_VideoClip.py"
105 "tests/test_videotools.py"
106 ];
107
108 meta = {
109 description = "Video editing with Python";
110 homepage = "https://zulko.github.io/moviepy/";
111 changelog = "https://github.com/Zulko/moviepy/blob/${src.tag}/CHANGELOG.md";
112 license = lib.licenses.mit;
113 maintainers = [ ];
114 };
115}