← Zurück zu Desktop-App-Entwickler
Entdecke, wie der Skill hilft
4. Static Typecheckers (
Python-Abhängigkeiten aktualisieren
Plant gezielte Python-Updates anhand Resolver, unterstützter Interpreter und plattformspezifischer Binärabhängigkeiten.
python-dependency-upgrades
Teammitglieder mit diesem Skill
Wann ist der Skill hilfreich?
Nutze ihn bei Änderungen an Lockdateien, Wheels, Typen oder Frameworkverhalten über mehrere Umgebungen.
Wobei hilft er dir?
- Identifiziert Resolver, Lockdatei und Python-Versionsgrenzen.
- Prüft Wheels und native Erweiterungen auf unterstützten Plattformen.
- Begrenzt Paketänderungen und testet Framework- oder Typmigrationen.
Das könntest du fragen
Aktualisiere ein Python-Paket ohne unerwartete Änderungen unbeteiligter Abhängigkeiten. Löse und installiere mit unterstützter Python-Version und teste einen betroffenen Importpfad. Prüfe Lockfile-Bewegung und Verfügbarkeit nötiger nativer Wheels.
Ausführliche Dokumentation
Hier findest du die ursprüngliche Anleitung, Beispiele und Prüfschritte des Skills in ihrer Originalsprache.
Weniger anzeigen
Python Dependency Upgrades
When to Use
Use when upgrading Python libraries, frameworks (FastAPI, Django, Flask, SQLAlchemy, Celery, Pydantic, Pytest), data/ML libraries (NumPy, Pandas, SciPy, PyTorch), or Python runtime versions (requires-python).
Environment & Tooling Discovery
1. Identify the Active Resolver & Lock Mechanism
Never mix Python package managers or run bare global pip install:
uv(pyproject.toml+uv.lock): Useuv lock --upgrade-package <pkg>followed byuv sync(oruv run pytest). Verify lock consistency withuv lock --check.- Poetry (
pyproject.toml+poetry.lock): Usepoetry update <pkg>(neverpoetry lockwithout--no-updateon older Poetry v1 unless intending to refresh all unlocked packages; in Poetry 1.8+/2.0,poetry lockpreserves existing locked versions by default). Verify withpoetry check --lock. pip-tools(requirements.in$\rightarrow$requirements.txt): Usepip-compile --upgrade-package <pkg> --generate-hashes requirements.inso only the targeted package and its sub-dependencies move.- Pipenv (
Pipfile+Pipfile.lock): Usepipenv update <pkg>. -Always activate or execute inside the project's virtual environment (.venv,uv run,poetry run).
2. Python Version Markers & Binary Wheel Availability
- Inspect
requires-pythoninpyproject.toml(e.g.,>=3.11,<3.14),.python-version,Dockerfilebase images (python:3.12-slim-bookworm), and CI matrix versions. - Multi-platform lockfiles (
uv.lock,poetry.lock) resolve environment markers (sys_platform,platform_machine,implementation_name) across macOS (arm64/x86_64), Linux (manylinuxglibc vsmusllinuxAlpine), and Windows. - Check C/Rust extension packages (
psycopg/psycopg2-binary,cryptography,orjson,pydantic-core,pillow,lxml,numpy,scipy,grpcio):- Confirm prebuilt
manylinux/musllinux/macosxwheels exist on PyPI for the target Python version so production or CI builds do not unexpectedly fall back to slow, fragile source compilation requiringgcc,rustup,libpq-dev, orpython3-dev.
- Confirm prebuilt
Ecosystem-Specific Upgrade Contracts
1. Pydantic v1 $\rightarrow$ v2 & FastAPI / SQLModel Alignment
- Check whether any dependency still imports
pydantic.v1or relies on Pydantic v1 APIs (@validator$\rightarrow$@field_validator,@root_validator$\rightarrow$@model_validator,.dict()$\rightarrow$.model_dump(),.json()$\rightarrow$.model_dump_json(),.parse_obj()$\rightarrow$.model_validate(),class Config$\rightarrow$model_config = ConfigDict(...),BaseSettingsmoved topydantic-settings). - Upgrade
pydantic,pydantic-core,pydantic-settings, andfastapiin compatible combinations.
2. SQLAlchemy 1.4 $\rightarrow$ 2.0 & Alembic
- Watch for 2.0 contract shifts: legacy
session.query()vsselect()+session.execute().scalars(), explicitsession.commit()/ transaction boundaries,DeclarativeBaseandMapped[...]/mapped_column(...)typing, and removed implicit autocommit (engine.execute()removed in favor ofwith engine.connect() as conn:). - Ensure database driver packages (
asyncpg,psycopg[binary],aiomysql,aiosqlite) match SQLAlchemy's dialect expectations.
3. Django LTS & Async / Middleware / Form Changes
- Check Django's official release notes for removed deprecation shims (
USE_L10N,DEFAULT_FILE_STORAGE$\rightarrow$STORAGESdict,index_together$\rightarrow$Meta.indexes,url()$\rightarrow$path()/re_path(), CSRFCSRF_TRUSTED_ORIGINSscheme requirements). - Run
python manage.py check --deployandpython manage.py makemigrations --check --dry-runafter every Django or third-party app upgrade to confirm zero unapplied model/migration drift.
4. Static Typecheckers (mypy, pyright) & pytest
- When upgrading
mypy,pyright, ortypes-*stub packages (types-requests,types-redis,types-PyYAML,django-stubs), fix newly uncovered Optional/Union or generic invariance issues in code rather than adding blanket# type: ignore. - Run
pytest -W error::DeprecationWarningon targeted modules to surface deprecations before the next major upgrade.
Enthaltene Dateien 1
SKILL.md
