fix(video): keep PyAV below 19 so faster-whisper can open audio
faster-whisper 1.2.1 decodes with av.open(..., metadata_errors="ignore").
PyAV 19.0.0 removed that argument, and the video extra resolved av 19 on
Python 3.12+, so transcription raised TypeError before any audio was read.
PyAV 16.1.0 through 18.1.0 still accept the keyword. The compatible range
is av>=11,<19, on the same interpreter marker as faster-whisper. [all]
carries the same constraint. Relocking also records the package version
as 0.9.97, matching pyproject.toml.
Co-Authored-By: Grok <noreply@x.ai>
Co-authored-by: Syed Fahad <sfahad2904@gmail.com>
(cherry picked from commit 01757166f9)
This commit is contained in:
1 parent
16f18aff33
commit
6a056e3a8c
4 files changed
+60
-46
No files matched your search
+15
-2
@@ -87,7 +87,20 @@ google = ["openpyxl"]
|
||||
# tree-sitter-sql grammar; without it introspection silently returns 0 nodes,
|
||||
# so the postgres extra must carry the grammar too.
|
||||
postgres = ["psycopg[binary]", "tree-sitter-sql"]
|
||||
video = ["faster-whisper; python_version >= '3.11'", "yt-dlp>=2026.7.4"]
|
||||
# faster-whisper 1.2.1 (current PyPI release) decodes audio with
|
||||
# `av.open(..., metadata_errors="ignore")`. PyAV 19.0.0 removed that
|
||||
# argument; 16.1.0 through 18.1.0 still accept it. faster-whisper only
|
||||
# requires `av>=11`, so a fresh `[video]` install on Python 3.12+ resolves
|
||||
# av 19 and transcription raises
|
||||
# `TypeError: open() got an unexpected keyword argument 'metadata_errors'`.
|
||||
# Cap PyAV below 19 on the same interpreter marker as faster-whisper
|
||||
# (Python 3.10 never installs it). The unreleased faster-whisper master
|
||||
# already omits the argument on PyAV 19; drop this cap once that ships.
|
||||
video = [
|
||||
"faster-whisper; python_version >= '3.11'",
|
||||
"av>=11,<19; python_version >= '3.11'",
|
||||
"yt-dlp>=2026.7.4",
|
||||
]
|
||||
kimi = ["openai", "tiktoken"]
|
||||
ollama = ["openai"]
|
||||
bedrock = ["boto3"]
|
||||
@@ -129,7 +142,7 @@ vbnet = ["tree-sitter-vb-dotnet==0.3.0"]
|
||||
r = ["tree-sitter-language-pack==0.11.0"]
|
||||
erlang = ["tree-sitter-language-pack==0.11.0"]
|
||||
solidity = ["tree-sitter-solidity==1.2.13"]
|
||||
all = ["mcp>=1,<3", "starlette>=1.3.1,<2", "anyio>=4.14.2", "neo4j", "falkordb", "pypdf>=6.19.0", "markdownify", "watchdog", "graspologic; python_version < '3.13'", "graspologic-native>=1.3.1,<2; python_version >= '3.13'", "python-docx", "openpyxl", "psycopg[binary]", "faster-whisper; python_version >= '3.11'", "yt-dlp>=2026.7.4", "matplotlib", "pillow>=13.0.0; python_version >= '3.11'", "pillow>=12.3.0; python_version < '3.11'", "numpy>=2.0; python_version >= '3.13'", "openai", "tiktoken", "boto3", "anthropic", "tree-sitter-sql", "jieba; python_version < '3.12'", "jieba-py>=0.46.12,<1; python_version >= '3.12'", "tree-sitter-dm>=0.25,<0.26", "tree-sitter-hcl", "tree-sitter-pascal", "tree-sitter-ocaml", "tree-sitter-commonlisp", "robotframework>=4.0", "tree-sitter-vb-dotnet==0.3.0", "tree-sitter-language-pack==0.11.0", "tree-sitter-solidity==1.2.13"]
|
||||
all = ["mcp>=1,<3", "starlette>=1.3.1,<2", "anyio>=4.14.2", "neo4j", "falkordb", "pypdf>=6.19.0", "markdownify", "watchdog", "graspologic; python_version < '3.13'", "graspologic-native>=1.3.1,<2; python_version >= '3.13'", "python-docx", "openpyxl", "psycopg[binary]", "faster-whisper; python_version >= '3.11'", "av>=11,<19; python_version >= '3.11'", "yt-dlp>=2026.7.4", "matplotlib", "pillow>=13.0.0; python_version >= '3.11'", "pillow>=12.3.0; python_version < '3.11'", "numpy>=2.0; python_version >= '3.13'", "openai", "tiktoken", "boto3", "anthropic", "tree-sitter-sql", "jieba; python_version < '3.12'", "jieba-py>=0.46.12,<1; python_version >= '3.12'", "tree-sitter-dm>=0.25,<0.26", "tree-sitter-hcl", "tree-sitter-pascal", "tree-sitter-ocaml", "tree-sitter-commonlisp", "robotframework>=4.0", "tree-sitter-vb-dotnet==0.3.0", "tree-sitter-language-pack==0.11.0", "tree-sitter-solidity==1.2.13"]
|
||||
|
||||
[project.scripts]
|
||||
graphify = "graphify.__main__:main"
|
||||
|
||||
@@ -49,6 +49,21 @@ def test_version_gated_optional_backends_are_packaged():
|
||||
assert "jieba-py>=0.46.12,<1; python_version >= '3.12'" in extras[extra]
|
||||
|
||||
|
||||
def test_video_extra_caps_pyav_below_19():
|
||||
"""faster-whisper 1.2.1 calls ``av.open(..., metadata_errors="ignore")``.
|
||||
|
||||
PyAV 19.0.0 removed that keyword (16.1.0 through 18.1.0 still accept it).
|
||||
faster-whisper only requires ``av>=11``, so the resolver picks av 19 on
|
||||
Python 3.12+ and transcription raises ``TypeError: unexpected keyword
|
||||
argument 'metadata_errors'``. Both extras that install faster-whisper must
|
||||
cap PyAV below 19, on the same interpreter marker.
|
||||
"""
|
||||
extras = _extras()
|
||||
pin = "av>=11,<19; python_version >= '3.11'"
|
||||
for extra in ("video", "all"):
|
||||
assert pin in extras[extra], f"[{extra}] must cap PyAV below 19"
|
||||
|
||||
|
||||
def test_backend_pkg_hint_points_at_uv_tool_and_extra():
|
||||
msg = _backend_pkg_hint("anthropic", "anthropic")
|
||||
assert "uv tool install" in msg
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""Tests for graphify.transcribe — video/audio transcription support."""
|
||||
from __future__ import annotations
|
||||
|
||||
import io
|
||||
import os
|
||||
from pathlib import Path
|
||||
from unittest.mock import MagicMock, patch
|
||||
@@ -100,6 +101,29 @@ def test_transcribe_force_reruns(tmp_path):
|
||||
assert result.read_text() == "New transcript segment."
|
||||
|
||||
|
||||
def test_installed_pyav_accepts_metadata_errors():
|
||||
"""The PyAV that ``[video]`` installs must still take ``metadata_errors``.
|
||||
|
||||
faster-whisper 1.2.1's ``decode_audio`` always passes that keyword. PyAV
|
||||
19 raises ``TypeError`` before it looks at the bytes; garbage input must
|
||||
fail inside the demuxer instead. ``av.open`` is a Cython builtin, so this
|
||||
calls it rather than reading ``inspect.signature``. Skipped where the
|
||||
extra is not installed (Python 3.10).
|
||||
"""
|
||||
av = pytest.importorskip("av")
|
||||
major = int(av.__version__.split(".", 1)[0])
|
||||
assert major < 19, av.__version__
|
||||
try:
|
||||
av.open(io.BytesIO(b"not a media file"), mode="r", metadata_errors="ignore")
|
||||
except TypeError as exc:
|
||||
raise AssertionError(
|
||||
"av.open rejected metadata_errors; faster-whisper 1.2.1 always passes it"
|
||||
) from exc
|
||||
except Exception:
|
||||
return
|
||||
raise AssertionError("garbage input unexpectedly decoded")
|
||||
|
||||
|
||||
def test_transcribe_missing_faster_whisper(tmp_path):
|
||||
"""ImportError propagates when faster_whisper is not installed."""
|
||||
video = tmp_path / "clip.mp4"
|
||||
|
||||
@@ -102,14 +102,6 @@ wheels = [
|
||||
name = "av"
|
||||
version = "18.1.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
resolution-markers = [
|
||||
"python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'win32'",
|
||||
"python_full_version >= '3.11' and python_full_version < '3.11.5' and sys_platform == 'win32'",
|
||||
"python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'emscripten'",
|
||||
"python_full_version >= '3.11' and python_full_version < '3.11.5' and sys_platform == 'emscripten'",
|
||||
"python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform != 'emscripten' and sys_platform != 'win32'",
|
||||
"python_full_version >= '3.11' and python_full_version < '3.11.5' and sys_platform != 'emscripten' and sys_platform != 'win32'",
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/8d/f4/f22114d30d3435e38c6af2b4870f37b864403dca6ae7af747a289ce0a18e/av-18.1.0.tar.gz", hash = "sha256:47bfc286e1bc9de7ab4681fc2b575cd2460a66919d31ffe1bd5aa54fae531a28", size = 4451061, upload-time = "2026-08-12T22:28:18.761Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/05/d4/d7cdc8bff143c17a6d35924375ae28dd692cacde38700a7d419fde54f44a/av-18.1.0-cp311-abi3-macosx_11_0_x86_64.whl", hash = "sha256:ae75d8bb6467895ed1f8572ededf7ffa49eac07f6e483222f5d7d62a41d12f04", size = 22546147, upload-time = "2026-08-12T22:27:11.851Z" },
|
||||
@@ -132,39 +124,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/c1/d2/0c277a46f12647c1833f40496e132fb6001e0d19e6144b5ea30896461feb/av-18.1.0-cp314-cp314t-win_arm64.whl", hash = "sha256:5cd9085028902c9880622bd37a12fd4b33060f06a52311f6f4867ca9f29a2c3b", size = 21421979, upload-time = "2026-08-12T22:28:16.48Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "av"
|
||||
version = "19.0.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
resolution-markers = [
|
||||
"python_full_version >= '3.14'",
|
||||
"python_full_version == '3.13.*'",
|
||||
"python_full_version == '3.12.*' and sys_platform == 'win32'",
|
||||
"python_full_version == '3.12.*' and sys_platform == 'emscripten'",
|
||||
"python_full_version == '3.12.*' and sys_platform != 'emscripten' and sys_platform != 'win32'",
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/23/01/76b6bf563fe907597cf58f10d10168e93fe588b6db9f2658db87e87efa7e/av-19.0.2.tar.gz", hash = "sha256:bebbc52598886480f4d861c575dc2b020785d6c04e1308680ddcc545e1b94c66", size = 4277157, upload-time = "2026-10-21T03:45:30.799Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/4a/2f/f51f37820741134516e841053d5ecebf6350fbd451adcbff9ead96aa1244/av-19.0.2-cp312-abi3-macosx_11_0_x86_64.whl", hash = "sha256:f5f7bcf987567cd3f9b01f1c375c59bf59d8a5b98c9c5c154aeda7a11e0c5dce", size = 22627374, upload-time = "2026-10-21T03:44:28.296Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7c/42/067d0bcd2c07103f18cc23b510a8289dd80330e984c49d51ce0bafcee017/av-19.0.2-cp312-abi3-macosx_14_0_arm64.whl", hash = "sha256:b0dff6dfcc6ff9944fbbff15bc4ee2d90a2c1695d493bdea96e86f48823e9feb", size = 18556422, upload-time = "2026-10-21T03:44:31.267Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/de/0c/448f89f76cf5e4da35dd6294a1e8155b75daa8839f2f2fa353775855d152/av-19.0.2-cp312-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:04c8e412642c652cb2b1997a9cb2114546ee7d894600c631f4be8ceb26a0d0d2", size = 32683287, upload-time = "2026-10-21T03:44:34.588Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/e1/7f/9f1237feb894afa472ef834aa1fbfe4d6398f28dc7e86a1b418650204c36/av-19.0.2-cp312-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:9c1da7aad0fa6c13b4a5c1e7985be0d13f8526a96284573acaf3d55ead6d3fe8", size = 34990159, upload-time = "2026-10-21T03:44:37.637Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/f1/b5/1bde0e54e525d88ad8f5becae657f8142543fd3be9d10b72141f041ca868/av-19.0.2-cp312-abi3-manylinux_2_31_armv7l.whl", hash = "sha256:9d4f9f78c0ce1f20deb72626fdb3c723757f61a8cd6fbb7dd44d9401884a91fd", size = 44422922, upload-time = "2026-10-21T03:44:41.847Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/08/21/65997929fa4dd7c20f64e742aa87205a8d65485718a2ab51633756078e83/av-19.0.2-cp312-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:dfe7af5aa8243afd5d4778f85ad1a7c948e37fad272869da1f8f93f8d57fa7ad", size = 33754699, upload-time = "2026-10-21T03:44:45.772Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/30/44/4de8c0ff5a5e25ceb0841efc0a4a7530a22d61800bc0cc19a1d03aa04358/av-19.0.2-cp312-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:44d3faae747cf04a33f39db8ae983ff3d93adc864ee663bc186b25b686803c3e", size = 36014845, upload-time = "2026-10-21T03:44:49.64Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/32/5a/743a83666ded197df8b9957e2800bef9a39d52b23be2ca211bbd14b5fb22/av-19.0.2-cp312-abi3-win_amd64.whl", hash = "sha256:3ce5a1d7b916d13c16ac58f1756f0fee4af2d53f02bc1403e18550b50d375a22", size = 28150949, upload-time = "2026-10-21T03:44:53.434Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/42/fe/e79d786628d9c0428f72214dbe4b90ee0c625e04d552a604d5235ff35515/av-19.0.2-cp312-abi3-win_arm64.whl", hash = "sha256:79a277b077e3768a0ea9f881ca0b3bc96d4135a8d3a7a579938adb58718d0dfd", size = 20708023, upload-time = "2026-10-21T03:44:56.435Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/08/f5/e7988f64d3debf50748f1c4372a3dac70cfe53720563056cb57bd77771a6/av-19.0.2-cp314-cp314t-macosx_11_0_x86_64.whl", hash = "sha256:b632e026f4375037438a6b2b5d6a489e55bc9504fad22078991ef96211bec2a9", size = 22911715, upload-time = "2026-10-21T03:44:59.378Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/76/86/dbe91321e6b233970c7fdfdb82cb1750a745e5779ab9ee69a6ce2589b1cb/av-19.0.2-cp314-cp314t-macosx_14_0_arm64.whl", hash = "sha256:32a8d37bde9e24ad0cc855140cbeecde17a363d7dc7928dcfc71a34b5f3ed387", size = 18864540, upload-time = "2026-10-21T03:45:02.227Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5a/c7/afca86772d825f5eb5fd8d1a193b206ed9a4a0d74ffbe5bbe0a19521ed7d/av-19.0.2-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:1e7cb7b66a832bce8996af5b94f1cf4014a05ff51e0005feac4cb2566d711020", size = 36479296, upload-time = "2026-10-21T03:45:05.955Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b3/71/6c6fc7e80dd5aa71109cb9324638620c40b7de8f677a6446d2f744295587/av-19.0.2-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:b559ff381bd800c46fee6a17d7e22a3443708cdd58d0901ae91d27cf5dd0578c", size = 38467551, upload-time = "2026-10-21T03:45:09.493Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3f/93/fa67f5d4180e57e7f740053fd855a6d312f4848f1e5582b8d3ab131184dd/av-19.0.2-cp314-cp314t-manylinux_2_31_armv7l.whl", hash = "sha256:91924f5c836b1cbf89fe1522c642f98e89a733124908561fd49dc7a70e9b6d10", size = 46223361, upload-time = "2026-10-21T03:45:13.396Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/25/f9/f98627770ccb4761e8cb87edd8b4bcf91549288bca95130c1a91ea7cdcb8/av-19.0.2-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:ae4618eab172f8135596972252f39c7399291c921e661c1771ba26b9254b800f", size = 37349208, upload-time = "2026-10-21T03:45:17.213Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/7e/3a/183b4f96a604a8544180e256d16f9a6c0534d6b7db22dc22fb0842aa96fc/av-19.0.2-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:8596fad2017d380708de35ddf9d34f808b8488c912cdc3f361691d866d9dc32d", size = 39475989, upload-time = "2026-10-21T03:45:20.658Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/22/6e/84b65c58171a6d75a5d129a9cf856ca730843f8c476f08033e7f9d4a1af6/av-19.0.2-cp314-cp314t-win_amd64.whl", hash = "sha256:9db27c2248112a8eed3edd3ca83cf4405f52a402cda2eb1956035e646e6b99c6", size = 29064804, upload-time = "2026-10-21T03:45:24.24Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/60/4e/d96cc9fff457069c52754f63151a0340cb4886330d58e09061f203696b60/av-19.0.2-cp314-cp314t-win_arm64.whl", hash = "sha256:0e425d631510ca21e47c58f3837a9dceae0453c24e926408c8a12b95239cbbd6", size = 21916888, upload-time = "2026-10-21T03:45:27.298Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bandit"
|
||||
version = "1.9.4"
|
||||
@@ -1320,8 +1279,7 @@ name = "faster-whisper"
|
||||
version = "1.2.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "av", version = "18.1.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.11.*'" },
|
||||
{ name = "av", version = "19.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" },
|
||||
{ name = "av", marker = "python_full_version >= '3.11'" },
|
||||
{ name = "ctranslate2", marker = "python_full_version >= '3.11'" },
|
||||
{ name = "huggingface-hub", marker = "python_full_version >= '3.11'" },
|
||||
{ name = "onnxruntime", marker = "python_full_version >= '3.11'" },
|
||||
@@ -1582,7 +1540,7 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "graphifyy"
|
||||
version = "0.9.96"
|
||||
version = "0.9.97"
|
||||
source = { editable = "." }
|
||||
dependencies = [
|
||||
{ name = "networkx", version = "3.4.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
|
||||
@@ -1626,6 +1584,7 @@ dependencies = [
|
||||
all = [
|
||||
{ name = "anthropic" },
|
||||
{ name = "anyio" },
|
||||
{ name = "av", marker = "python_full_version >= '3.11'" },
|
||||
{ name = "boto3" },
|
||||
{ name = "falkordb" },
|
||||
{ name = "faster-whisper", marker = "python_full_version >= '3.11'" },
|
||||
@@ -1759,6 +1718,7 @@ vbnet = [
|
||||
{ name = "tree-sitter-vb-dotnet" },
|
||||
]
|
||||
video = [
|
||||
{ name = "av", marker = "python_full_version >= '3.11'" },
|
||||
{ name = "faster-whisper", marker = "python_full_version >= '3.11'" },
|
||||
{ name = "yt-dlp" },
|
||||
]
|
||||
@@ -1795,6 +1755,8 @@ requires-dist = [
|
||||
{ name = "anthropic", marker = "extra == 'anthropic'" },
|
||||
{ name = "anyio", marker = "extra == 'all'", specifier = ">=4.14.2" },
|
||||
{ name = "anyio", marker = "extra == 'mcp'", specifier = ">=4.14.2" },
|
||||
{ name = "av", marker = "python_full_version >= '3.11' and extra == 'all'", specifier = ">=11,<19" },
|
||||
{ name = "av", marker = "python_full_version >= '3.11' and extra == 'video'", specifier = ">=11,<19" },
|
||||
{ name = "boto3", marker = "extra == 'all'" },
|
||||
{ name = "boto3", marker = "extra == 'bedrock'" },
|
||||
{ name = "falkordb", marker = "extra == 'all'" },
|
||||
|
||||
Reference in new issue
Block a user