Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble with the packaging tutorial #841

Open
ekohilas opened this issue Nov 14, 2024 · 6 comments
Open

Trouble with the packaging tutorial #841

ekohilas opened this issue Nov 14, 2024 · 6 comments

Comments

@ekohilas
Copy link

OS version

Ubuntu

Python version

Python 3.12.0

Pip version

pip 24.3.1

Guide link

https://packaging.python.org/tutorials/packaging-projects

Problem description

The guide says to type in __token__ and enter the api key as the password, however:

  1. typing in __token__ doesn't appear on the command line
  2. the password is not asked for
  3. a 403 is returned

Error message

$ python3 -m twine upload --repository testpypi dist/* --verbose
Uploading distributions to https://test.pypi.org/legacy/
INFO     dist/example_package_ekohilas-0.0.1-py3-none-any.whl (2.7 KB)                              
INFO     dist/example_package_ekohilas-0.0.1.tar.gz (2.1 KB)                                        
INFO     Querying keyring for password                                                              
Enter your API token: 
INFO     username: __token__                                                                        
INFO     password: <hidden>                                                                         
Uploading example_package_ekohilas-0.0.1-py3-none-any.whl
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.2/6.2 kB • 00:00 • ?
INFO     Response from https://test.pypi.org/legacy/:                                               
         403 Forbidden                                                                              
INFO     <html>                                                                                     
          <head>                                                                                    
           <title>403 Invalid or non-existent authentication information. See                       
         https://test.pypi.org/help/#invalid-auth for more information.</title>                     
          </head>                                                                                   
          <body>                                                                                    
           <h1>403 Invalid or non-existent authentication information. See                          
         https://test.pypi.org/help/#invalid-auth for more information.</h1>                        
           Access was denied to this resource.<br/><br/>                                            
         Invalid or non-existent authentication information. See                                    
         https://test.pypi.org/help/#invalid-auth for more information.                             
                                                                                                    
                                                                                                    
          </body>                                                                                   
         </html>                                                                                    
ERROR    HTTPError: 403 Forbidden from https://test.pypi.org/legacy/                                
         Forbidden
@ekohilas
Copy link
Author

@ekohilas
Copy link
Author

When .pypirc is used, the package uploads successfully.

@merwok
Copy link

merwok commented Nov 14, 2024

Did you create an account and API token on Test PyPI?

I don’t understand points 1 and 2, as we see the input request in your log, unless I misread it. Maybe you can give more info, or look for a known problem in the twine repo.

@ekohilas
Copy link
Author

Did you create an account and API token on Test PyPI?

Yes, I was able to successfully upload this package once using a .pypirc

I don’t understand points 1 and 2, as we see the input request in your log, unless I misread it.

Enter your API token: 
INFO     username: __token__ 

the __token__ part only appears in --verbose mode.

I don't expect the Enter your API token: query to hide the contents of __token__, and I expect for there to at least be a password query (which is never the case)

or look for a known problem in the twine repo.

Will take a look thanks!

@ekohilas
Copy link
Author

pypa/twine#1177

@sigmavirus24
Copy link
Member

The guide seems to not have been updated for Publishing to PyPI since PyPI started requiring tokens and twine stopped prompting for a username. So following the guide literally one might enter the string __token__ when prompted for the API token instead of providing the token itself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants