1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Poetryを使ったPyPIおよびTestPyPIへのパッケージ公開手順をメモしてみた

1
Posted at

Poetryを使用してPythonパッケージをPyPIおよびTestPyPIに公開する手順をメモしました。

実施する前にはPyPITestPyPIのアカウントを作成し、トークンをもらいます。

1. PyPIおよびTestPyPIのAPIトークン設定

まず、PyPIとTestPyPIのAPIトークンをPoetryに設定します。

poetry config pypi-token.pypi "PyPIのAPI Token"
poetry config pypi-token.testpypi "Test PyPIのAPI Token"

2. TestPyPIのリポジトリURLを設定

TestPyPIのリポジトリURLをPoetryプロジェクトに設定します。

poetry config repositories.testpypi https://test.pypi.org/legacy/

3. パッケージのビルド

パッケージを公開する前に、まずビルドを行います。ビルドを実行すると、プロジェクトのルートディレクトリにdist/フォルダが作成され、その中に.whlファイルと.tar.gzファイルが生成されます。

poetry build

4. TestPyPIへの公開

ビルドが完了したら、まずはTestPyPIにパッケージを公開してテストします。

poetry publish -r testpypi

PyPIへの公開

PyPIにパッケージを公開します。

poetry publish

うまくいけば、PyPIページで確認できるようになるはずです。

(アカウント名→自分のプロジェクト)

githubリポジトリがあれば忘れずにつけたほうが良いと思います。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?