poetryはPythonのパッケージの依存関係を管理するためのツール。 https://github.com/python-poetry/poetry
以下はインストールログ。
$ /Applications/Python\ 3.9/Install\ Certificates.command /Applications/Python\ 3.9/Install\ Certificates.command -- pip install --upgrade certifi Collecting certifi Using cached certifi-2020.12.5-py2.py3-none-any.whl (147 kB) Installing collected packages: certifi Successfully installed certifi-2020.12.5 WARNING: You are using pip version 20.2.3; however, version 20.3.3 is available. You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -m pip install --upgrade pip' command. -- removing any existing file or link -- creating symlink to certifi certificate bundle -- setting permissions -- update complete $ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3.9 curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3.9 Retrieving Poetry metadata # Welcome to Poetry! This will download and install the latest version of Poetry, a dependency and package manager for Python. It will add the `poetry` command to Poetry's bin directory, located at: $HOME/.poetry/bin This path will then be added to your `PATH` environment variable by modifying the profile files located at: $HOME/.profile $HOME/.bash_profile You can uninstall at any time by executing this script with the --uninstall option, and these changes will be reverted. Installing version: 1.1.4 - Downloading poetry-1.1.4-darwin.tar.gz (38.50MB) Poetry (1.1.4) is installed now. Great! To get started you need Poetry's bin directory ($HOME/.poetry/bin) in your `PATH` environment variable. Next time you log in this will be done automatically. To configure your current shell run `source $HOME/.poetry/env`
通常poetryはvenv自体を作成してくれるが、それが邪魔になる時がある。 例えばvenv環境を別のツール(例えばIDEやエディターの機能)で別途行っているようなときだ。 そういうケースではpoetryにvenvを新たに作成してほしくない。
そういうときは以下のコマンドを実行すると現在の環境でパッケージの操作を行ってくれる。
poetry config virtualenvs.create false --local
コマンドを実行するとpoetry.tomlというファイルに設定が書き込まれる。
[virtualenvs] create = false
開発時は環境によってこの設定は異なると思われるのでgitignoreしておいたほうが良いかもしれない。