Skip to content

Hook: python3 -m pytest/mypy not matched (only python) #113

@Rmohid

Description

@Rmohid

Problem

The hook only matches python -m pytest and python -m mypy:

elif echo "$MATCH_CMD" | grep -qE '^python[[:space:]]+-m[[:space:]]+pytest([[:space:]]|$)'; then

On macOS (and many Linux setups), the command is python3, not python. These commands are never rewritten.

rtk discover shows 177 python3 and 88 python commands in 30 days of history.

Fix

Change the patterns to accept both:

elif echo "$MATCH_CMD" | grep -qE '^python3?[[:space:]]+-m[[:space:]]+pytest([[:space:]]|$)'; then
  REWRITTEN="${ENV_PREFIX}$(echo "$CMD_BODY" | sed -E "s|^python3? -m pytest|$RTK pytest|")"

Same for the mypy pattern.

Environment

  • rtk 0.15.3
  • macOS Tahoe (python3 is the default)
  • Claude Code CLI

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