Skip to main content

Born Again Command Line Interface.

Project description


Born Again Command Line Interface.

Bacli is a module that wraps the command line argument parsing functionality of argparse for ease of use. Any Python function can be transformed into an entry point for the program. Simply add the bacli.command decorator, and you will be able to call the function directly from the command line (with parameters, documentation and correct types!).


""" This file serves as a demonstration of the bacli functionality. """

import bacli


def run():
    """ Run the model. """

def train(iterations: int, batch_size: int=32):
    """ Train the model. """
    print("Training model")
    print("{} iterations".format(iterations))
    print("batch size of {}".format(batch_size))

It can then be used as follows:

> python -h
usage: [-h] subcommand ... This file serves as a demonstration of the bacli functionality.

positional arguments:
  subcommand  Select one of the following subcommands:
    run       Run the model.
    train     Train the model.

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

> python run

> python train -h
usage: train [-h] [--batch_size BATCH_SIZE] iterations

Train the model.

positional arguments:
  iterations            type: int

optional arguments:
  -h, --help            show this help message and exit
  --batch_size BATCH_SIZE
                        type: int, default=32

> python train 10 --batch_size 64
Training model
10 iterations
batch size of 64

Upcoming Features

  • Support for variable arguments (*args and **kwargs)
  • Support documentation of parameters
  • Support aliases of parameters (maybe use first leter as shortcut)

Project details

Download files

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

Files for bacli, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size bacli-0.2.tar.gz (2.7 kB) File type Source Python version None Upload date Hashes View
Filename, size bacli-0.2-py3-none-any.whl (3.0 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page