poetry add packageのオプションについて
現象
python = "^3.6"
下記エラーが発生する
The current project's Python requirement (^3.6) is not compatible with some of the required packages Python requirement:
- dataclasses requires Python >=3.6, <3.7
Because no versions of dataclasses match >0.7,<0.8
and dataclasses (0.7) requires Python >=3.6, <3.7, dataclasses is forbidden.
So, because hey depends on dataclasses (^0.7), version solving failed.
解決策
poetry add dataclasses --python ">=3.6, <3.7"
poery add のオプションにpythonのversionを参照するようにオプションにそれら情報を含めてからインストールする必要がある
ただpoetryのドキュメントを読んでもそのオプションの指定方法がわからなかったので調べた過程や結果をこちらに記す
詳細
poetry add dataclasses
dataclassesはPython 3.6のbackport用にインストールする
したがって、Dependencyを考慮すると以下のようになる
Python (^3.6 <3.7)
上記オプションをpoetry add package に考慮する必要がある
dataclasses = { version="^0.7", python="^3.6, <3.7" }
参考