AGENT SKILL

manage-dependencies

Reference for managing Python dependencies with Poetry. Use when adding, removing, or updating packages, troubleshooting install errors, or managing the virtual environment and lock file.

License 许可
MIT
最近更新
2026-10-24
Stars
★ 0
Forks
0

01 前言 Front Matter

name
manage-dependencies
description
Reference for managing Python dependencies with Poetry. Use when adding, removing, or updating packages, troubleshooting install errors, or managing the virtual environment and lock file.

02 资源文件 7

03 SKILL.md 正文

MANAGED SKILL — Do not edit this file here. It is managed from an external source repository. To make changes, update the source and run "update my skills" to sync.

Manage Dependencies (Poetry)

This project uses Poetry for dependency management.

Adding dependencies

# Add a production dependency
poetry add <package>

# Add with version constraint
poetry add "<package>>=1.2,<2.0"

# Add a dev dependency
poetry add --group dev <package>

# Add to a custom group
poetry add --group test <package>

# Add multiple packages at once
poetry add <package1> <package2> <package3>

After adding, poetry.lock and pyproject.toml are updated automatically.

Removing dependencies

# Remove a production dependency
poetry remove <package>

# Remove a dev dependency
poetry remove --group dev <package>

Updating dependencies

# Update a single package to its latest compatible version
poetry update <package>

# Update all packages
poetry update

# Show outdated packages
poetry show --outdated

Installing from lock file

# Install all dependencies (respects poetry.lock)
poetry install

# Install without dev dependencies
poetry install --without dev

# Install only specific groups
poetry install --only main

# Regenerate lock file without upgrading
poetry lock --no-update

Running commands

# Run a command inside the managed virtual environment
poetry run python script.py
poetry run pytest
poetry run ruff check .

# Activate the venv in current shell
poetry shell

Virtual environment

Poetry creates and manages the virtual environment automatically.

# See where the venv is located
poetry env info --path

# List all envs for this project
poetry env list

# Remove a venv
poetry env remove <python-version>

# Use a specific Python version
poetry env use python3.12

Tip: configure poetry config virtualenvs.in-project true to create .venv/ inside the project directory (recommended for consistency with editor tooling).

Lock file hygiene

  • poetry.lock must always be committed.
  • Never edit poetry.lock manually.
  • If the lock file gets into a bad state: rm poetry.lock && poetry lock.
  • If pyproject.toml changed but you don't want to upgrade packages: poetry lock --no-update.
  • In CI pipelines, poetry install respects the lock file by default.

pyproject.toml structure

Dependencies are declared in the Poetry-specific [tool.poetry] table:

[tool.poetry.dependencies]
python = "^3.12"
httpx = "^0.27"
rich = "^13.0"

[tool.poetry.group.dev.dependencies]
pytest = "^8.0"
ruff = "^0.5"
black = "^24.0"

Troubleshooting

Package not found

  • Check the package name is correct on PyPI.
  • If it's a private package, ensure the source and credentials are configured (see private registry section below or use the codeartifact-auth skill).

Version conflict / SolverProblemError

  • Run poetry update <package> -vvv for detailed resolution output.
  • Try relaxing version constraints in pyproject.toml.
  • Check for conflicting constraints across dependency groups.

Stale virtual environment

  • Remove and recreate: poetry env remove python && poetry install.

Lock file out of sync

  • poetry lock --no-update regenerates the lock file from current pyproject.toml constraints without upgrading packages.

04 同仓库更多 Skills

cartaorobbin
cartaorobbin/pyramid-temporal

write-pytest

Write pytest tests for any Python codebase. Use when the user asks to write tests, create tests, add tests, or test a module/service/endpoint/function. Framework-agnostic; routes to framework-specific helpers when signals are detected. Follows a research-then-discuss-then-write flow.

★ 0
cartaorobbin
cartaorobbin/pyramid-temporal

quality-assurance

Run quality assurance checks on the current chat session — pre-task validation, post-task checklist, and code review. Use when finishing a task, before committing, or when the user asks for a QA review.

★ 0
cartaorobbin
cartaorobbin/pyramid-temporal

python-developer

Python developer umbrella — installs Python coding conventions and bundles companion skills (best practices, testing, dependency management) in a single setup. Use when the user asks to set up Python development conventions, install Python skills, or says "set up Python development".

★ 0
cartaorobbin
cartaorobbin/pyramid-temporal

python-best-practices

Comprehensive Python coding conventions and best practices. Use when the user asks about Python conventions, coding patterns, best practices, code style, anti-patterns, or "how should I write this" in Python.

★ 0
cartaorobbin
cartaorobbin/pyramid-temporal

pyramid-library

Library Developer persona: developing standalone Pyramid extensions (own repo, own package) that expose includeme for external consumers. Use when the user builds a reusable Pyramid library, designs includeme for consumers, registers custom directives/tweens/request methods, or tests a library with a proper app.

★ 0
cartaorobbin
cartaorobbin/pyramid-temporal

pyramid-developer

Pyramid framework conventions — configuration/registry, module system with includeme, pyramid_services, models, Cornice REST, ACL authorization, and transactions. Use when setting up Pyramid development conventions for a project.

★ 0