Skip to content

refactor: reorganize yt-study package and stabilize pipeline#62

Draft
whoisjayd wants to merge 15 commits intomainfrom
dev
Draft

refactor: reorganize yt-study package and stabilize pipeline#62
whoisjayd wants to merge 15 commits intomainfrom
dev

Conversation

@whoisjayd
Copy link
Owner

Summary

This draft PR captures the package refactor and stabilization checkpoint for yt-study. The codebase is reorganized around clearer architectural boundaries (cli, config, domain, errors, infrastructure, logging_config, persistence, services, ui, utils), the runtime and tests were stabilized after the migration, and the repository was revalidated with the project workflow before moving on to the next phase of module-splitting and CLI polish. This is a draft because it is intended as a reviewable backup/integration point before the next refactor slice lands.

Changes

  • Refactor the package layout away from the old core/flat module structure into domain-oriented and layer-oriented modules.
  • Introduce centralized constants, error types, formatting helpers, persistence schemas/repository, logging utilities, and service boundaries.
  • Normalize YouTube infrastructure ownership across metadata, transcript, playlist, availability, extractor, and parser modules.
  • Stabilize config loading and testability after the migration, including the lazy settings compatibility layer and preserved CLI patch points used by the test suite.
  • Reduce CLI import-time weight while preserving existing command behavior and test patch surfaces.
  • Move SQLite async/thread handoff behind the persistence boundary instead of keeping it in pipeline orchestration code.
  • Add/fix broad pytest coverage for the refactored package layout, including new error, persistence, and utility test modules.
  • Refresh repo architecture references and update the wiki architecture documentation/submodule pointer.
  • Update dependency metadata and lockfile to match the reorganized package and validation toolchain.
  • Validate the branch with the repo workflow: make hooks-run and make ci both pass, including the full 461 test suite.

Breaking Changes (if any)

This is primarily an internal refactor, but it does change the internal module layout substantially. Imports that previously targeted legacy paths under yt_study.core, yt_study.db, yt_study.cli, or the old setup-wizard location should be updated to the new package structure. The public CLI command surface remains intact.

Related Issues

Refs: none

sourcery-ai[bot]

This comment was marked as resolved.

@github-actions github-actions bot added type:documentation Documentation improvements area:cli CLI or terminal UX area area:docs Documentation and wiki area:tests Testing and test infrastructure dependencies Pull requests that update dependency files labels Mar 19, 2026
Repository owner deleted a comment from gemini-code-assist bot Mar 19, 2026
Repository owner deleted a comment from gemini-code-assist bot Mar 19, 2026
@whoisjayd whoisjayd self-assigned this Mar 19, 2026
@github-actions github-actions bot added area:core Core pipeline/config/orchestration area:youtube YouTube parsing, transcripts, metadata, playlists area:llm LLM providers, prompts, and generation labels Mar 20, 2026
@ehteshamtarique
Copy link

@whoisjayd do you need help in refactoring. I can take a part of the codebase and start refactoring it in a different PR. That can speed things up. And it will be easier to review also

@whoisjayd
Copy link
Owner Author

@ehteshamtarique I have added execution plans.

Refactoring is mostly done. A few things still in progress:
• Bug fixes & edge case handling
• New CLI commands
• Cache improvements
• Migrating to ty (by astral) from mypy for faster type checks
• Migrating docs to : https://www.mintlify.com/

Will keep you posted!

@whoisjayd
Copy link
Owner Author

@ehteshamtarique Please proceed with the plan as outlined — Plans 1 and 2 are already completed, so pick up sequentially from Plan 3 onwards.

A few things to keep in mind:

  • Execute plans in order, one at a time.
  • If you come across any bugs or edge cases along the way, go ahead and fix them.
  • Before pushing, run a full end-to-end manual test covering: video (chapters preferred), playlist, and batch.
  • Push after each plan is completed to avoid conflicts.
  • Keep me updated on your progress throughout.

Repository owner deleted a comment from gitguardian bot Mar 21, 2026
@whoisjayd whoisjayd linked an issue Mar 21, 2026 that may be closed by this pull request
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:cli CLI or terminal UX area area:core Core pipeline/config/orchestration area:docs Documentation and wiki area:llm LLM providers, prompts, and generation area:tests Testing and test infrastructure area:youtube YouTube parsing, transcripts, metadata, playlists dependencies Pull requests that update dependency files type:documentation Documentation improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor: Pydantic Configuration

2 participants