In Python, you can upload the library you created to PyPI
for easier installation with pip
.
At this time, it is usually necessary to manually enter the user name and password in the console when uploading, but if you issue an API token, you can omit these user names and passwords.
pipenv install --dev wheel twine
Put wheel
and twine
in dev for packaging and uploading.
wheel is a form of package and a library for creating that form. (Like a gem)
twine is a library for uploading to PyPI.
When uploading, I use the following shell script.
#!/usr/bin/env bash
rm -f -r {your-library-name}.egg-info/* dist/*
python setup.py bdist_wheel
twine upload dist/*
At this time, you need to enter the user name and password when using twine.
It can be issued from Add API token.
After issuing the API token, put the following contents in your home directory as ~/.pypirc
.
.pypirc
[pypirc]
servers =
pypi
[pypi]
username: __token__
password: your_token
__token__
is a name that feels like putting tokens with different names individually, but you can just type __token__
in plain text as it is.
For password, you need to set it, and you need to write the API token issued earlier.
Recommended Posts