public note

Poetry dev-dependencies が v1.2 で deprecated になっていたのでこれからは group を使う

いつの間にか、poetry add --devpoetry install --no-dev などで指定する開発用パッケージを示す dev-dependencies が Deprecated になっていることに気づきました。

python-poetry.org

1.2 より前は [tool.poetry.dev-dependencies] という TOML テーブル名称でしたが、1.2 以後は [tool.poetry.group.dev.dependencies] です。

As the dev-dependencies is now deprecated, projects should migrate to the new group syntax as soon as possible. Keep in mind that the group syntax is a new feature of Poetry 1.2, and your project will not be buildable with Poetry 1.1 after migrating.

この group ですが、Poetry で管理するパッケージを区分けするためのものだそうです。 Poetry を使って配布するパッケージに依存するものをグルーピングして pip install するときにハンドリングしたい場合は、これまでどおり Extras を使う、という位置づけ。

group を何も指定しないと [tool.poetry.dependencies] が処理対象となります。これは、内部的には main group という扱いとのこと。

group を指定するときのオプションは、poetry add コマンドなら group、poetry install コマンドなら with, without, only が使えました。開発用パッケージを細かく分類したいときに便利。