Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Python 3.13 #145

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

lucas42
Copy link

@lucas42 lucas42 commented Oct 30, 2024

Python core removed modules aifc and sunau in 3.13 as part of PEP-594 https://peps.python.org/pep-0594/
This change adds standard-aifc and standard-sunau as dependencies for python 3.13 and above. These are forks of the modules that had previously been in the python core.

Also updates the test config to run against python 3.12 and python 3.13

Fixes #144

…and above.

Python core removed these modules in 3.13 as part of PEP-594 https://peps.python.org/pep-0594/
The standard-* modules are forks of the modules that had previously been in the python core.
Fixes beetbox#144
@Kangie
Copy link

Kangie commented Dec 6, 2024

Tests also require stardard-chunk and standard-audioop, the latter of which is not currently available from pypi.

@lucas42
Copy link
Author

lucas42 commented Dec 6, 2024

@Kangie where is chunk being used? Can't see any references to it in the repo.

Yes, looks like audioop might be a problem. I can see one place it gets used:

data = audioop.lin2lin(data, old_width, TARGET_WIDTH)

Perhaps it's worth using https://github.com/AbstractUmbra/audioop for that instead. (standard-audioop never got created because it's not a pure python library, see youknowone/python-deadlib#6 for details)

@Kangie
Copy link

Kangie commented Dec 6, 2024

It came up when trying to update the gentoo package, possibly an indirect dependency via either sunau or aifc that's come up trying to invoke them in the test suite?

Sorry in the middle of a huge system update, but I did stash the ebuild I was using where I added it as a dependency:

https://github.com/Kangie/gentoo/blob/283c7d14199454342c7be9e4ab00650f15cb5583/dev-python/audioread/audioread-3.0.1.ebuild

@Kangie
Copy link

Kangie commented Dec 6, 2024

Perhaps it's worth using https://github.com/AbstractUmbra/audioop for that instead.

Honestly if we're up to 3 or 4 "dead batteries" I wonder if it's better to find proper replacements for all of them. These were dropped for a reason after all and this is just a band-aid fix.

@lucas42
Copy link
Author

lucas42 commented Dec 9, 2024

Honestly if we're up to 3 or 4 "dead batteries" I wonder if it's better to find proper replacements for all of them. These were dropped for a reason after all and this is just a band-aid fix.

That does sound reasonable. However, personally I don't know enough about low-level audio file modification to be able to contribute much to that endeavour.

@lucas42
Copy link
Author

lucas42 commented Dec 9, 2024

Tests also require stardard-chunk and standard-audioop, the latter of which is not currently available from pypi.

I've dug into this a bit further. Both standard-aifc and standard-sunau include audioop-lts as a dependency. (Sorry, I should've realised that was the case - looking at the commit history, I was the one who added it 🤦 ).

Running the tests in github actions appears to work for me: https://github.com/lucas42/audioread/actions/runs/11599693327/job/32298399085 (there's some warnings thrown, but no errors).

@Kangie are you running tests and/or pulling in dependencies differently to how it's configured in the github workflow in this repo?

@kamocat
Copy link

kamocat commented Dec 30, 2024

I don't see any reason to re-implement these codecs, especially since the code has MIT-compatible licenses.
Could the code be included wholesale in the audioread repo?

@kamocat
Copy link

kamocat commented Dec 30, 2024

@lucas42
Copy link
Author

lucas42 commented Dec 30, 2024

@kamocat do you know anyone who'd be willing to convert audioop to pure python? I don't have enough knowledge of audio encoding to do it myself.

Regarding the files you link to for sunau and aifc, that's where the standard-aifc and standard-sunau packages got their source from. I don't have a strong opinion about whether they get included through pip or included in this repo. I guess it comes down to which will get the best ongoing support (at the moment, neither option seems like it'll see much love).
I picked the option with the simplest changeset in the hope it wouldn't be too controversial.

@kamocat
Copy link

kamocat commented Dec 30, 2024

You're right. Using the standard-* options should be fine, as long as it sticks around.
It seems the reason they were dropped in PEP- 954 is that they were considered to be "old, obsolete file formats". Nothing about them was broken or expected to break. These file formats aren't going to change.

@kamocat
Copy link

kamocat commented Dec 30, 2024

Another option is to use FFmpeg to read the AIFF and SUN AU formats.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aifc module is deprecated (and removed in Python 3.13)
3 participants