GNU bug report logs - #49469
[PATCH] gnu: Add python-pysox.

Previous Next

Package: guix-patches;

Reported by: "jgart" <jgart <at> dismail.de>

Date: Thu, 8 Jul 2021 18:47:01 UTC

Severity: normal

Tags: patch

Done: Arun Isaac <arunisaac <at> systemreboot.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 49469 in the body.
You can then email your comments to 49469 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#49469; Package guix-patches. (Thu, 08 Jul 2021 18:47:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to "jgart" <jgart <at> dismail.de>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 08 Jul 2021 18:47:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "jgart" <jgart <at> dismail.de>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: Add python-pysox.
Date: Thu, 08 Jul 2021 18:45:57 +0000
Hi Guix!

Here is python-pysox.

Tests for this package depend on https://issues.guix.gnu.org/47181

all best,

jgart




Information forwarded to guix-patches <at> gnu.org:
bug#49469; Package guix-patches. (Thu, 08 Jul 2021 19:37:01 GMT) Full text and rfc822 format available.

Message #8 received at 49469 <at> debbugs.gnu.org (full text, mbox):

From: jgart <jgart <at> dismail.de>
To: 49469 <at> debbugs.gnu.org
Cc: jgart <jgart <at> dismail.de>
Subject: [PATCH] gnu: Add python-pysox.
Date: Thu,  8 Jul 2021 15:35:55 -0400
* gnu/packages/audio.scm (python-pysox): New variable.
---
 gnu/packages/audio.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 3939d4bc7e..5222fb0343 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -2385,6 +2385,36 @@ compensation, (de)interleaving, and byte-swapping
     ;; original developer.
     (license license:expat)))
 
+(define-public python-pysox
+  (package
+    (name "python-pysox")
+    (version "1.4.1")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "sox" version))
+        (sha256
+          (base32
+            "0m8hszh51lfzacbb4nxc5bn446c0dzljfqgnsff8h2s5j8vd3wmh"))))
+    (build-system python-build-system)
+    (arguments
+     ;; Tests require python-soundfile.
+     ;; TODO: enable tests once http://issues.guix.gnu.org/47181 is completed.
+     `(#:tests? #f))
+    (propagated-inputs
+      `(("python-numpy" ,python-numpy)))
+    (native-inputs
+      `(("python-pytest" ,python-pytest)
+        ("python-pytest-cov" ,python-pytest-cov)))
+    (home-page "https://github.com/rabitt/pysox")
+    (synopsis "Python wrapper around sox")
+    (description "@code{pysox} is a wrapper around the @command{sox} command line tool.
+ pysox's API offers @code{Transformer} and @code{Combiner} classes that allow the user to
+incrementally build up effects and audio manipulations.  @code{pysox} also
+provides methods for querying audio information such as sample rate,
+determining whether an audio file is silent and much more.")
+    (license license:bsd-3)))
+
 (define-public python-pyaudio
   (package
     (name "python-pyaudio")
-- 
2.31.1





Information forwarded to guix-patches <at> gnu.org:
bug#49469; Package guix-patches. (Sat, 09 Oct 2021 15:21:01 GMT) Full text and rfc822 format available.

Message #11 received at 49469 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: jgart <jgart <at> dismail.de>
Cc: 49469 <at> debbugs.gnu.org
Subject: Re: bug#49469: [PATCH] gnu: Add python-pysox.
Date: Sat, 09 Oct 2021 20:50:27 +0530
[Message part 1 (text/plain, inline)]
Hi jgart,

> +     ;; Tests require python-soundfile.
> +     ;; TODO: enable tests once http://issues.guix.gnu.org/47181 is completed.
> +     `(#:tests? #f))

python-soundfile is now in Guix. Could you try getting the tests
working?

Thank you!
Arun
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#49469; Package guix-patches. (Sun, 10 Oct 2021 06:17:02 GMT) Full text and rfc822 format available.

Message #14 received at 49469 <at> debbugs.gnu.org (full text, mbox):

From: jgart <jgart <at> dismail.de>
To: 49469 <at> debbugs.gnu.org
Date: Sun, 10 Oct 2021 02:15:03 -0400
Here is an updated patch. I got the tests to pass. I also realized that I had 
to wrap some binaries.

all best,

jgart








Information forwarded to guix-patches <at> gnu.org:
bug#49469; Package guix-patches. (Sun, 10 Oct 2021 06:17:02 GMT) Full text and rfc822 format available.

Message #17 received at 49469 <at> debbugs.gnu.org (full text, mbox):

From: jgart <jgart <at> dismail.de>
To: 49469 <at> debbugs.gnu.org
Cc: jgart <jgart <at> dismail.de>
Subject: [PATCH] gnu: Add python-pysox.
Date: Sun, 10 Oct 2021 02:15:04 -0400
* gnu/packages/audio.scm (python-pysox): New variable.
---
 gnu/packages/audio.scm | 57 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index cc51ac51f3..8b412a63d1 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -2429,6 +2429,63 @@ compensation, (de)interleaving, and byte-swapping
     ;; original developer.
     (license license:expat)))
 
