Skip to content

Remove pydub dependency#529

Merged
abidlabs merged 3 commits into
mainfrom
remove-pydub
Apr 22, 2026
Merged

Remove pydub dependency#529
abidlabs merged 3 commits into
mainfrom
remove-pydub

Conversation

@abidlabs
Copy link
Copy Markdown
Member

@abidlabs abidlabs commented Apr 21, 2026

Summary

  • pydub is unmaintained and incompatible with Python 3.14 (depends on the stdlib audioop module removed in 3.13+). Closes Pydub dependency is causing problems even when audio isn't wanted #528.
  • Replace pydub with stdlib wave for WAV output and a direct ffmpeg subprocess for MP3 — pydub was only shelling out to ffmpeg for MP3 anyway, so this cuts out the middleman.
  • Swap pydub-based verification in tests/unit/test_audio_writer.py for ffprobe.
  • Drop pydub<1.0.0 from pyproject.toml and the pydub SyntaxWarning filter in the crash-and-resume example.
  • Tweak the check_ffmpeg_installed() error message (previously said "required to write video" — it covers audio too).

Behavior is unchanged for users without ffmpeg: WAV still works (stdlib only), MP3 still raises the same RuntimeError via the existing check_ffmpeg_installed() gate.

Replace pydub with stdlib `wave` for WAV output and a direct ffmpeg
subprocess for MP3. pydub is unmaintained and incompatible with
Python 3.14 (depends on the removed stdlib `audioop` module).

Closes #528

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@gradio-pr-bot
Copy link
Copy Markdown
Contributor

gradio-pr-bot commented Apr 21, 2026

🪼 branch checks and previews

Name Status URL
🦄 Changes detected! Details

@gradio-pr-bot
Copy link
Copy Markdown
Contributor

gradio-pr-bot commented Apr 21, 2026

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
trackio patch

  • Remove pydub dependency

‼️ Changeset not approved. Ensure the version bump is appropriate for all packages before approving.

  • Maintainers can approve the changeset by checking this checkbox.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

@abidlabs abidlabs marked this pull request as ready for review April 21, 2026 22:48
@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

HuggingFaceDocBuilderDev commented Apr 21, 2026

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview

Install Trackio from this PR (includes built frontend)

pip install "https://huggingface.co/buckets/trackio/trackio-wheels/resolve/a715d04222a3c7af60c85887c62aade454680b73/trackio-0.24.1-py3-none-any.whl"

@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the unmaintained pydub dependency from Trackio’s media pipeline (addressing Python 3.13+ audioop removal) by switching WAV writing to the stdlib wave module and MP3 encoding to a direct ffmpeg subprocess, and updates tests accordingly.

Changes:

  • Replace pydub-based audio export with stdlib wave (WAV) and direct ffmpeg invocation (MP3).
  • Update MP3 verification tests to use ffprobe instead of pydub.
  • Remove pydub from pyproject.toml and delete the pydub-related warning filter from an example script.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
trackio/media/utils.py Adjusts the ffmpeg missing error message to be media-format-generic.
trackio/media/audio.py Removes pydub; implements WAV writing via wave and MP3 writing via ffmpeg piping PCM.
tests/unit/test_audio_writer.py Replaces pydub MP3 inspection with ffprobe JSON probing.
pyproject.toml Drops pydub from runtime dependencies.
examples/crash-and-resume-same-run-name.py Removes pydub-specific SyntaxWarning filter.
.changeset/solid-sides-look.md Adds a minor-version changeset for the dependency removal.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"trackio": patch
---

feat:Remove pydub dependency
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor formatting: add a space after feat: so the changeset summary reads cleanly (e.g., feat: Remove pydub dependency).

Suggested change
feat:Remove pydub dependency
feat: Remove pydub dependency

Copilot uses AI. Check for mistakes.
Comment thread trackio/media/audio.py
"-ac",
str(channels),
"-i",
"pipe:0",
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ffmpeg invocation relies on the output filename’s extension to select the output container/codec. That changes behavior vs the previous pydub.export(..., format=format) path: if format="mp3" but the filename has an unknown/mismatched extension, ffmpeg will error or encode to the extension’s format. Consider explicitly specifying the output format/codec (e.g., -f mp3 and/or -codec:a libmp3lame) so the format argument always controls the encoding regardless of filename.

Suggested change
"pipe:0",
"pipe:0",
"-f",
format,
"-codec:a",
"libmp3lame",

Copilot uses AI. Check for mistakes.
@abidlabs
Copy link
Copy Markdown
Member Author

Going to merge this in for a patch release

@abidlabs abidlabs merged commit a77972b into main Apr 22, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pydub dependency is causing problems even when audio isn't wanted

4 participants