Get the FREE Ultimate OpenClaw Setup Guide →

ln-713-pip-upgrader

Scanned
npx machina-cli add skill levnikolaevich/claude-code-skills/ln-713-pip-upgrader --openclaw
Files (1)
SKILL.md
5.2 KB

Paths: File paths (shared/, references/, ../ln-*) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root.

ln-713-pip-upgrader

Type: L3 Worker Category: 7XX Project Bootstrap Parent: ln-710-dependency-upgrader

Upgrades Python dependencies with automatic breaking change detection.


Overview

AspectDetails
InputProject path, package manager type
OutputUpdated requirements.txt/pyproject.toml
Supportspip, poetry, pipenv

Workflow

See diagram.html for visual workflow.

Phases: Pre-flight → Detect Manager → Security Audit → Check Outdated → Apply Upgrades → Verify Installation → Report


Phase 0: Pre-flight Checks

CheckRequiredAction if Missing
requirements.txt OR pyproject.toml OR PipfileYesBlock upgrade
Virtual environment activeNoWarn user (risk of system pollution)

Workers assume coordinator (ln-710) already verified git state and created backup.


Phase 1: Detect Manager

ManagerIndicator Files
piprequirements.txt
poetrypyproject.toml + poetry.lock
pipenvPipfile + Pipfile.lock

Phase 2: Security Audit

Commands

ManagerCommand
pippip-audit --json
poetrypoetry audit (via plugin)
pipenvpipenv check

Actions

SeverityAction
CriticalBlock upgrade, report
HighWarn, continue
Moderate/LowLog only

Phase 3: Check Outdated

Commands

ManagerCommand
pippip list --outdated --format=json
poetrypoetry show --outdated
pipenvpipenv update --outdated

Phase 4: Apply Upgrades

Commands

ManagerCommand
pippip install --upgrade <package>
pip (freeze)pip freeze > requirements.txt
poetrypoetry update
pipenvpipenv update

MCP Tools for Migration Search

Priority Order (Fallback Strategy)

PriorityToolWhen to Use
1mcp__context7__query-docsFirst choice for library docs
2mcp__Ref__ref_search_documentationOfficial docs and PyPI
3WebSearchLatest info, community solutions

Context7 Usage

StepToolParameters
1. Find librarymcp__context7__resolve-library-idlibraryName: "pydantic"
2. Query docsmcp__context7__query-docsquery: "pydantic v1 to v2 migration breaking changes"

MCP Ref Usage

ActionToolQuery Example
Searchmcp__Ref__ref_search_documentation"python pydantic 2 migration guide"
Readmcp__Ref__ref_read_urlURL from search results

WebSearch Fallback

Use when Context7/Ref return no results:

  • "<package> python <version> breaking changes migration"
  • "<ImportError message> <package> fix"

Phase 5: Verify Installation

Commands

CheckCommand
Import testpython -c "import <package>"
Testspytest or python -m pytest

Phase 6: Report Results

Report Schema

FieldDescription
projectProject path
packageManagerpip, poetry, or pipenv
durationTotal time
upgrades[]Applied upgrades
verificationPASSED or FAILED

Common Breaking Changes

MANDATORY READ: Load breaking_changes_patterns.md for full patterns.

PackageBreaking VersionKey Changes
pydantic1 → 2V1 compatibility layer needed
sqlalchemy1 → 2Query syntax changes
fastapi0.99 → 0.100+Pydantic v2 required

Configuration

Options:
  # Upgrade scope
  upgradeType: major          # major | minor | patch

  # Security
  auditLevel: high
  minimumReleaseAge: 14

  # Python specific
  pythonVersion: "3.12"
  useVirtualenv: true

  # Verification
  runTests: true

Error Handling

ErrorCauseSolution
ImportErrorBreaking API changeSearch Context7/Ref for migration
Dependency conflictVersion mismatchTry pip-compile or poetry lock

References


Definition of Done

  • Package manager detected (pip/poetry/pipenv) from indicator files
  • Security audit completed (pip-audit/poetry audit/pipenv check)
  • Outdated packages identified and listed
  • Upgrades applied with requirements.txt/pyproject.toml updated
  • Breaking changes handled via MCP migration guides
  • Import tests and pytest pass after upgrades
  • Report returned with upgrades applied and verification status

Version: 1.1.0 Last Updated: 2026-01-10

Source

git clone https://github.com/levnikolaevich/claude-code-skills/blob/master/ln-713-pip-upgrader/SKILL.mdView on GitHub

Overview

ln-713-pip-upgrader upgrades Python dependencies for pip, poetry, and pipenv with automatic breaking-change detection. It orchestrates pre-flight checks, security audits, and outdated checks, then applies upgrades and updates project manifests (requirements.txt or pyproject.toml) with verification.

How This Skill Works

It runs through a defined workflow: detect the dependency manager from manifest files, perform security audits, fetch outdated packages, apply upgrades, and verify the installation. It updates the appropriate manifest and can generate a report of upgrades and results.

When to Use It

  • When upgrading Python dependencies in a pip/poetry/pipenv project, with breaking-change handling
  • During a security-critical upgrade requiring an audit before applying updates
  • If the project uses requirements.txt or pyproject.toml and needs updates
  • To ensure automated, verifiable upgrades with post-install verification
  • When you need a generated upgrade report including duration and upgrades

Quick Start

  1. Step 1: Provide the project path and target package manager (pip/poetry/pipenv)
  2. Step 2: Run ln-713-pip-upgrader to detect the manager, perform pre-flight checks, and apply upgrades
  3. Step 3: Validate installation, run tests, and review the generated report

Best Practices

  • Run in an isolated virtual environment to prevent system pollution
  • Ensure a backup or git state is available before upgrades
  • Review breaking-change patterns (e.g., pydantic 1→2) before applying
  • Update lockfiles/manifest after upgrades (pip freeze, poetry update, or pipenv update)
  • Run the project’s test suite and manual validation after upgrades

Example Use Cases

  • A Django project using requirements.txt upgrades several libs with automatic security-audit checks
  • A FastAPI app migrating from pydantic 1.x to 2.x with breaking-change handling
  • A Poetry-managed project updating pyproject.toml and poetry.lock via poetry update
  • A Pipenv project upgrading dependencies using Pipfile and Pipfile.lock with audit
  • A project that generates a post-upgrade verification report including duration and upgrades

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers