gwastro / pycbc

Core package to analyze gravitational-wave data, find signals, and study their parameters. This package was used in the first direct detection of gravitational waves (GW150914), and is used in the ongoing analysis of LIGO/Virgo data.
http://pycbc.org
GNU General Public License v3.0
307 stars 344 forks source link

Add a standard --version option to common pycbc options #4811

Closed GarethCabournDavies closed 3 days ago

GarethCabournDavies commented 1 week ago

Add an option to give --version information, allowing the user to specify how verbose the information is

Standard information about the request

This is a code management improvement This change touches all areas of the codebase This change affects no output except the versioning page on reults pages

This change follows style guidelines (See e.g. PEP8), has been proposed using the contribution guidelines

Motivation

This, along with the logging standardization changes previously made, should make it easier to contribute to PyCBC, particularly if making a new executable

Contents

Removed all cases of '--version' arguments being added to a parser when add_common_pycbc_options is used

Modify (and rename) the pycbc.version.Version class to be able to take in a modifier defining how verbose the library version information is.

Testing performed

Various executables run with --help and --version, --version 0, --version 1, --version 2, --version 3 as appropriate

The CI will confirm if I have removed an import pycbc.version when it is needed for an implicit pycbc import - which I probably have

Next steps for testing are to run the pycbc_page_versioning script with every executable as input, and modify it to have some of the more verbose version information at the top (probably the first executable will be given the modifier)

Additional notes

I have avoided pycbc_live, for a similar reason to why I have not touched it in the logging changes ; I do not want to damage any of the codes which work on the output of that

titodalcanton commented 4 days ago

I made it through 160 files! This looks mostly ok but I left some comments above; some of them can be grouped into a single "there are more things you can remove" comment.