Python CLI application display version using the --version
argument.
What is the right way to store that information ? Argparse has an argument for that
import argparse
parser = argparse.ArgumentParser(prog='PROG')
parser.add_argument('--version', action='version', version='%(prog)s 2.0')
parser.parse_args(['--version'])
But I am not convinced it is the right way to do it. I'm thinking about storing the version in a file so it can be maintained by the build pipeline but it should be protected so users can't modify it.