Skip to main content

bacli

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 command decorator, and you will be able to call the function directly from the command line (with parameters, documentation and correct types!).

Usage

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

import bacli

with bacli.cli(__doc__) as cli:

    @cli.command
    def run():
        """ Run the model. """
        print("Running")


    @cli.command
    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 example.py -h
usage: example.py [-h] subcommand ...

example.py: 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 example.py run
Running

> python example.py train -h
usage: example.py 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 example.py 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)

Release files for bacli 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bacli 1.0
File Size Uploaded
bacli-1.0.tar.gz 3.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bacli 1.0
File Interpreter ABI Platform
bacli-1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.4 kB

Release files / bacli-1.0.tar.gz

Download URL bacli-1.0.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
80d2dd93845a5a2c1fdf8972fb6782efba61a9118f71bbedb2cac225bbf86bf6
BLAKE2b-256 checksum
How to use checksums
6d88a971b54e244d8e2b52215ef6eb41ad0d5fa5d859cf9b38bd9f5ccb4df2dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.19.5 PyPy/5.10.1

Release files / bacli-1.0-py3-none-any.whl

Download URL bacli-1.0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b468405fa332ca38d384d359d7e9a626a40cde7211209d32c945116b7801d77
BLAKE2b-256 checksum
How to use checksums
e3b195ea1558c14258c2474373077d3fd2fe8783d5cc621736d15fef902882a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.19.5 PyPy/5.10.1

Release history Release notifications | RSS feed

This release

1.0 This release

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page