uktrade / stream-zip

Python function to construct a ZIP archive on the fly
https://stream-zip.docs.trade.gov.uk/
MIT License
101 stars 9 forks source link

Incorrect version number in the latest tag #136

Closed avalentino closed 1 month ago

avalentino commented 1 month ago

The version in the pyproject.toml file in the latest tag (v0.0.81) is 0.0.0.dev0. This seems to be not in line with the source distribution published in pypi. Is this expected?

michalc commented 1 month ago

It is expected yes.

The 0.0.0.dev0 is replaced by the release process just before publish to pypi https://github.com/uktrade/stream-zip/blob/main/.github/workflows/deploy-package-to-pypi.yml#L19. Have to admit I've not seen this done elsewhere, but it makes releasing new versions very straightforward: we make a release in GitHub with no code change involved.

Is this causing a problem? (/do you have a better way?)

avalentino commented 1 month ago

I'm packaging stream-zip for debian and the generated package has the version number that is in the pyproject.toml file, the incorrect one.

The current workaround is to patch the sources I would like to avoid to do it in the long term.

The option of using directly the source tarball in pypy (rather then the one in the github tag) is also problematic for me because the pypi tarball does not include, e.g., the test suite.

michalc commented 1 month ago

Ah I think understood… Will have a ponder on how best to approach this - I am quite keen to avoid having to manually change the version in code each time though, but also I have liked the ease at which I can just make a GitHub release and PyPI is automatically deployed to

michalc commented 1 month ago

Actually a question: do you have to take the code from a tag, or could you take from another asset from releases: https://github.com/uktrade/stream-zip/releases

So we can do any faffing with the version in code at our end rather than yours

avalentino commented 1 month ago

Using releases should be fine

michalc commented 1 month ago

After a few false starts, now have a "Source code (with release version)" asset in new releases which is all of the source code, but with the correct version in pyproject.toml, e.g. at https://github.com/uktrade/stream-zip/releases/tag/v0.0.82

avalentino commented 1 month ago

Thanks a lot @michalc I have just tested the packaging of the new release and all works perfectly without patching the version number. Closing

stuaxo commented 1 month ago

In Shoebot when we had a similar thing with versions, I ended up adding a unit test that failed if the versions wheren't synced (not pyproject.toml there, but setup.py as our project is old)