pySPM icon indicating copy to clipboard operation
pySPM copied to clipboard

Adopt setuptools_scm for aligning releases with GitHub tags

Open ns-rse opened this issue 9 months ago • 3 comments

setuptools_scm can be used to handle versioning and with an appropriate GitHub Action and configuration of an account can make releases align on GitHub and PyPI.

pySPM uses poetry though, fortunately there is a poetry-setuptools-csm-plugin that we can leverage to integrate which ignores the version listed under tool.poerty.version and instead obtains it dynamically from the Git Tag.

Required actions

According to the documentation for poetry-setuptools-csm-plugin only a single change is required...

  • [ ] Add [tool.setuptools_scm].
  • [ ] [Optional] Remove [tool.poetry.version] as it would be ignored.
  • [ ] Addition of appropriate GitHub Action/workflow (see here).

Possible problems

  • As noted on the plugin page this may be contrary to the Poetry team philosophy.
  • It would require @scholi to setup GitHub as a Trusted publisher

Advantages

  • Releases could be made by tagging a commit here on GitHub (or when a local tag is pushed).
  • PyPI and GitHub releases would be aligned.

ns-rse avatar May 26 '25 05:05 ns-rse

Hi. I have added a workflow and added github as trusted publisher to both PyPi and TestPyPi. It seems that testPyPi is not working now. I will have to dig later on the issue

scholi avatar May 26 '25 20:05 scholi

can we actually test the workflow without pushing them? Here I had to make 4 commits for testing/fixing....

scholi avatar May 26 '25 20:05 scholi

Oh I found a typo and now pushing to test.pypi.org works !

scholi avatar May 26 '25 20:05 scholi