jiaaro / pydub

Manipulate audio with a simple and easy high level interface
http://pydub.com
MIT License
8.98k stars 1.05k forks source link

Release required to remove warnings when using python 3.12 #814

Open ngharrington opened 1 month ago

ngharrington commented 1 month ago

We need a new release of the master branch.

Steps to reproduce

  1. Create a new python 3.12 environment.
  2. Install pydub from pypi
  3. import AudioSegment
  4. Observe Warnings
$ uv venv --python 3.12 --no-project --seed venv312
$ uv pip install pydub --no-cache

$ python -B -c "import pydub"
/home/neal/workspace/aider-sandbox/venv312/lib/python3.12/site-packages/pydub/utils.py:300: SyntaxWarning: invalid escape sequence '\('
  m = re.match('([su]([0-9]{1,2})p?) \(([0-9]{1,2}) bit\)$', token)
/home/neal/workspace/aider-sandbox/venv312/lib/python3.12/site-packages/pydub/utils.py:301: SyntaxWarning: invalid escape sequence '\('
  m2 = re.match('([su]([0-9]{1,2})p?)( \(default\))?$', token)
/home/neal/workspace/aider-sandbox/venv312/lib/python3.12/site-packages/pydub/utils.py:310: SyntaxWarning: invalid escape sequence '\('
  elif re.match('(flt)p?( \(default\))?$', token):
/home/neal/workspace/aider-sandbox/venv312/lib/python3.12/site-packages/pydub/utils.py:314: SyntaxWarning: invalid escape sequence '\('
  elif re.match('(dbl)p?( \(default\))?$', token):

Run python -B with the -B switch to prevent caching from supressing warnings on subsequent executions of the same command.

Expected behavior

There should be no warnings

Actual behavior

There are warnings as described above. HOWEVER, if I then install pydub from master directly, things work.

$ uv pip install --upgrade --no-cache git+https://github.com/jiaaro/pydub.git
 Updated https://github.com/jiaaro/pydub.git (996cec4)
Resolved 1 package in 2.41s
   Built pydub @ git+https://github.com/jiaaro/pydub.git@996cec42e9621701edb83354232b2c0ca0121560
Prepared 1 package in 650ms
Uninstalled 1 package in 0.51ms
Installed 1 package in 0.64ms
 - pydub==0.25.1 (from git+https://github.com/ngharrington/pydub.git@996cec42e9621701edb83354232b2c0ca0121560)
 + pydub==0.25.1 (from git+https://github.com/jiaaro/pydub.git@996cec42e9621701edb83354232b2c0ca0121560)
(venv312) neal@neal-xps:aider-sandbox$ python -B -c "import pydub"
(venv312) neal@neal-xps:aider-sandbox$ echo $?
0

Your System configuration

Is there an audio file you can include to help us reproduce?

N/A

lawrenceong commented 2 weeks ago

@jiaaro Any chance you can make a new release? Thanks in advance!

joanise commented 1 week ago

@jiaaro A number of improvements have been made to pydub since the last release, it would be really helpful to make a new release, to get the benefit of all of them.