SuperAPI AI Directory

detect-python-command

Coding & development

View repository

Updated 10-15 21:13

About this skill

Python Command Detection and Execution

Overview

Determine the appropriate Python command to use in the current environment and run the script. Check the project settings (pyproject.toml, .venv, uv) and run using the optimal method.

Prerequisites

None (the environment is detected automatically)

Usage

Method 1: Run with the wrapper script (recommended)

run-python.sh Use to run a Python script directly:

skills/detect-python-command/scripts/run-python.sh script.py [args...]

Example:

# 設定ファイルの検証
skills/detect-python-command/scripts/run-python.sh \
    skills/mixseek-config-validate/scripts/validate-config.py config.toml

# 引数付きで実行
skills/detect-python-command/scripts/run-python.sh script.py --verbose --output result.json

Method 2: Only check the command

If you want to check which Python command will be used:

# 標準モード(コマンド名のみ)
skills/detect-python-command/scripts/detect-python.sh

# 詳細モード(判別過程を表示)
skills/detect-python-command/scripts/detect-python.sh --verbose

Detection Logic

Detection is performed in the following order of priority:

Priority Condition Command to use
1 pyproject.toml exists and uv is installed uv run python
2 .venv/bin/python exists .venv/bin/python
3 python command exists python
4 python3 command exists python3
5 None of the above apply Exit with an error

Example

References from Other Skills

# mixseek-config-validate からの使用例
skills/detect-python-command/scripts/run-python.sh \
    skills/mixseek-config-validate/scripts/validate-config.py config.toml --type team

Checking Environment Information

User: このプロジェクトでどのPythonコマンドを使えばいい?

Agent: 判別スクリプトを実行します...

       $ skills/detect-python-command/scripts/detect-python.sh --verbose

       出力:
       Detecting Python command...
         pyproject.toml: found
         uv: installed (0.9.24)
         Result: uv run python

       このプロジェクトでは `uv run python` が使用されます。
       スクリプト実行時は run-python.sh を使用してください。

Script List

Script Purpose
run-python.sh Run a Python script with the appropriate command (recommended)
detect-python.sh Check which command will be used (for informational purposes)

Troubleshooting

Python Not Found

Error: No Python interpreter found

Solution:

  1. Install Python
  2. or uv sync Run to create a virtual environment

Script Not Found

Error: Script not found: script.py

Solution:

  1. Check whether the script path is correct
  2. If it is a relative path, check the current directory

uv Not Found

If uv is not installed, .venv/bin/python or the system's python3 is used as a fallback.

If uv needs to be installed,after confirming with the userthe official documentation (https://docs.astral.sh/uv/)を案内してください。

Related Skills

This skill is referenced by the following skills:

  • mixseek-config-validate - Configuration file validation