How to authenticate for index publishing¶
The username is derived from the following sources, in order of precedence:
- The
--user/-ucli option. - The
HATCH_INDEX_USERenvironment variable. - The
repostables. - The
~/.pypircfile. - The input to an interactive prompt.
As a fallback the value __token__ is applied.
The password is looked up in these:
- The
~/.pypircfile if the username was provided by it. - The
--auth/-acli option. - The
HATCH_INDEX_AUTHenvironment variable. - The
repostables. - A variety of OS-level credentials services backed by keyring.
- The input to an interactive prompt.
If interactively provided credentials were used, the username will be stored in Hatch's cache and the password stored in the available keyring backed credentials stores.
For automated releasing to PyPI, it is recommended to use "Trusted Publishing" with OIDC (e.g. PyPA's pypi-publish GitHub Action) or per-project API tokens.