{"data":{"slug":"discovered-ea769c2dbb2e18b0cdbad83a318a46d1414b5d5a7d61f518","title":"Python Tooling","summary":"Manage Python project environments and dependencies, and run Ruff formatting and linting or ty type checks when configured. Use when creating or changing a Python project, installing dependencies, or resolving Python tooling issues.","url":"https:\/\/skillshunter.net\/skills\/discovered-ea769c2dbb2e18b0cdbad83a318a46d1414b5d5a7d61f518","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-ea769c2dbb2e18b0cdbad83a318a46d1414b5d5a7d61f518","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-ea769c2dbb2e18b0cdbad83a318a46d1414b5d5a7d61f518.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-ea769c2dbb2e18b0cdbad83a318a46d1414b5d5a7d61f518\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Before using Ruff or ty for diagnostics, ensure they are installed as development dependencies in the project. For LSP setup, use the editor\u2019s documented server configuration and the project\u2019s installed tool versions.","instructions":"---\nname: python-tooling\ndescription: Manage Python project environments and dependencies, and run Ruff formatting and linting or ty type checks when configured. Use when creating or changing a Python project, installing dependencies, or resolving Python tooling issues.\n---\n\n# Python tooling\n\nInspect the project\u2019s existing packaging and tool configuration before changing it. Preserve its established workflow; do not migrate a project or replace its dependency manager as an incidental cleanup.\n\n## Execution and standalone scripts\n\nUse **uv for all Python execution and tooling**: `uv run` for project commands, `uv run --script script.py` for standalone scripts, and `uv tool run` for standalone CLI tools. Avoid direct interpreter invocations and system-wide pip installs. For a project using another dependency manager, use uv as the launcher while preserving that project's dependency files unless migration is requested.\n\nInitialize standalone Python scripts with `uv init --script script.py`. Declare their Python version and dependencies in inline PEP 723 metadata, including `dependencies = []` for standard-library-only scripts. Add dependencies with `uv add --script script.py PACKAGE`. For directly executable scripts, use `#!\/usr\/bin\/env -S uv run --script` and set the executable bit. A reusable standalone script should carry its own environment definition instead of depending on the caller's working directory or globally installed packages.\n\n## New projects and dependencies\n\nFor a new project, use `uv` with `pyproject.toml` and a committed `uv.lock`. Use `uv init`, add runtime or development dependencies with `uv add` (use `uv add --dev` for development tools), then sync and run project commands with `uv run`. Keep the Python version consistent with the project\u2019s declared support and pin it only when the project needs a specific interpreter.\n\nFor an existing uv project, treat `pyproject.toml` as dependency intent and `uv.lock` as the resolved environment. Make dependency changes through `uv add` or `uv remove` and include the resulting lockfile change. Use `uv sync --locked` when installing an existing lock without allowing it to change; use `uv lock --check` to confirm it matches the project metadata. Upgrade dependencies only when requested or needed to resolve the task, and keep upgrades as narrow as practical.\n\nFor projects using another manager or legacy files, use the existing manager and its lockfile. If migration is requested, first inspect the current dependency groups, Python constraints, scripts, and CI\/install paths; propose or make a scoped migration that preserves them. Keep compatibility exports such as `requirements.txt` only when a consumer needs them.\n\n## Code quality checks\n\nWhen Ruff is configured or installed in the project, use its project configuration. Run `ruff format` for formatting and `ruff check` for lint diagnostics, typically through the project environment (`uv run ruff format \u2026`, `uv run ruff check \u2026`). Apply safe automatic lint fixes only when they are within the requested scope; review the diff and resolve remaining diagnostics deliberately. Keep lint rules and format settings in the project\u2019s existing `ruff.toml` or `pyproject.toml` configuration.\n\nWhen ty is configured or installed in the project, use `ty check` through that environment (for example, `uv run ty check`). Check that the project environment and declared dependencies are available before interpreting unresolved imports as source errors. Fix type issues in the relevant code and retain the project\u2019s existing ty settings.\n\nUse configured project scripts or CI commands when they define the canonical checks. Do not download tools on an automatic hook\u2019s behalf; use tools already available in the project or explain what must be installed. For persistent tool use, add Ruff or ty to the project\u2019s development dependencies rather than relying on an ephemeral runner.\n\n## LSP reference\n\nRuff and ty can provide Python editor diagnostics through their language servers when the editor supports them. Configure or troubleshoot an LSP only when requested; ordinary code work can use the project\u2019s command-line checks. Do not install both as competing servers when the editor permits only one server per file extension. If LSP setup is needed, use the editor\u2019s documented server configuration and the project\u2019s installed tool versions.\n\n## Repository hooks\n\nThe bundled `scripts\/install_hooks.py` installs only Python hooks for Codex and Claude Code. Run it with `uv run --script` when setting up or updating hooks, then review new definitions in the host's `\/hooks` menu. The hooks add project context and guard pip mutations in uv projects; they run no checks, install no packages, and grant no permissions. Use `PYTHON_TOOLING_DISABLED=1` in the hook environment for an explicitly requested exceptional workflow. Perform relevant code checks through the user's normal visible terminal workflow.\n","use_cases":["Creating or changing a Python project","Installing dependencies","Resolving Python tooling issues","Running Ruff formatting and linting","Running ty type checks"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/clzmj\/skills\/blob\/9fa5541e90e648cf1e5d66061d0f0c42396327d7\/skills\/python-tooling\/SKILL.md","source_commit":"9fa5541e90e648cf1e5d66061d0f0c42396327d7","license":null,"version":null,"listing_approved_at":"2026-11-29","created_at":"2026-11-28T18:56:50.000000Z","updated_at":"2026-11-29T10:53:53.000000Z","seo_title":"Python Tooling - Manage Environments, Dependencies, and Code Quality","seo_description":"Manage Python project environments and dependencies, and run Ruff formatting and linting or ty type checks when configured. Use when creating or changing a Python project","seo_keywords":["Python tooling","Python project environments","Python dependencies","Ruff formatting","Ruff linting","ty type checks","uv tooling","Python code quality"]}}