diff mbox series

[bug#64732,v3,1/2] gnu: Add python-ffmpeg-python.

Message ID bcae23c779592e17719214ec54c89ba86c2e9aa9.1689922236.git.poomklao@yahoo.com
State New
Headers show
Series [bug#64732,v3,1/2] gnu: Add python-ffmpeg-python. | expand

Commit Message

Parnikkapore July 21, 2023, 6:50 a.m. UTC
* gnu/packages/python-xyz.scm (python-ffmpeg-python): New variable.
---

I was not aware, thank you! The "flag the tests in the source" method
is the one I spotted when looking around python-xyz.

Included in this email is a v3 that uses the -k flag.

 gnu/packages/python-xyz.scm | 42 +++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)


base-commit: 1d837aaa32a3a2de8f4a1ac391f92effba50834e

Comments

jgart July 22, 2023, 1:06 p.m. UTC | #1
Hi Parnikkapore,

See the comment I left in this GitHub issue thread: 

https://github.com/kkroening/ffmpeg-python/issues/760#issuecomment-1646579040

Let's wait for a moment to hear back on that project's status.

all best,

jgart
Parnikkapore July 22, 2023, 1:50 p.m. UTC | #2
Hi all,

jgart suggested on the GitHub thread that we pick a new commit from upstream instead of patching the release.

Should we use https://github.com/kkroening/ffmpeg-python/commit/6189cd6861a90f6f52e6a8ba2db0fada54134194 (the commit that fixes the issue upstream) or https://github.com/kkroening/ffmpeg-python/commit/df129c7ba30aaa9ffffb81a48f53aa7253b0b4e6 (the last ever commit before the project went silent)?
jgart July 22, 2023, 1:54 p.m. UTC | #3
Lars,

Should these be patched to refer to our ffmpeg?

https://github.com/kkroening/ffmpeg-python/blob/df129c7ba30aaa9ffffb81a48f53aa7253b0b4e6/ffmpeg/_run.py#L302

And a call to subprocess.check_call in the tests:

https://github.com/kkroening/ffmpeg-python/blob/df129c7ba30aaa9ffffb81a48f53aa7253b0b4e6/ffmpeg/tests/test_ffmpeg.py#L29

WDYT if we document our policy for patching executables. Currently, this practice is tribal knowledge that Guixers receive during patch review but we don't have it officially in writing anywhere (e.g. manual, cookbook, etc)

Ludo WDYT

all best,

jgart
jgart July 22, 2023, 2:34 p.m. UTC | #4
> Ludo WDYT

Or anyone else on the team:

Zimoun WDYT ;()

Efraim WDYT ;()

yours truly,

jgart
Lars-Dominik Braun July 22, 2023, 3:59 p.m. UTC | #5
Hi,

> Should these be patched to refer to our ffmpeg?
> 
> https://github.com/kkroening/ffmpeg-python/blob/df129c7ba30aaa9ffffb81a48f53aa7253b0b4e6/ffmpeg/_run.py#L302

yes.

> And a call to subprocess.check_call in the tests:
> 
> https://github.com/kkroening/ffmpeg-python/blob/df129c7ba30aaa9ffffb81a48f53aa7253b0b4e6/ffmpeg/tests/test_ffmpeg.py#L29

Probably fine. The tests will find the only (and correct) ffmpeg if it’s an input.

Lars
jgart July 22, 2023, 6:13 p.m. UTC | #6
> Probably fine. The tests will find the only (and correct) ffmpeg if it’s an input.

Hi Lars, 

The tests will only ever use the guix installed ffmpeg in the inputs even if the user installed ffmpeg via dnf on Fedora, for example?

I haven't tested that edge case myself.

happy hacking,

jgart
jgart July 24, 2023, 7:11 p.m. UTC | #7
>> Should these be patched to refer to our ffmpeg?
>> 
>> https://github.com/kkroening/ffmpeg-python/blob/df129c7ba30aaa9ffffb81a48f53aa7253b0b4e6/ffmpeg/_run
>> py#L302
> 
> yes.

Lars,

Thanks.

Parnikkapore,

Can you send another revision patching the ffmpeg executable?

No need to patch the ffmpeg executable in the tests as those are run hermetically in a container and will only ever use/find the Guix-installed ffmpeg.

all best,

jgart
diff mbox series

Patch

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 755b0af4b6..10cadd6e15 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -139,6 +139,7 @@ 
 ;;; Copyright © 2023 Dominik Delgado Steuter <d@delgado.nrw>
 ;;; Copyright © 2023 Ivan Vilata-i-Balaguer <ivan@selidor.net>
 ;;; Copyright © 2023 Ontje Lünsdorf <ontje.luensdorf@dlr.de>
+;;; Copyright © 2023 Parnikkapore <poomklao@yahoo.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -8918,6 +8919,47 @@  (define-public python-lfdfiles
 experimental data and metadata at the Laboratory for Fluorescence Dynamics.")
     (license license:bsd-3)))
 
+(define-public python-ffmpeg-python
+  (package
+    (name "python-ffmpeg-python")
+    (version "0.2.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                     (url "https://github.com/kkroening/ffmpeg-python.git")
+                     (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+                (base32
+                  "0mmydmfz3yiclbgi4lqrv9fh2nalafg4bkm92y2qi50mwqgffk8f"))
+              (snippet
+                #~(begin
+                    (use-modules (guix build utils))
+                    (substitute* "ffmpeg/_run.py"
+                      (("collections\\.Iterable")
+                        "collections.abc.Iterable"))))))
+    (build-system python-build-system)
+    (arguments
+      (list
+       #:phases
+       #~(modify-phases %standard-phases
+           (replace 'check
+             (lambda* (#:key tests? #:allow-other-keys)
+               (when tests?
+                 (invoke "pytest" "-vv"
+                         "-k" "not test_pipe and not test__probe")))))))
+    (inputs (list python-future))
+    (propagated-inputs (list ffmpeg))
+    (native-inputs (list python-future python-numpy python-pytest
+                         python-pytest-mock python-pytest-runner))
+    (home-page "https://github.com/kkroening/ffmpeg-python")
+    (synopsis "Python bindings for FFmpeg - with complex filtering support")
+    (description
+      "ffmpeg-python allows you to write FFmpeg filtergraphs in familiar
+Python terms, taking care of running ffmpeg with the correct command-line
+arguments. It handles arbitrarily large (directed-acyclic) signal graphs.")
+    (license license:asl2.0)))
+
 (define-public python-imageio-ffmpeg
   (package
    (name "python-imageio-ffmpeg")