cctbx_project icon indicating copy to clipboard operation
cctbx_project copied to clipboard

Make cctbx_project version number programmatically accessible

Open Anthchirp opened this issue 3 years ago • 2 comments

Could we please have a way to programmatically determine the installed cctbx_project package version?

I'm thinking something along the lines of

__version_tuple__ = (2020, 11)
__version__ = ".".join(str(_n) for _n in __version_tuple__)

in eg. cctbx/__init__.py or maybe libtbx (I hold no opinion here)

and then please add a pointer to that variable to the call in https://github.com/cctbx/cctbx_project/blob/7590911b8ea11f82f9e0c8ecd1e818d0eb090d38/scitbx/libtbx_refresh.py#L25-L31 to the equivalent of libtbx.pkg_utils.define_entry_points(..., version="2020.11").

Would be nice to have that in the November+ 2020 release.

Anthchirp avatar Nov 11 '20 12:11 Anthchirp

You can now get the version with

from libtbx.version import get_version
version = get_version()

The version is basically the date of the latest commit and additional information from git describe.

bkpoon avatar Apr 13 '21 21:04 bkpoon

I can see that being useful.

However, could we please also have a way to programmatically determine the installed cctbx_project package version number? Ideally, this would be in a top level __version__ field, as that is sort of the convention, eg.

>>> import numpy
>>> numpy.__version__
'1.19.4'
>>> import matplotlib
>>> matplotlib.__version__
'3.3.3'

Anthchirp avatar Jun 30 '21 10:06 Anthchirp