Skip to content

fix(deps): declare youtube-transcript-api in pyproject.toml [youtube] extra#22745

Closed
wesleysimplicio wants to merge 1 commit into
NousResearch:mainfrom
wesleysimplicio:fix/ag06-issue-22243-youtube-transcript-api-missing-dep
Closed

fix(deps): declare youtube-transcript-api in pyproject.toml [youtube] extra#22745
wesleysimplicio wants to merge 1 commit into
NousResearch:mainfrom
wesleysimplicio:fix/ag06-issue-22243-youtube-transcript-api-missing-dep

Conversation

@wesleysimplicio

Copy link
Copy Markdown
Contributor

Summary

  • skills/media/youtube-content and optional-skills/productivity/memento-flashcards both import youtube-transcript-api at runtime
  • Package was absent from pyproject.tomluv sync omits it, both skills fail with ModuleNotFoundError on first invocation
  • Add youtube = ["youtube-transcript-api>=1.2.0"] optional-dependency group
  • Include hermes-agent[youtube] in [all] so standard installs get it automatically

Changes

  • pyproject.toml: new [youtube] extra, added to [all]
  • tests/skills/test_fetch_transcript.py: new regression tests covering extract_video_id(), format_timestamp(), ImportError fallback behavior, and pyproject.toml declaration

Stash-verify

Tests TestPyprojectDeclaresYoutubeExtra::test_youtube_extra_declared_in_pyproject and test_youtube_extra_included_in_all confirmed to fail on upstream/main without this change and pass with it.

Closes #22243

… extra

skills/media/youtube-content/scripts/fetch_transcript.py and
optional-skills/productivity/memento-flashcards/scripts/youtube_quiz.py
both import youtube-transcript-api at runtime, but the package was not
listed in pyproject.toml.  A fresh `uv sync` therefore omits it, and
both skills fail on first invocation with:

    ModuleNotFoundError: No module named 'youtube_transcript_api'

Add a new [youtube] optional-dependency group with
youtube-transcript-api>=1.2.0 (the v1.x API surface the scripts already
use) and include it in [all] so standard installs pick it up.

Regression tests: TestPyprojectDeclaresYoutubeExtra verifies the extra
is present in pyproject.toml and included in [all].

Closes NousResearch#22243

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 9, 2026 18:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a missing optional dependency for YouTube transcript fetching and protects against regressions by introducing targeted tests.

Changes:

  • Add a new youtube optional-dependency group declaring youtube-transcript-api.
  • Include hermes-agent[youtube] in the [all] optional-dependencies group.
  • Add regression tests for transcript utilities plus checks that pyproject.toml declares the extra correctly.

Reviewed changes

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

File Description
pyproject.toml Declares the youtube extra and includes it in [all] to prevent missing runtime dependency installs.
tests/skills/test_fetch_transcript.py Adds regression tests for URL parsing/timestamp formatting, missing-dependency behavior, and pyproject extra declarations.

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

Comment on lines +3 to +50
import sys
from pathlib import Path
from unittest import mock

import pytest

SCRIPTS_DIR = Path(__file__).resolve().parents[2] / "skills" / "media" / "youtube-content" / "scripts"
sys.path.insert(0, str(SCRIPTS_DIR))

import fetch_transcript


class TestExtractVideoId:
def test_standard_watch_url(self):
assert fetch_transcript.extract_video_id("https://www.youtube.com/watch?v=dQw4w9WgXcQ") == "dQw4w9WgXcQ"

def test_short_url(self):
assert fetch_transcript.extract_video_id("https://youtu.be/dQw4w9WgXcQ") == "dQw4w9WgXcQ"

def test_bare_video_id(self):
assert fetch_transcript.extract_video_id("dQw4w9WgXcQ") == "dQw4w9WgXcQ"

def test_shorts_url(self):
assert fetch_transcript.extract_video_id("https://www.youtube.com/shorts/dQw4w9WgXcQ") == "dQw4w9WgXcQ"

def test_embed_url(self):
assert fetch_transcript.extract_video_id("https://www.youtube.com/embed/dQw4w9WgXcQ") == "dQw4w9WgXcQ"

def test_with_extra_params(self):
assert fetch_transcript.extract_video_id("https://www.youtube.com/watch?v=dQw4w9WgXcQ&t=42") == "dQw4w9WgXcQ"


class TestFormatTimestamp:
def test_seconds_only(self):
assert fetch_transcript.format_timestamp(90) == "1:30"

def test_with_hours(self):
assert fetch_transcript.format_timestamp(3661) == "1:01:01"

def test_zero(self):
assert fetch_transcript.format_timestamp(0) == "0:00"

def test_minutes_only(self):
assert fetch_transcript.format_timestamp(600) == "10:00"


class TestFetchTranscriptImportError:
def test_missing_dep_exits_with_message(self, capsys):
Comment on lines +86 to +87
all_deps = " ".join(data["project"]["optional-dependencies"].get("all", []))
assert "youtube" in all_deps, "[all] extra does not include hermes-agent[youtube]"
Comment thread pyproject.toml
# optional-skills/productivity/memento-flashcards (youtube_quiz.py).
# Without this declaration uv sync omits the package and both skills fail
# at first invocation with ModuleNotFoundError (issue #22243).
"youtube-transcript-api>=1.2.0",
@teknium1

teknium1 commented May 9, 2026

Copy link
Copy Markdown
Contributor

Merged via salvage PR #22797. salvage cherry-picked your commit; authorship preserved. Thanks for the contribution!

@teknium1 teknium1 closed this May 9, 2026
@alt-glitch alt-glitch added type/bug Something isn't working python:uv Pull requests that update python:uv code P2 Medium — degraded but workaround exists labels May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Medium — degraded but workaround exists python:uv Pull requests that update python:uv code type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

youtube-content skill: undeclared runtime dependency on youtube-transcript-api

4 participants