from setup_pypi import setup_pypi
setup_pypi()setup-pypi
One command to configure PyPI uploads on any host.
Install
pip install setup-pypiUsage
The main entry point is setup_pypi(). It ensures your host is ready to upload packages to PyPI.
If ~/.pypirc doesn’t exist, it will: 1. Look for PYPI_TOKEN in your environment 2. If not found, prompt you interactively (with a link to create a token) 3. Validate the token before saving
Check package name availability
Before your first upload, check if your desired package name is available:
from setup_pypi import check_avail
check_avail('my-cool-package')Or combine with setup in one call:
setup_pypi('my-cool-package', check_name=True)Pre-flight checks only
To check readiness without interactive setup:
from setup_pypi import check_ready
check_ready()Development
To work on setup-pypi itself, first clone the repo, then install in editable mode:
!pip install -e .Environment variables
| Variable | Description |
|---|---|
PYPI_TOKEN |
Your PyPI API token (starts with pypi-). Used if ~/.pypirc doesn’t exist. |
IN_SOLVEIT |
If set, shows SolveIT-specific tips during interactive setup. |
Reference
| Function | Description | Example |
|---|---|---|
setup_pypi(lib_name, check_name, interactive) |
Full setup + checks | setup_pypi('mylib', check_name=True) |
setup_pypirc(interactive) |
Create ~/.pypirc only |
setup_pypirc() |
check_ready(lib_name, check_name) |
Pre-flight checks (no setup) | check_ready('mylib', check_name=True) |
check_avail(name) |
Check PyPI name availability | check_avail('mylib') → True/False |
check_token(token) |
Validate a PyPI token | check_token('pypi-...') → True/False |