| name | python |
| description | Python environment and execution guide.
Use when:
- Running Python scripts
- Working with uv, poetry, venv
|
Guide Python environment setup and script execution using uv, poetry, or venv.
NEVER add shebang lines (`#!/usr/bin/env python3`)
NEVER set execute permission on Python files
Always execute with explicit `python` command
When uv.lock exists, use `uv` to execute Python commands
uv run dbt debug --profiles-dir ~/.dbt --no-use-colors
When poetry.lock exists, create virtual environment with `uv`
https://i9wa4.github.io/blog/2025-06-08-create-uv-venv-with-poetry-pyproject-toml.html
When uv.lock does not exist, activate venv manually
1. Activate the virtual environment: `source .venv/bin/activate`
2. Execute Python commands: `dbt debug --profiles-dir ~/.dbt --no-use-colors`
Use explicit `python` command for execution
Adding shebang lines to Python files
Setting execute permissions on Python files