Como solucionar Poetry publish HTTP Error 403: Invalid or non-existent authentication information

Problema:

Cuando ejecutas poetry publish, obtienes un error como este:

poetry_publish_403_error_output.txt
Publishing UliEngineering (0.4.19) to PyPI
 - Uploading uliengineering-0.4.19-py3-none-any.whl FAILED

HTTP Error 403: Invalid or non-existent authentication information. See https://pypi.org/help/#invalid-auth for more information. | b'<html>\n <head>\n  <title>403 Invalid or non-existent authentication information. See https://pypi.org/help/#invalid-auth for more information.\n \n <body>\n  <h1>403 Invalid or non-existent authentication information. See https://pypi.org/help/#invalid-auth for more information.\n  Access was denied to this resource.<br/><br/>\nInvalid or non-existent authentication information. See https://pypi.org/help/#invalid-auth for more information.\n\n\n \n'

Solución

Inicia sesion en PyPI con poetry (el mensaje de error te dice que inicies sesion de nuevo, incluso si ya has iniciado sesion). Necesitas el PyPI API token para esto, no tu contrasena de PyPI. Si no tienes un token, crea uno en PyPI.

poetry_config_token.sh
poetry config pypi-token.pypi pypi-.....

Luego, intenta publicar de nuevo:

poetry_publish_build.sh
poetry publish --build

Echa un vistazo a artículos similares por categoría: Python