check:pypi

Verify PyPI credentials from the .env file.


Usage

splent check:pypi [--test]

Examples

Check against PyPI (default):

splent check:pypi

Check against TestPyPI:

splent check:pypi --test

Options

Option Description
--test Verify against TestPyPI instead of PyPI.

Description

Reads TWINE_USERNAME and TWINE_PASSWORD (or PYPI_PASSWORD) from the environment and:

  1. Checks both variables are present.
  2. Validates the token format (must start with pypi- when using __token__).
  3. Sends a minimal POST to the PyPI upload endpoint to verify credentials:
    • HTTP 400 → credentials valid (upload rejected due to empty payload, as expected).
    • HTTP 401 / 403 → credentials invalid or expired.

The password is masked in the output.

Example output

📦 PyPI Credentials Check

[✔] TWINE_USERNAME = __token__
[✔] TWINE_PASSWORD = pypi-****...****TA
[✔] Token format looks correct (pypi-...)

Contacting PyPI API...
[✔] Credentials valid (PyPI returned 400 — expected for empty upload)

✅ PyPI credentials OK (PyPI).

Requirements

Variable Description
TWINE_USERNAME Usually __token__ for API token auth.
TWINE_PASSWORD PyPI API token (starts with pypi-).

Generate a token at: pypi.org/manage/account/#api-tokens


Back to top

splent. Distributed by an LGPL license v3. Contact us: drorganvidez@us.es