Skip to main content

Command Line Tool for Python

Project description

COLT: COmmand Line Tool

Simple, extensible tool to create out of the box input files and commandline interfaces for Python, that are type validated. For the input file the ini file-format is used around Python’s configparser.

PyPI version fury.io PyPI download month PyPI license PyPI implementation

Features

  1. Build simple commandline interfaces using the FromCommandline-decorator

# examples/commandline_xrange.py
from colt import from_commandline


@from_commandline("""
# start of the range
xstart = :: int :: >0
# end of the range
xstop = :: int :: >1
# step size
step = 1 :: int
""")
def x_range(xstart, xstop, step):
   for i in range(xstart, xstop, step):
      print(i)

if __name__ == '__main__':
   x_range()
usage: commandline_xrange.py [-h] [-step step] xstart xstop

positional arguments:
   xstart      int, Range(>0)
               start of the range
   xstop       int, Range(>1)
               end of the range

optional arguments:
   -h, --help  show this help message and exit
   -step step  int,
               step size

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

History

0.4.0 (2021-6-9)

  • New commandline parser instead of argparse:
    • correct handling of multiple subparser

    • correct parsing of infinit arguments using the list(typ) syntax

    • fully customizable help settings

0.1.0 (2020-8-1)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycolt-0.6.0.tar.gz (69.4 kB view hashes)

Uploaded Source

Built Distribution

pycolt-0.6.0-py2.py3-none-any.whl (66.4 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page