Skip to content

Instantly share code, notes, and snippets.

@fleetingbytes
Last active March 11, 2022 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fleetingbytes/9a6540d64762af5b409dd2e08da2b02c to your computer and use it in GitHub Desktop.
Save fleetingbytes/9a6540d64762af5b409dd2e08da2b02c to your computer and use it in GitHub Desktop.
PyPI deployment
* 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