LinuxCommandLibrary

poetry-update

Update project dependencies

TLDR

Update all dependencies

$ poetry update
copy

Update one or more specific packages
$ poetry update [package1 package2 ...]
copy

Update the lock file only, without installing the packages
$ poetry update --lock
copy

Synchronize the environment with the locked packages
$ poetry update --sync
copy

Update dependencies only for a specific group
$ poetry update --only [group_name]
copy

Simulate the update process without making changes
$ poetry update --dry-run
copy

SYNOPSIS

poetry update [options] [packages]

Options:
--dry-run Show what would be done without making changes.
--lock Regenerate the lock file without reinstalling packages.
--no-dev Skip updating development dependencies.
--only=PATTERN Update only packages matching the pattern.
--with=GROUP Include optional dependency groups.
--without=GROUP Exclude optional dependency groups.

PARAMETERS

--dry-run
    Show planned operations without applying them (implies --verbose).

--lock
    Regenerate poetry.lock only; do not reinstall packages.

--no-dev
    Do not update dependencies listed under [tool.poetry.dev-dependencies].

--only=PATTERN
    Update only packages whose names match the given glob pattern.

--with=GROUP
    Also update optional dependency group(s) specified.

--without=GROUP
    Exclude optional dependency group(s) from the update.

[packages]
    One or more explicit package names to update instead of the whole set.

DESCRIPTION

The poetry update command refreshes a project's dependencies to the newest versions that satisfy the version constraints declared in pyproject.toml. It resolves the full dependency graph, writes the exact versions to poetry.lock, and optionally updates only selected packages. This command is the primary way to keep a Poetry‑managed Python project up‑to‑date while preserving reproducible builds.

Typical workflow: run poetry show --outdated to see what can be upgraded, then execute poetry update (or poetry update pkg1 pkg2) to apply the changes. After updating, run your test suite to verify compatibility and commit the modified pyproject.toml and poetry.lock files.

CAVEATS

Only versions compatible with the constraints in pyproject.toml are considered; use caret (^) or tilde (~) ranges to control the update scope. Network failures or locked versions can cause the command to abort. Updating may introduce breaking changes, so always run tests after an update.

CHECKING FOR OUTDATED PACKAGES

Before running an update, you can list packages with newer releases using poetry show --outdated.

VERIFYING CHANGES

After updating, run your test suite (e.g., poetry run pytest) to ensure the new versions do not break the project.

COMMITTING UPDATES

Remember to commit both pyproject.toml and poetry.lock after a successful update so collaborators receive the same dependency set.

HISTORY

The poetry update command has been part of Poetry since its first stable releases (v1.0). It was introduced to provide a deterministic, lock‑file‑driven workflow for Python projects, mirroring the behaviour of other modern package managers. Over successive versions, options such as --no-dev, --only, and group handling were added to give finer control over which dependencies are refreshed.

SEE ALSO

poetry add(1), poetry lock(1), poetry self update(1), poetry show(1)

Copied to clipboard