Open danpovey opened 3 years ago
k2 has Python APIs to get its git hash indicating based on which commit it was built, though those APIs have not been exported to k2; they are only available through _k2 at present.
I don't think I have anything to indicate the git hash in Lhotse, not sure if there's a way to do it in general for pip-installed packages (think installed either through PyPI or pip install git+https://...
)? Lhotse has no native code so there is no "build" unlike in K2. I'll keep thinking about it but I'm open to suggestions. Just using import lhotse; lhotse.__version__
is probably too broad as a lot changes between the releases...
I think it is doable for Lhotse. Will try to find a way. The basic idea is to create some file containing the git hash during installation and remove the file from the source tree during post installation.
Please see https://github.com/k2-fsa/k2/pull/688 as an example.
From https://github.com/k2-fsa/k2/pull/688#discussion_r599631354
I'll wait for someone else to add related features to snowfall though, e.g. to print such info at the start of logs.
The relevant APIs from k2 can be found at https://github.com/k2-fsa/k2/pull/688#issue-597113143
>>> import k2
>>> k2.__version__
'0.3.3'
>>> k2.__dev_version__
'0.3.3.dev20210320'
>>> k2.__build_type__
'Release'
>>> k2.__git_sha1__
'5ee74c7e22340f26788894a224b0cadcc2f9c898'
>>> k2.__git_date__
'Thu Mar 18 22:22:17 2021'
I don't think I have anything to indicate the git hash in Lhotse, not sure if there's a way to do it in general for pip-installed packages (think installed either through PyPI or
pip install git+https://...
)? Lhotse has no native code so there is no "build" unlike in K2. I'll keep thinking about it but I'm open to suggestions. Just usingimport lhotse; lhotse.__version__
is probably too broad as a lot changes between the releases...
Perhaps something like https://github.com/python-versioneer/python-versioneer could help here. Judging by the README, it seems to be able to support both PyPI installed and pip install git+https://...
installed packages and also with --editable
.
FYI: git commit in setup.py in Lhotse https://github.com/lhotse-speech/lhotse/pull/291
It would be nice if we could print version information to make it easier to reproduce experiments and load trained models. I am thinking of printing things like git branch and git hash if available, of snowfall; and version information of lhotse and k2. I don't know if there is a standard way to get these?