Skip to content

TonyWu20/no-bare-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

no-bare-python

A Claude Code hook that yells at AI assistants for using bare python instead of uv run python.

What is this?

A pre-tool-use hook that intercepts every Bash command Claude tries to run and checks for the cardinal sin: calling python or python3 directly.

If Claude forgets, it gets this:

============================================================
  YOU DUMB F**K! BARE PYTHON DETECTED!
  READ YOUR DAMN CLAUDE.md: uv run python, NOT bare python!
  Your command: python script.py
  Fix: use 'uv run python' instead of python/python3.
============================================================

Why does this exist?

Because apparently "always use uv run python" in CLAUDE.md is not enough. Some AI assistants need a more... emphatic reminder.

Installation

# In your project's .claude/settings.json or hooks.json:
{
  "hooks": {
    "PreToolUse": [{
      "matcher": "Bash",
      "hooks": [{
        "type": "command",
        "command": "bash /path/to/enforce-uv-python.sh"
      }]
    }]
  }
}

Does it work?

The hook exits with code 2 on violation, which blocks the tool call. Claude is then forced to reconsider its life choices and use uv run python like a civilized agent.

License

Do whatever you want. Just use uv run python.

About

Block and curse your Claude Code when it wants to call bare `python` or `python3` without using `uv`.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages