check:pypi

Introduction

check:pypi checks the PyPI credentials in your workspace .env. It sends the same probe the release gate sends, so the two never disagree, and it publishes nothing. Run it before a release.

splent check:pypi
PyPI Credentials Check

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

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

PyPI credentials OK (PyPI).

A 400 is the expected refusal of an upload with no file, so it means the credentials work. splent doctor runs it in its Credentials section.


Checking TestPyPI

splent check:pypi --test

The same probe goes to TestPyPI instead of PyPI.


Reading the answer

Answer Meaning
200 or 400 The credentials are valid
401 or 403 The credentials are invalid or expired. Create a new token
429 PyPI is rate limiting the account. The credentials are not the problem, and uploads fail until the limit clears
Anything else, another 2xx included No verdict. The command fails, as a release would

Every failure exits 1. A username of __token__ with a password that does not start with pypi- is a warning.

It names no project, so it cannot see the limit on creating new projects.


Reference

Variable Description
TWINE_USERNAME __token__ for an API token. PYPI_USERNAME is read when it is unset
TWINE_PASSWORD The PyPI API token, starting with pypi-. PYPI_PASSWORD is read when it is unset

Create a token at pypi.org/manage/account/#api-tokens and store it with splent env:set pypi. The password prints masked, as **** under 12 characters and otherwise with at most its first and last four characters.


Back to top

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