Problem uploading new version ti PyPi with twine

Hi,

I’m trying to upload a new version of a library where I’m the owner (https://pypi.org/manage/project/pymodis/) but I get a strange error. It seems related to the library name but I don’t know what to do…

twine upload --verbose dist/*
INFO     Using configuration from /home/lucadelu/.pypirc                        
Uploading distributions to https://upload.pypi.org/legacy/
INFO     dist/pyModis-2.4.1.linux-x86_64.tar.gz (116.4 KB)                      
INFO     username set from config file                                          
INFO     password set from config file                                          
INFO     username: __token__                                                    
INFO     password: <hidden>                                                     
Uploading pyModis-2.4.1.linux-x86_64.tar.gz
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 125.1/125.1 kB • 00:00 • 583.1 kB/s
INFO     Response from https://upload.pypi.org/legacy/:                         
         400 Start filename for 'pyModis' with 'pymodis'.                       
INFO     <html>                                                                 
          <head>                                                                
           <title>400 Start filename for 'pyModis' with 'pymodis'.</title>      
          </head>                                                               
          <body>                                                                
           <h1>400 Start filename for 'pyModis' with 'pymodis'.</h1>            
           The server could not comply with the request since it is either      
         malformed or otherwise incorrect.<br/><br/>                            
         Start filename for &#x27;pyModis&#x27; with &#x27;pymodis&#x27;.       
                                                                                
                                                                                
          </body>                                                               
         </html>                                                                
ERROR    HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/        
         Start filename for 'pyModis' with 'pymodis'. 

could it be the case … seems server is expecting pymodis instead of pyModis

But why?

My package is called pyModis, can I change this somewhere?

This seems strange to me… How was this file created? It does not seem to be a valid sdist file name (nor a valid wheel name obviously).

pyModis-2.4.1.linux-x86_64.tar.gz is not a valid sdist name; I believe it’s a “dumb” installer created by some now-deprecated setup.py command. An actual sdist would be named something like pyModis-2.4.1.tar.gz. In order to create an sdist, you need to install build and run python3 -m build in your project repository.

1 Like

running python3 -m build it works properly, thanks a lot for suggestion

Out of curiosity, what were you doing?

python3 setup.py build

has I did until 2022 (last release before this)

Ah, well. It’s long been deprecated. Also note that you have no pyproject.toml which is strongly discouraged as well.

thanks a lot, I added it

@lucadelu The packaging metadata that you have now added in the [project] table of pyproject.toml can be removed from setup.py. No need to have these values duplicated in the source code tree. (I assumed the source code repository is this one).

1 Like

Although, now looking again at your setup.py, things might not be as straightforward as initially thought. It seems like some packaging metadata values are dynamic. The list of dependencies and the version string at least, right?