Skip to content

Remove components and ancestry, and make prune_dirs Path-only #6972

Description

@snejus

Part of: #1409

Depends on: #6809.

Problem

beets.util.components, beets.util.ancestry, and the byte-compatible prune_dirs implementation duplicate behavior that Path already provides. Keeping these helpers after runtime paths are Path-native makes utility code harder to reason about and leaves another place where bytes can enter filesystem logic.

Expected behavior

  • Replace components callers with Path.parts or equivalent local Path operations.
  • Replace ancestry callers with Path.parents or equivalent local Path operations.
  • Make prune_dirs accept Path for both the target directory and optional root.
  • Keep clutter matching behavior unchanged.
  • Remove tests that only validate the deleted compatibility helpers, while preserving coverage for the behavior that still exists.

Suggested fix

Remove the obsolete decomposition helpers first, then simplify prune_dirs around Path.exists, Path.iterdir, Path.parents, and shutil.rmtree.

Acceptance criteria

  • No production or test code imports components or ancestry.
  • prune_dirs callers pass Path.
  • Directory pruning behavior remains covered by tests.
  • poe test and poe lint pass with coverage at or above 80%.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions