rajivmehtaflex/power-utility/python-version-management

Claude Code and agent skill by rajivmehtaflex/power-utility

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Force Python versions via uv for cloud compatibility.

Install

npx vskill@latest install rajivmehtaflex/power-utility/python-version-management

SKILL.md

The same SKILL.md was published earlier as rajivmehtaflex/power-utility/python-version-management.

Python Version Management (uv)

Use this skill when a project requires a specific Python version (e.g., for cloud provider compatibility or specific library requirements) that differs from the system default or the version uv automatically selects.

Workflow: Forcing a Specific Version

When you encounter a "Unsupported Python version" error (common in cloud image builders) or need to pin a version:

  1. Install the target version:

``bash uv python install 3.12 ``

  1. Pin and recreate the virtual environment on that version:

uv python install alone does not recreate an existing venv — verified 2026-08-12, Modal kept failing with Unsupported Python version: '3.13' after uv sync until the venv was recreated. Prefer uv python pin (writes .python-version so every later uv sync respects it), then recreate: ``bash uv python pin 3.12 rm -rf .venv && uv sync # — or without a pin file — uv venv --python 3.12 --clear && uv sync ` The rm -rf .venv / --clear step is mandatory when downgrading; uv sync` alone reuses the old interpreter.

  1. Verify the active version before any mutating command:

``bash .venv/bin/python --version .venv/bin/modal --version # or .venv/bin/<command> --version ` Also verify with a sanitized env when running from Hermes (see Sanitizing the Environment below). Full transcript: references/modal-python313-modal-deploy-2026-08-12.md`.

Compatibility Pitfalls

Platform/ToolVersion ConstraintSymptomFix
Modal Image BuilderMax 3.12 (Image 2023.12)Unsupported Python version: '3.13'uv python pin 3.12 && rm -rf .venv && uv sync — uv python install alone does NOT recreate venv
Old Legacy ProjectsMax 3.9SyntaxError or ImportErrorForce 3.9
C-Extension WheelsMust match venvModuleNotFoundError (e.g. watchfiles._rust_notify)Ensure venv Python version matches the wheels in site-packages

Tooling Patterns

Sanitizing the Environment

When running tools from a venv inside an agent's terminal, inherited PYTHONPATH can leak site-packages from the agent's own runtime (e.g., Python 3.11) into the project's venv (e.g., Python 3.12), causing binary crashes.

The Fix: Prefer the project's venv executable, then remove inherited Python overrides before invoking it. Use the minimal env -i form when you need a fully isolated process; env -u is a lighter option when the normal shell environment is otherwise required.

bash
# Verify the project interpreter and CLI first
.venv/bin/python --version
.venv/bin/<command> --version
# Lightweight isolation
env -u PYTHONPATH -u PYTHONHOME .venv/bin/<command> <args>
# Full isolation
env -i HOME="$HOME" PATH="$PWD/.venv/bin:/usr/bin:/bin:/usr/local/bin" .venv/bin/<command> <args>

Never rely on a globally installed launcher when a project venv is present: the launcher may select an older system interpreter or inherit incompatible agent packages. Run a harmless --version/status check before any mutating command such as deploy, migrate, or publish. When downgrading, always verify .venv/bin/python --version changed — uv sync after uv python install silently reuses the old venv (2026-08-12 Modal case).

Verifying Allocation vs. Reporting

Inside slim containers (e.g., debian_slim), tools like free -h are missing. Cgroup reporting for memory often shows the host total rather than the container limit.

  • Reliable check: Use nproc to verify CPU core allocation.
  • Unreliable check: /sys/fs/cgroup/memory/memory.limit_in_bytes (often reports host total).
  • Source of Truth: Trust the deployment config (config.py) and the scheduler's confirmation.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/rajivmehtaflex/power-utility/python-version-management/badge)](https://verified-skill.com/skills/rajivmehtaflex/power-utility/python-version-management)

Something wrong with this skill or its page? Tell us.