agentleFS
azentsazents/azents/.claude/skills/python-dependency-update/SKILL.md

python-dependency-update

Skill16 starsChanged 25 days agoMITView on GitHub

Update dependencies in Python projects. Use for Dependabot security alerts, package upgrades, and transitive dependency updates. Use when: (1) resolving Dependabot security alerts, (2) updating a specific package, (3) patching a security vulnerability.

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 6 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run uv commands from the relevant subproject directory.

    line 12
  2. Very specific:

    If several projects use the same package, update every relevant pyproject.toml together.

    line 55
  3. Very specific:

    If --upgrade-package does not update the dependency, the cause is not lowest-direct.

    line 72
  4. Very specific:

    If a parent dependency pins an old version, uv lock --upgrade-package alone will not solve it.

    line 83
  5. Distinctive:

    Update the parent dependency first, using Case A or Case B.

    line 92
  6. Distinctive:

    If it still cannot be resolved, stop and explain clearly:

    line 94
  7. Distinctive:

    When processing multiple alerts at once:

    line 112
  8. Very specific:

    Do not use [tool.uv.override].

    line 131
  9. Very specific:

    Do not edit uv.lock manually.

    line 132
  10. Distinctive:

    Do not run uv commands from the repository root.

    line 133
  11. Distinctive:

    After the update, run git diff --stat and confirm no unrelated files changed.

    line 134

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Python Dependency Update

Workflow for updating dependencies in the Python monorepo, which uses uv workspaces.

Preparation

Run uv commands from the relevant subproject directory.

cd /path/to/azents/python/apps/{project-name}
# or
cd /path/to/azents/python/libs/{project-name}

Update flow

Step 1: Identify the target

Determine whether the package to update is a direct dependency or a transitive dependency.

# Check whether it is explicitly listed in pyproject.toml
grep -r "{package-name}" python/apps/*/pyproject.toml python/libs/*/pyproject.toml

# Check the current version in the lockfile
grep -A2 'name = "{package-name}"' python/apps/{project}/uv.lock

Step 2: Run the update

Case A: Direct dependency (present in pyproject.toml)

Edit the version in pyproject.toml, then refresh the lockfile.

Version specifier rules are the same as in the python-dependency-management skill:

  • Runtime dependencies in apps (apps/*): exact version (==)
  • Dev dependencies in apps (apps/*): minimum version (>=)
  • All dependencies in libraries (libs/*): minimum version (>=)
# Edit pyproject.toml directly with the Edit tool.
# App example: "aiohttp==3.9.0" → "aiohttp==3.11.12"
# Library example: "aiohttp>=3.9.0" → "aiohttp>=3.11.12"

cd /path/to/azents/python/apps/{project-name}
uv lock

If several projects use the same package, update every relevant pyproject.toml together.

Case B: Transitive dependency (not present in pyproject.toml)

The lowest-direct resolution strategy does not pin transitive dependencies. Transitive dependencies usually resolve to the latest compatible version. Update only the lockfile:

cd /path/to/azents/python/apps/{project-name}
uv lock --upgrade-package {package-name}

Confirm that the lockfile version changed:

grep -A2 'name = "{package-name}"' uv.lock

If --upgrade-package does not update the dependency, the cause is not lowest-direct; check these possibilities:

  1. Lockfile preference: uv prefers the existing lockfile version. Add an explicit version constraint to force the target:
    uv lock --upgrade-package '{package-name}>={target-version}'
  2. Parent dependency constraint: another package sets an upper bound such as {package-name}<X.Y.
  3. Compatibility conflict: required version ranges from multiple packages do not overlap.

Case C: Another dependency blocks the update

If a parent dependency pins an old version, uv lock --upgrade-package alone will not solve it.

  1. Find which package requires the dependency:
# Search uv.lock for entries that list the package as a dependency
grep -B10 '{package-name}' uv.lock
  1. Update the parent dependency first, using Case A or Case B.
  2. If it still cannot be resolved, stop and explain clearly:
    • Which parent package constrains the version
    • Whether the latest version of that parent package still has the constraint
    • Options the user can evaluate, such as replacing the parent package or opening an upstream issue

Step 3: Verify

# Confirm the target version in the lockfile
grep -A2 'name = "{package-name}"' uv.lock

# Run the subproject type checker
cd /path/to/azents/python/apps/{project-name}
uv run ty check --error-on-warning

Handling Dependabot security alerts in batches

When processing multiple alerts at once:

# List open alerts
gh api repos/{owner}/{repo}/dependabot/alerts \
  --jq '.[] | select(.state=="open") | {
    number,
    severity: .security_advisory.severity,
    package: .security_vulnerability.package.name,
    patched: .security_vulnerability.first_patched_version.identifier
  }'

Group alerts for the same package and target the highest patched version among them.

A Python package may be used by several subprojects, so inspect every relevant lockfile.

Notes

  • Do not use [tool.uv.override]; forced versions unrelated to dependency constraints are hard to track.
  • Do not edit uv.lock manually; always refresh it with uv commands.
  • Do not run uv commands from the repository root; run them from the subproject directory.
  • After the update, run git diff --stat and confirm no unrelated files changed.
  • Tell the user when a major version upgrade may include breaking changes.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.