Skip to content

Refactor: split the single-file codebase into focused modules #64

Description

@JoywinNeilLasrado

Overview

The entire application currently lives in one file: src/Qrip.py (~3,700 lines). There are no tests, no separate modules, and no separation of concerns. This makes the code hard to navigate, difficult to test, and intimidating for new contributors.

This is a gradual refactor — do not attempt to split everything at once. Each step below is a self-contained PR.

Suggested extraction order

Each step should be done as a separate PR. After each one, verify the app still runs correctly before moving on.

  • Step 1 — Lyrics module: Extract all LRCLIB fetching and lyrics display logic into src/lyrics.py. This is the most self-contained piece and a good starting point.
  • Step 2 — Credentials module: Extract _apply_stored_credentials() and all accounts.json read/write logic into src/credentials.py.
  • Step 3 — Config module: Extract config file read/write logic (once Save app preferences to a config file (~/.config/qrip/config.json) #54 is done) into src/config.py.
  • Step 4 — Downloader module: Extract the subprocess/PTY download logic and output parsing into src/downloader.py.
  • Step 5 — Services module: Extract service URL detection, API calls, and metadata fetching into src/services.py (see also Extract service detection logic into a single reusable structure #62).

How to approach each step

  1. Identify all related functions/methods in src/Qrip.py
  2. Move them to the new module file
  3. Update imports in Qrip.py
  4. Run the app manually and verify the affected feature still works

Goal

src/Qrip.py becomes a thin UI layer that wires together focused, independently readable modules — each of which can eventually have its own tests.

Good starting point for new contributors: Step 1 (lyrics module) is the most isolated and well-defined piece. It's a great way to get familiar with the codebase.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedMaintainer is looking for help. Contributions welcome.priority:highCore issue affecting functionality or user experience. Needs attention soon.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions