abichinger / semantic-release-pypi

semantic-release plugin to publish a python package to PyPI
MIT License
26 stars 11 forks source link

Need help to get a poetry project published correctly #36

Closed tboerger closed 3 months ago

tboerger commented 3 months ago

Hi, thanks for this project, hopyfully I can properly use this soonish. I've got a release config at https://github.com/gopad/gopad-python/blob/eb7fbbfa0b53c75717c28e190e1f1d25e912b2cf/.releaserc which should update/generate an OpenAPI client automatically and afterwards publish to PyPi, but the semantic-release-pypi step fails as it's not generating a valid version like v1.0.0 and builds v0.0.0 instead which can't get uploaded:

https://github.com/gopad/gopad-python/actions/runs/9253717848/job/25453996707

[11:03:29 AM] [semantic-release] [semantic-release-pypi] › ℹ  Build source archive
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
  - poetry-core>=1.0.0
  - poetry-dynamic-versioning
* Getting build dependencies for sdist...
* Building sdist...
Successfully built gopad-0.0.0.post72+f4ec99d.tar.gz
[11:03:31 AM] [semantic-release] [semantic-release-pypi] › ℹ  Build wheel
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
  - poetry-core>=1.0.0
  - poetry-dynamic-versioning
* Getting build dependencies for wheel...
* Building wheel...
Successfully built gopad-0.0.0.post72+f4ec99d-py3-none-any.whl
[11:03:34 AM] [semantic-release] › ✔  Completed step "prepare" of plugin "semantic-release-pypi"
[11:03:34 AM] [semantic-release] › ℹ  Start step "prepare" of plugin "@semantic-release/git"
[11:03:34 AM] [semantic-release] [@semantic-release/git] › ℹ  Found 1 file(s) to commit
[11:03:35 AM] [semantic-release] [@semantic-release/git] › ℹ  Prepared Git release: v1.0.0
[11:03:35 AM] [semantic-release] › ✔  Completed step "prepare" of plugin "@semantic-release/git"
[11:03:35 AM] [semantic-release] › ℹ  Start step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[11:03:35 AM] [semantic-release] › ✔  Completed step "generateNotes" of plugin "@semantic-release/release-notes-generator"
[11:03:35 AM] [semantic-release] › ℹ  Start step "generateNotes" of plugin "@semantic-release/exec"
[11:03:35 AM] [semantic-release] › ✔  Completed step "generateNotes" of plugin "@semantic-release/exec"
[11:03:36 AM] [semantic-release] › ✔  Created tag v1.0.0
[11:03:36 AM] [semantic-release] › ℹ  Start step "publish" of plugin "@semantic-release/exec"
[11:03:36 AM] [semantic-release] › ✔  Completed step "publish" of plugin "@semantic-release/exec"
[11:03:36 AM] [semantic-release] › ℹ  Start step "publish" of plugin "semantic-release-pypi"
[11:03:36 AM] [semantic-release] [semantic-release-pypi] › ℹ  Publishing package to https://upload.pypi.org/legacy/
Uploading distributions to https://upload.pypi.org/legacy/
INFO     dist/gopad-0.0.0.post72+f4ec99d-py3-none-any.whl (53.5 KB)             
INFO     dist/gopad-0.0.0.post72+f4ec99d.tar.gz (30.4 KB)                       
INFO     username set by command options                                        
INFO     password set by command options                                        
INFO     username: __token__                                                    
INFO     password: <hidden>                                                     
Uploading gopad-0.0.0.post72+f4ec99d-py3-none-any.whl
25l
  0% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/62.1 kB • --:-- • ?
  0% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/62.1 kB • --:-- • ?
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.1/62.1 kB • 00:00 • 165.4 MB/s
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.1/62.1 kB • 00:00 • 165.4 MB/s
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.1/62.1 kB • 00:00 • 165.4 MB/s
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.1/62.1 kB • 00:00 • 165.4 MB/s
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.1/62.1 kB • 00:00 • 165.4 MB/s
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.1/62.1 kB • 00:00 • 165.4 MB/s
25hINFO     Response from https://upload.pypi.org/legacy/:                         
         400 The use of local versions in <Version('0.0.0.post72+f4ec99d')> is  
         not allowed. See                                                       
         https://packaging.python.org/specifications/core-metadata for more     
         information.                                                           
INFO     <html>                                                                 
          <head>                                                                
           <title>400 The use of local versions in                              
         <Version('0.0.0.post72+f4ec99d')> is not allowed. See                  
         https://packaging.python.org/specifications/core-metadata for more     
         information.</title>                                                   
          </head>                                                               
          <body>                                                                
           <h1>400 The use of local versions in                                 
         <Version('0.0.0.post72+f4ec99d')> is not allowed. See                  
         https://packaging.python.org/specifications/core-metadata for more     
         information.</h1>                                                      
           The server could not comply with the request since it is either      
         malformed or otherwise incorrect.<br/><br/>                            
         The use of local versions in                                           
         &lt;Version(&#x27;0.0.0.post72+f4ec99d&#x27;)&gt; is not allowed. See  
         https://packaging.python.org/specifications/core-metadata for more     
         information.                                                           

          </body>                                                               
         </html>                                                                
ERROR    HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/        
         The use of local versions in <Version('0.0.0.post72+f4ec99d')> is not  
         allowed. See https://packaging.python.org/specifications/core-metadata 
         for more information.                                                  
[11:03:38 AM] [semantic-release] › ✖  Failed step "publish" of plugin "semantic-release-pypi"

I'm not a python developer, so I'm not sure if the poetry and poetry-dynamic-versioning is right here. I hope somebody could give me the right hints to get this release process working.

abichinger commented 3 months ago

Hi,

according to the log semantic-release-pypi set the version to 1.0.0 inside the tool.poetry section.

...
Poetry package detected
Set version to 1.0.0 (./pyproject.toml)
...

I assume that afterwards the version was set to 0.0.0 by poetry-dynamic-versioning. Please uninstall poetry-dynamic-versioning and try again.

tboerger commented 3 months ago

Thanks, looks like indeed dynamic versioning have been the only issue.