core

PyPI authentication setup: token validation, .pypirc creation, package name availability checks.

Availability check

Check if a package name is available on PyPI before your first upload.


source

check_avail


def check_avail(
    name:str
)->bool:

Check if package name is available on PyPI.

Token validation

Validate a PyPI token by making a lightweight API call to the Simple API.


source

check_token


def check_token(
    token:str
)->bool:

Validate PyPI token with a lightweight API call.

Credentials setup

Create ~/.pypirc with proper permissions. Token sources (in order of preference): 1. Existing .pypirc (return early) 2. PYPI_TOKEN environment variable 3. Interactive input (with helpful link to token creation page)


source

setup_pypirc


def setup_pypirc(
    interactive:bool=True
)->bool:

Ensure ~/.pypirc exists with valid token. Returns True if ready.

Pre-flight checks

Run all checks before uploading to PyPI: credentials, twine, and optionally package name availability.


source

check_ready


def check_ready(
    lib_name:str=None, check_name:bool=False
)->dict:

Pre-flight checks for PyPI upload. Returns dict with ‘ready’ bool and ‘issues’ list.

Main entry point

One function to ensure everything is ready for PyPI uploads. Handles setup interactively if needed.


source

setup_pypi


def setup_pypi(
    lib_name:str=None, check_name:bool=False, interactive:bool=True
)->bool:

Ensure PyPI is ready: credentials + pre-flight checks. Returns True if ready.