pipインストールされたパッケージのライセンスファイルを収集するモジュールです。 pip-licensesを使用します。
Windows 11 Pro
pip install collectlicense
python -m collectlicense --out .licenses --clear
- --out:収集したライセンスファイルの保存先ディレクトリ
- --clear:--outで指定したディレクトリを削除してから収集する
git clone https://github.com/hamacom2004jp/collect-license.git
cd collect-license
python -m venv .venv
.venv\Scripts\activate
python.exe -m pip install --upgrade pip
pip install -r requirements.txt
python -m collectlicense
deactivate
python setup.py sdist
python setup.py bdist_wheel
-
pyplのユーザー登録【本番】 https://pypi.org/account/register/
-
pyplのユーザー登録【テスト】 https://test.pypi.org/account/register/
-
それぞれ2要素認証とAPIトークンを登録
-
ホームディレクトリに
.pypirc
を作成
[distutils]
index-servers =
pypi
testpypi
[pypi]
repository: https://upload.pypi.org/legacy/
username: __token__
password: 本番環境のAPIトークン
[testpypi]
repository: https://test.pypi.org/legacy/
username: __token__
password: テスト環境のAPIトークン
- テスト環境にアップロード
.pyplrc
を作っていない場合はコマンド実行時にusernameとpasswordを要求される 成功するとURLが返ってくる。
twine upload --repository testpypi dist/*
- pipコマンドのテスト
pip install -i https://test.pypi.org/simple/ collectlicense
- 本番環境にアップロード
twine upload --repository pypi dist/*