Making a python package

Question:
I wanted to make a python package on replit so I read an article ( https://replit.com/talk/learn/isaiah08-Okay/125214 ). I followed all the steps but I got an error.
** The code I ran **
I ran:

poetry update
poetry build
poetry publish

After I ran poetry publish it gave me this error:

Publishing useful-classes (0.1.0) to PyPI
 - Uploading useful_classes-0.1.0-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'

Could someone help me with this issue?

I believe you need to add --username <username> --password <password> (or -u <username> -p <password>) with details for your PyPI account to the publish command (do not post your username or password here or anywhere public).

2 Likes

I can speak from experience that PyPi uploads with poetry build; poetry publish should work just fine. You shouldn’t need to provide any login information in the command (and I wouldn’t recommend it either). It will prompt you with the proper login stuff. I assume that you entered the correct username and password? Passwords are case sensitive and usernames might be too.

2 Likes

Publishing any kind of package will not work. Honestly just do it on your own PC with Python, pip, wheel and twine. For more info, click here. Should work, atleast for me.

I tried on my own pc with pip, got some random errors so I just made it on Replit ¯\_(ツ)_/¯

Well, when I tried to publish a Python package in Replit, it just popped up an error that I don’t remember anymore. When I published dialogx to PyPI in my PC, it worked!

IDK where you’re getting your info (personal experience, perhaps?). I’ve published over 20 releases of my PyPi package from a Repl. I didn’t set up the Repl though; @bigminiboss did it for me. Supposedly, it’s easy, but I can’t say for sure since I only wrote the Python and didn’t configure the Repl. If you’d like, you can look at my Repl to see how it’s set up. Perhaps you could structure yours the same to make it work.

4 Likes

Yea… I thought everyone and mine’s experience was the same… :\

1 Like

It is! (Just take a look at my pypi package guide, the publishing section)

1 Like

Might be a bit late, but once your file structure is correct, use poetry build. poetry publish seemed to remember when I used incorrect login details, and I couldn’t use that, but no matter. Install twine, then use twine upload dist/* to upload it. Worked fine for me. Twine had problems building the package, so I used poetry. It works 100%, and is a tried and tested method (by me).

2 Likes

Honestly, I recommend using poetry. Then you can use tokens from Secrets, so you don’t even have to remember login details.

3 Likes