+(define-public python-pysox
+  (let ((commit "3d0053381c24ae3490f759d4de87194b85789d36")
+        (revision "0"))
+    (package
+      (name "python-pysox")
+      (version (git-version "1.4.2" revision commit))
+      (source
+        (origin
+          (method git-fetch)
+          (uri (git-reference
+                 (url "https://github.com/rabitt/pysox")
+                 (commit commit)))
+          (file-name (git-file-name name version))
+          (sha256
+            (base32
+              "0i62jx92vfpcr2z7lp69yzqdi9idfs3pifl3rzm2akc2c4cr1mac"))))
+      (build-system python-build-system)
+      (arguments
+        `(#:phases
+          (modify-phases %standard-phases
+            (add-after 'unpack 'patch-sox
+              (lambda* (#:key inputs #:allow-other-keys)
+                (let* ((sox-store-path (assoc-ref inputs "sox"))
+                       (sox-bin (string-append sox-store-path "/bin/sox")))
+                  (substitute* "sox/__init__.py"
+                    (("sox -h")
+                     (string-append sox-bin " -h")))
+                  (substitute* "sox/core.py"
+                    (("\\['sox")
+                     (string-append "['" sox-bin)))
+                  (substitute* "sox/log.py"
+                    (("Logger\\('sox")
+                     (string-append "Logger\('" sox-bin))))))
+            (replace 'check
+              (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+                (when tests?
+                  (add-installed-pythonpath inputs outputs)
+                  (setenv "PYTHONPATH" (string-append ".:" (getenv "PYTHONPATH")))
+                  (invoke "pytest")))))))
+      (propagated-inputs
+        `(("python-numpy" ,python-numpy)
+          ("python-typing-extensions" ,python-typing-extensions)))
+      (native-inputs
+        `(("sox" ,sox)
+          ("python-pytest" ,python-pytest)
+          ("python-pytest-cov" ,python-pytest-cov)
+          ("python-soundfile" ,python-soundfile)))
+      (home-page "https://github.com/rabitt/pysox")
+      (synopsis "Python wrapper around sox")
+      (description
+"@code{pysox} is a wrapper around the @command{sox} command line tool.
+ pysox's API offers @code{Transformer} and @code{Combiner} classes that allow the user to
+incrementally build up effects and audio manipulations.  @code{pysox} also
+provides methods for querying audio information such as sample rate,
+determining whether an audio file is silent and much more.")
+      (license license:bsd-3))))
+
 (define-public python-pyaudio
   (package
     (name "python-pyaudio")
-- 
2.33.0





Information forwarded to guix-patches <at> gnu.org:
bug#49469; Package guix-patches. (Sat, 16 Oct 2021 10:03:01 GMT) Full text and rfc822 format available.

Message #20 received at 49469 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: jgart <jgart <at> dismail.de>
Cc: 49469 <at> debbugs.gnu.org
Subject: Re: bug#49469: [PATCH] gnu: Add python-pysox.
Date: Sat, 16 Oct 2021 15:32:18 +0530
[Message part 1 (text/plain, inline)]
Hi jgart,

Thanks for the updated patch! Some feedback follows.

> +(define-public python-pysox
> +  (let ((commit "3d0053381c24ae3490f759d4de87194b85789d36")
> +        (revision "0"))
> +    (package
> +      (name "python-pysox")
> +      (version (git-version "1.4.2" revision commit))

According to PyPI, it seems that the latest version is 1.4.1.

And, I see that upstream is not tagging releases correctly in their git
repo. Could you raise this issue with upstream?

> +      (source
> +        (origin
> +          (method git-fetch)
> +          (uri (git-reference
> +                 (url "https://github.com/rabitt/pysox")

We should prefer the PyPI source tarball. If there is something missing
in the PyPI source tarball, and that's why you are using the GitHub
source, could you add a comment explaining the reason?

> +                  (substitute* "sox/log.py"
> +                    (("Logger\\('sox")
> +                     (string-append "Logger\('" sox-bin))))))

I think the above substitution is not required, because in this instance
'sox' is the name of the logger, rather than the full path to the sox
executable.

> +                  (setenv "PYTHONPATH" (string-append ".:" (getenv
> "PYTHONPATH")))

This setting of PYTHONPATH does not seem to be required. The tests
succeed without it.

> +      (description
> +"@code{pysox} is a wrapper around the @command{sox} command line tool.
> + pysox's API offers @code{Transformer} and @code{Combiner} classes that allow the user to
> +incrementally build up effects and audio manipulations.  @code{pysox} also
> +provides methods for querying audio information such as sample rate,
> +determining whether an audio file is silent and much more.")

I think @code{pysox} should be @code{python-pysox} since we are
referring to the python-pysox scheme variable.

Could you send an updated patch? Also, please do use `git format-patch
-v2', `git format-patch -v3', etc. when sending updated patches.

Thanks!
Arun
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#49469; Package guix-patches. (Sat, 16 Oct 2021 10:06:02 GMT) Full text and rfc822 format available.

Message #23 received at 49469 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: jgart <jgart <at> dismail.de>
Cc: 49469 <at> debbugs.gnu.org
Subject: Re: bug#49469: [PATCH] gnu: Add python-pysox.
Date: Sat, 16 Oct 2021 15:35:38 +0530
[Message part 1 (text/plain, inline)]
Also, in the next patch, please add a copyright header for yourself.

Thanks!
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#49469; Package guix-patches. (Wed, 24 Nov 2021 16:26:02 GMT) Full text and rfc822 format available.

Message #26 received at 49469 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: jgart <jgart <at> dismail.de>
Cc: 49469 <at> debbugs.gnu.org
Subject: Re: bug#49469: [PATCH] gnu: Add python-pysox.
Date: Wed, 24 Nov 2021 21:55:02 +0530
[Message part 1 (text/plain, inline)]
Hi jgart,

Just a gentle reminder. I was wondering if you missed my last mail on
this patch.

Thanks,
Arun
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#49469; Package guix-patches. (Thu, 25 Nov 2021 04:34:02 GMT) Full text and rfc822 format available.

Message #29 received at 49469 <at> debbugs.gnu.org (full text, mbox):

From: jgart <jgart <at> dismail.de>
To: Arun Isaac <arunisaac <at> systemreboot.net>
Cc: 49469 <at> debbugs.gnu.org
Subject: Re: bug#49469: [PATCH] gnu: Add python-pysox.
Date: Wed, 24 Nov 2021 23:33:28 -0500
On Wed, 24 Nov 2021 21:55:02 +0530 Arun Isaac <arunisaac <at> systemreboot.net> wrote:
> 
> Hi jgart,
> 
> Just a gentle reminder. I was wondering if you missed my last mail on
> this patch.
> 
> Thanks,
> Arun

Hi Arun,

Thank you for taking the time to review these patches.

Oddly enough, PyPi does not include the data folder that contains the audio files required for testing:

https://github.com/rabitt/pysox/tree/master/tests/data

Here is a snippet of the log showing test failures from not finding the data folder with the audio files:

/gnu/store/grnpyl2q67cyymcx7p27h5l64i23i4bn-python-pysox-1.4.1/lib/python3.8/site-packages/sox/file_info.py:248: OSError
________________ TestTransformerVol.test_limiter_gain_vol_up_db ________________

self = <test_transform.TestTransformerVol testMethod=test_limiter_gain_vol_up_db>

    def test_limiter_gain_vol_up_db(self):
        tfm = new_transformer()
        tfm.vol(2.0, gain_type='db', limiter_gain=0.05)

        actual_args = tfm.effects
        expected_args = ['vol', '2.000000', 'dB', '0.050000']
        self.assertEqual(expected_args, actual_args)

        actual_log = tfm.effects_log
        expected_log = ['vol']
        self.assertEqual(expected_log, actual_log)

>       actual_res = tfm.build(INPUT_FILE, OUTPUT_FILE)

tests/test_transform.py:5322:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/gnu/store/grnpyl2q67cyymcx7p27h5l64i23i4bn-python-pysox-1.4.1/lib/python3.8/site-packages/sox/transform.py:593: in build
    input_format, input_filepath = self._parse_inputs(
/gnu/store/grnpyl2q67cyymcx7p27h5l64i23i4bn-python-pysox-1.4.1/lib/python3.8/site-packages/sox/transform.py:493: in _parse_inputs
    file_info.validate_input_file(input_filepath)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

input_filepath = '/tmp/guix-build-python-pysox-1.4.1.drv-0/sox-1.4.1/tests/data/input.wav'

    def validate_input_file(input_filepath):
        '''Input file validation function. Checks that file exists and can be
        processed by SoX.

        Parameters
        ----------
        input_filepath : str
            The input filepath.

        '''
        if not os.path.exists(input_filepath):
>           raise IOError(
                "input_filepath {} does not exist.".format(input_filepath)
            )
E           OSError: input_filepath /tmp/guix-build-python-pysox-1.4.1.drv-0/sox-1.4.1/tests/data/input.wav does not exist.

/gnu/store/grnpyl2q67cyymcx7p27h5l64i23i4bn-python-pysox-1.4.1/lib/python3.8/site-packages/sox/file_info.py:248: OSError
================= 282 failed, 373 passed, 10 skipped in 51.02s =================


Next email will contain the new patch set with your suggestions. I've included a copyright statement also.

Thank you!

all best,

jgart




Information forwarded to guix-patches <at> gnu.org:
bug#49469; Package guix-patches. (Thu, 25 Nov 2021 04:44:02 GMT) Full text and rfc822 format available.

Message #32 received at 49469 <at> debbugs.gnu.org (full text, mbox):

From: jgart <jgart <at> dismail.de>
To: 49469 <at> debbugs.gnu.org
Cc: jgart <jgart <at> dismail.de>
Subject: [PATCH v3] gnu: Add python-pysox.
Date: Wed, 24 Nov 2021 23:42:45 -0500
* gnu/packages/audio.scm (python-pysox): New variable.
---
 gnu/packages/audio.scm | 56 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index 4b1a602804..694ea1a21b 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -34,6 +34,7 @@
 ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul <at> autistici.org>
 ;;; Copyright © 2020, 2021 Vinicius Monego <monego <at> posteo.net>
 ;;; Copyright © 2020 Michael Rohleder <mike <at> rohleder.de>
+;;; Copyright © 2021 jgart <jgart <at> dismail.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -5532,6 +5533,61 @@ (define-public siggen
 device.  There is support for mono and/or stereo and 8 or 16 bit samples.")
     (license license:gpl2)))
 
+(define-public python-pysox
+  ;; PyPi does not include the data folder containing audio files for testing.
+  (let ((commit "3d0053381c24ae3490f759d4de87194b85789d36")
+        (revision "0"))
+    (package
+      (name "python-pysox")
+      (version (git-version "1.4.2" revision commit))
+      (source
+        (origin
+          (method git-fetch)
+          (uri (git-reference
+                 (url "https://github.com/rabitt/pysox")
+                 (commit commit)))
+          (file-name (git-file-name name version))
+          (sha256
+            (base32
+              "0i62jx92vfpcr2z7lp69yzqdi9idfs3pifl3rzm2akc2c4cr1mac"))))
+      (build-system python-build-system)
+      (arguments
+        `(#:phases
+          (modify-phases %standard-phases
+            (add-after 'unpack 'patch-sox
+              (lambda* (#:key inputs #:allow-other-keys)
+                (let* ((sox-store-path (assoc-ref inputs "sox"))
+                       (sox-bin (string-append sox-store-path "/bin/sox")))
+                  (substitute* "sox/__init__.py"
+                    (("sox -h")
+                     (string-append sox-bin " -h")))
+                  (substitute* "sox/core.py"
+                    (("\\['sox")
+                     (string-append "['" sox-bin))))))
+            (replace 'check
+              (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+                (when tests?
+                  (add-installed-pythonpath inputs outputs)
+                  (invoke "pytest")))))))
+      (propagated-inputs
+        `(("python-numpy" ,python-numpy)
+          ("python-typing-extensions" ,python-typing-extensions)))
+      (native-inputs
+        `(("sox" ,sox)
+          ("python-pytest" ,python-pytest)
+          ("python-pytest-cov" ,python-pytest-cov)
+          ("python-soundfile" ,python-soundfile)))
+      (home-page "https://github.com/rabitt/pysox")
+      (synopsis "Python wrapper around SoX")
+      (description
+"@code{python-pysox} is a wrapper around the @command{sox} command
+line tool.  The API offers @code{Transformer} and @code{Combiner}
+classes that allow the user to incrementally build up effects and audio
+manipulations.  @code{python-pysox} also provides methods for querying
+audio information such as sample rate, determining whether an audio file
+is silent, and much more.")
+      (license license:bsd-3))))
+
 (define-public mda-lv2
   (package
     (name "mda-lv2")
-- 
2.34.0





Information forwarded to guix-patches <at> gnu.org:
bug#49469; Package guix-patches. (Thu, 25 Nov 2021 04:47:01 GMT) Full text and rfc822 format available.

Message #35 received at 49469 <at> debbugs.gnu.org (full text, mbox):

From: jgart <jgart <at> dismail.de>
To: Arun Isaac <arunisaac <at> systemreboot.net>
Cc: 49469 <at> debbugs.gnu.org
Subject: Re: bug#49469: [PATCH] gnu: Add python-pysox.
Date: Wed, 24 Nov 2021 23:46:34 -0500
On Wed, 24 Nov 2021 23:33:28 -0500 jgart <jgart <at> dismail.de> wrote:

I sent the latest patch set (v3) but forgot to Cc you ;)

all best,

jgart




Reply sent to Arun Isaac <arunisaac <at> systemreboot.net>:
You have taken responsibility. (Mon, 29 Nov 2021 16:14:01 GMT) Full text and rfc822 format available.

Notification sent to "jgart" <jgart <at> dismail.de>:
bug acknowledged by developer. (Mon, 29 Nov 2021 16:14:01 GMT) Full text and rfc822 format available.

Message #40 received at 49469-done <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: jgart <jgart <at> dismail.de>
Cc: 49469-done <at> debbugs.gnu.org
Subject: Re: bug#49469: [PATCH] gnu: Add python-pysox.
Date: Mon, 29 Nov 2021 21:42:56 +0530
[Message part 1 (text/plain, inline)]
Hi jgart,

Thank you for your revised patch! I have pushed it to master.

> Oddly enough, PyPi does not include the data folder that contains the
> audio files required for testing:

Personally, I believe this is bad practice, but sadly it is quite
common.

Regards,
Arun
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 28 Dec 2021 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 116 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.