ome / ome-model

OME model (specification, code generator, implementation)
Other
13 stars 26 forks source link

ome-model: allow to introspect version #123

Closed sbesson closed 3 years ago

sbesson commented 4 years ago

Discussed with @manics and @joshmoore, this PR adds some logic to setup.py to write the current module version under ome_model/version.py using the __version___ attribute - see https://www.python.org/dev/peps/pep-0396/. If __init__.py or another variable name is preferable, I have no strong opinion but I was not able to find a PEP authoritatively defining the recommended behavior.

The module is also updated to store ome_model x.y.z[.dev0] in the OME.Creator attribute similarly to the implementation in Bio-Formats - see https://github.com/ome/bioformats/pull/2207.

jburel commented 4 years ago

We have multiple variations of the version set up. e.g. https://github.com/ome/omero-py/blob/master/src/omero_version.py (name variations for https://github.com/ome/omero-web/blob/master/omeroweb/version.py)

Web apps followed the approach first introduced in mapr: https://github.com/ome/omero-mapr/blob/master/omero_mapr/__init__.py and https://github.com/ome/omero-mapr/blob/master/omero_mapr/utils/version.py see https://www.python.org/dev/peps/pep-0440/

I do not have strong opinion. I think we need to stick to one across the various repos

jburel commented 4 years ago

since you are adjusting setup.py, you may want to fix the classifier i.e. 'Programming Language :: Python :: 2', does not match the python version requires

sbesson commented 4 years ago

Pushed a couple of commits to update a few classifiers.

Answering the version management heterogeneity:

If we choose to standardize, my personal inclination would be to define __version__ either in <module>/__init__.py or <module>/version.py as per the PEP mentioned above. Obviously individual packages can choose to have this version also defined in another module and using another name esp. to preserve backwards compatibility.

/cc @joshmoore @manics

joshmoore commented 4 years ago

to preserve backwards compatibility

Certainly for omero-web and omero-py these are part of the public API. I could see having the value that is imported into <module>/__init__.py be the thing we want to standardize on, but that doesn't solve the question of where to generate the value to.

sbesson commented 4 years ago

Giving until tomorrow EOB for another round of discussions or alternate proposals and then I'll move forward with the release of ome-model 6.2.0.