Poetry について調べていた
なんとなく、Poetry についてもう少し詳しくなりたいな、と思って Poetry について調べていた。
以下、気づいたことをつらつらと。
1.0 の preview 版
README通りに
$ curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python
とインストールすると最新版が手に入る。最新版は今日時点では 0.12.17 だ。まだリリースされていない beta 版へアップデートもできる。下記コマンドでアップデートできる。
$ poetry self:update --preview
$ poetry --version
Poetry version 1.0.0b2
run コマンドのオプションパースがおかしい?
beta だけあっておかしいところもある。poetry run python --help とやると python の help オプションの結果が出てきてほしいのだが、poetry run --help の結果が出てきてしまう。
$ poetry run python --help
USAGE
poetry run <args1> ... [<argsN>]
ARGUMENTS
<args> The command and arguments/options to run.
GLOBAL OPTIONS
-h (--help) Display this help message
-q (--quiet) Do not output any message
-v (--verbose) Increase the verbosity of messages: "-v" for normal output, "-vv" for more verbose output and "-vvv" for debug
-V (--version) Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n (--no-interaction) Do not ask any interactive question
さすがにわたしが最初に気づいたわけじゃないだろうと GitHub の Issues/PR をさばくっていたら、該当する PR を発見。
https://github.com/sdispater/poetry/pull/929
しかし結構長いことマージされていない。なんでだ?と思うと最後の方のコメントが。
Since there has been some activity here recently, let me emphasize that the clikit fix that @kevinastone proposed is definitely the better solution, which sadly doesn't change the fact that it is unlikely to get merged in because it has also been ignored for close to a month now. This PR could serve as a temporary workaround until the underlying clikit shortcoming is addressed.
どうやらclikitというツールを直すことで対処するべきと判断したとのこと。
https://github.com/sdispater/clikit
もう PR もオープンだし、そのうち直りそうだ。今はただ待つことにしよう。
テンプレート作り
なんか調べものばかりもあれだったので poetry 1.0 のプレビュー版を早速使ってみることに。
https://github.com/515hikaru/python-template
pre-commit と pyproject.toml に black と pylint を入れただけの超シンプルなテンプレート。
もうちょっと用途を特定しないと別に使えなさそうだなって作った本人が思っている。あとCI関係の設定は入れたい。
今までは black をインストールするときに一手間あったんだけど、 preview 版ではその一手間がかからなかった気がする。そこが一番うれしかったところかな。
あと、poetry env use で使う Python のバージョンを指定できるようになった。今までは poetry がインストールされている Python のバージョンでしか仮想環境がつくれなかったので、とても嬉しい。
ちなみにPython 3.8.0 以降では poetry 1.0 以前は動かない。対応する気もなさそうだ。
終わりに
そんな感じでやっていたら今日も終わった。
サポートいただけた場合感謝をします。