napari / cookiecutter-napari-plugin

Cookiecutter for napari plugins
BSD 3-Clause "New" or "Revised" License
67 stars 39 forks source link

`setup.cfg` version metadata field vs `__init__.py` `__version__` value #155

Closed dalthviz closed 1 year ago

dalthviz commented 1 year ago

Hi, doing an initial release for a plugin, that used the cookiecutter to generate its initial structure, I noticed that the setup.cfg version doesn't use the __version__ value available at __init__.py. I fixed that on the plugin by changing:

https://github.com/napari/cookiecutter-napari-plugin/blob/d0c893f586c6c041d1d362eedfa7b85f6613a900/%7B%7Bcookiecutter.plugin_name%7D%7D/setup.cfg#L4

To

version: attr: napari_ui_tracer.__version__

Which as a template I think it should be something like:

version: attr: {{cookiecutter.module_name}}.__version__

Is that the correct approach and a fix to do here?

Czaki commented 1 year ago

No. Plugin uses setuptools_scm to determine version. And setuptools_scm both generate _version.py and update plugin metadata.

dalthviz commented 1 year ago

Maybe I experienced this because I didn't use the use_git_tags_for_versioning option which caused the plugin to not get the related setuptools_scm stuff?

https://github.com/napari/cookiecutter-napari-plugin/blob/d0c893f586c6c041d1d362eedfa7b85f6613a900/%7B%7Bcookiecutter.plugin_name%7D%7D/setup.cfg#L3-L5

Just double checking, but if the change explained in the OP is not necessary feel free to close this :+1:

Czaki commented 1 year ago

Ok. You are correct. I miss this variant. I think that it should be fixed.