Source code for nvector.skeleton

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This is a skeleton file that can serve as a starting point for a Python
console script. To run this script uncomment the following line in the
entry_points section in setup.cfg:

    console_scripts =
        hello_world = nvector.module:function

Then run `python setup.py install` which will install the command `hello_world`
inside your current environment.
Besides console scripts, the header (i.e. until _logger...) of this file can
also be used as template for Python modules.

Note: This skeleton file can be safely removed if not needed!
"""
from __future__ import division, print_function, absolute_import

import argparse
import sys
import logging

from nvector import __version__

__author__ = "pbrod"
__copyright__ = "pbrod"
__license__ = "none"

_logger = logging.getLogger(__name__)


[docs]def parse_args(args): """ Parse command line parameters :param args: command line parameters as list of strings :return: command line parameters as :obj:`argparse.Namespace` """ parser = argparse.ArgumentParser( description="Just a Hello World demonstration") parser.add_argument( '-v', '--version', action='version', version='nvector {ver}'.format(ver=__version__)) return parser.parse_args(args)
[docs]def main(args): args = parse_args(args) print("Hello World!") _logger.info("Script ends here")
[docs]def run(): logging.basicConfig(level=logging.INFO, stream=sys.stdout) main(sys.argv[1:])
if __name__ == "__main__": run()