← 返回命令列表

Linux command

poetry-sync 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Sync dependencies with lock file

poetry sync

Sync without dev dependencies

poetry sync --no-dev

Sync specific groups

poetry sync --with [group]

Dry run

poetry sync --dry-run

说明

poetry sync strictly synchronizes the virtual environment to match the poetry.lock file exactly. Unlike poetry install, it also removes any packages present in the environment that are not listed in the lock file. This is useful for ensuring clean, reproducible environments in CI/CD pipelines or production deployments. Use --dry-run to preview changes before applying them.

参数

--no-dev
Exclude dev dependencies.
--with _GROUPS_
Include specific groups.
--without _GROUPS_
Exclude specific groups.
--dry-run
Simulate sync.

FAQ

What is the poetry-sync command used for?

poetry sync strictly synchronizes the virtual environment to match the poetry.lock file exactly. Unlike poetry install, it also removes any packages present in the environment that are not listed in the lock file. This is useful for ensuring clean, reproducible environments in CI/CD pipelines or production deployments. Use --dry-run to preview changes before applying them.

How do I run a basic poetry-sync example?

Run `poetry sync` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --no-dev do in poetry-sync?

Exclude dev dependencies.