ome / omero-cli-zarr

https://pypi.org/project/omero-cli-zarr/
GNU General Public License v2.0
16 stars 10 forks source link

Use versioneer for tagging (Fix #154) #156

Closed joshmoore closed 10 months ago

joshmoore commented 11 months ago

Move to the use of https://github.com/python-versioneer/python-versioneer for defining a version from the current tag. This also removes the need to use bump2version, therefore releases can be handled completely from the GH UI.

cc: @will-moore

will-moore commented 11 months ago

Versioneer looks nice. So the release steps (currently https://ome-contributing.readthedocs.io/en/latest/python-development.html) are now:

joshmoore commented 11 months ago

struggling with pre-commit here. options are:

jburel commented 11 months ago

Is it a workflow that you see rolling out to other repositories when ready?

joshmoore commented 11 months ago

Not sure. Happy to discuss. The two big benefits are:

If you need to have version strings updated anywhere else, though, this won't do it for you.

joshmoore commented 11 months ago

So the release steps ... are now:

More like either:

Or:

joshmoore commented 11 months ago

Pushed another attempt. Apparently the import versioneer in setup.py leads to mypy checking it no matter what (unless follows are disabled). This just ignores setup.py as a (temporary?) fix. See https://github.com/pre-commit/pre-commit/issues/2936 which convinced me that the excludes should work.

joshmoore commented 11 months ago

We should really settle on one of these two:

image

joshmoore commented 11 months ago

Discussing with @will-moore and @jburel, this looks to be working. You can also test locally with:

$ python setup.py version
running version
keywords are unexpanded, not using
got version from VCS {'version': '0.5.4+9.gb243a8d', 'full-revisionid': 'b243a8d3f49b344c209594e2967cf545f10dea77', 'dirty': False, 'error': None, 'date': '2023-12-07T12:01:13+0100'}
Version: 0.5.4+9.gb243a8d
 full-revisionid: b243a8d3f49b344c209594e2967cf545f10dea77
 dirty: False
 date: 2023-12-07T12:01:13+0100
jburel commented 11 months ago

One key difference is that we now need to have 2 Python files included in the project tree _version.py and versionner.py. This should be indicated in the README since those files are solely for version and have nothing to do with the plugin itself.

joshmoore commented 11 months ago

At least for versioneer.py, it's possible to choose not to check it in, but that requires installing the versioneer library at runtime.

So what's the next step here?

will-moore commented 11 months ago

I'm needing to use this PR now to continue to export from IDR, and it's working. So I'm in favour of getting it merged ASAP and released to fix the current broken release.

I think @jburel was just wanting some mention of the versioneer changes in the README?

jburel commented 11 months ago

For versionner.py, I think we should keep it out. The other one is a config file similar to the one used by bump2version

joshmoore commented 11 months ago

Following from https://github.com/ome/omero-cli-zarr/pull/157#issuecomment-1875434580, @jburel, you're saying that you want me to introduce a dependency on the versioneer library here? You can find out more about the "experimental build-time dependency mode" here: https://github.com/python-versioneer/python-versioneer?tab=readme-ov-file#build-time-dependency-mode

joshmoore commented 10 months ago

Closing in favor of #159 for the moment.