Currently, setting up a deployment on GitHub Actions as part of CI / CD Seems to be a best practice.
This method leaves a note as a workaround for testing and trouble.
Place .pypirc (PyPi's account config file) in ~ /. The contents are as stated below:
[pypirc]
servers =
pypi
testpypi
[pypi]
repository: https://upload.pypi.org/legacy/
username: __token__
password: (API token)
[testpypi]
repository: https://test.pypi.org/legacy/
username: __token__
password: (API token)
Execute the following command in the virtual environment where Twine is installed.
twine upload --repository pypi dist/*
Reference: Uploading the distribution archives | Packaging Python Projects — Python Packaging User Guide
It is convenient to register the following in the Pipfile.
[scripts]
clear = "rm -rf yamldataclassconfig.egg-info/* build/* dist/*"
build = "python setup.py sdist bdist_wheel"
deploy = "twine upload --repository pypi dist/*"
Then execute the command as follows.
pipenv run clear
pipenv run build
pipenv run deploy
Recommended Posts