Last active
March 11, 2022 15:58
-
-
Save fleetingbytes/9a6540d64762af5b409dd2e08da2b02c to your computer and use it in GitHub Desktop.
PyPI deployment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* create virtual environment `python -m venv /path/to/venv` | |
* activate venv | |
* python -m pip install --upgrade pip | |
* pip install twine | |
* pip install wheel | |
* python setup.py sdist bdist_wheel | |
* ls dist | |
* make sure you have the TestPyPI and PyPI repository URLs in your ~/.pypirc | |
* make sure you have the path to your certificate bundle in your ~/.pypirc | |
```.pypirc | |
[distutils] | |
index-servers = | |
testpypi | |
pypi | |
cert = <path to your certificate bundle> | |
[testpypi] | |
repository = https://test.pypi.org/legacy/ | |
username = __token__ | |
password = <your token> | |
[pypi] | |
repository = https://upload.pypi.org/legacy/ | |
username = __token__ | |
password = <your token> | |
``` | |
* python -m twine upload --repository testpypi dist/* | |
Test if the package can be installed via pip. | |
* check if your pip.ini has proxies and certificates, e.g. | |
```pip.ini | |
[global] | |
proxy = <your proxy> | |
trusted-host = pypi.org | |
test.pypi.org | |
pypi.python.org | |
files.pythonhosted.org | |
test-files.pythonhosted.org | |
cert = <path to your certificate bundle> | |
``` | |
* pip install <your package> --index-url https://test.pypi.org/simple/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment