Skip to main content

Generate command-line interfaces (CLI) by introspecting callables

Project description


CLI Analyzer/Generator

Introspect, compose, marshal and export arbitrary callables into a unified, hierarchical, command-line interface (CLI)


auto-find tools scan signatures and export as CLI node


FAST! EASY! natural import usage! --help is decent!


  1. Install:

    # pip install xacto
  2. Prepare:

    # ln -s $(which xacto) do
  3. Create python file at tools/

    from pprint import pprint
    __all__ = ["easy", "hard", "manual"]
    def easy(method, speed=16, *tasks):
        """The simple version"""
    def hard(method, speed=32, *tasks, **params):
        """The difficult version"""
    class manual(object):
        """The laborious version"""
        def __call__(self, method, speed, *tasks):
        def method(self, process):
            """Howto perform operation"""
        def speed(self, ops=64):
            """Operations per second"""
        def tasks(self, pri, sec, ter):
            """Various tasks"""
  4. View --help:

    # ./do work --help
    usage: do work OBJECT ...
    additional modules:
      OBJECT  := { }
        easy  The simple version
        hard  The difficult version
              The laborious version
  5. View object-level --help:

    # ./do work manual --help
    usage: do work manual --method PROCESS --speed [OPS] [tasks [tasks ...]]
    The laborious version
    positional arguments:
      tasks             Various tasks
    optional arguments:
      --method PROCESS  Howto perform operation
      --speed [OPS]     Operations per second
    The laborious version
  6. Run tool (function):

    # ./do work hard --method=cheat --code=iddqd taskN
    {'method': 'cheat',
     'params': {'code': 'iddqd'},
     'speed': 32,
     'tasks': ('taskN',)}
  7. Run tool (class):

    # ./do work manual --method=cheap --speed=256 taskN
    {'method': 'cheap',
     'self': < object at ...>,
     'speed': '256',
     'tasks': ('taskN',)}


  • true/false quirkyness (default=True means –default flips to False)



  • testing: set-like functions, import semantics.. everything

  • handle bools better

  • detect output

  • standard output structure

  • prettify to tty

  • lazy load tools

  • lazy import globals (cpython)

  • bytecode cache

  • argument forwarding/chaining

  • integrate with

  • tab-completion

  • auto-reduce common components for aliases

  • make xacto object accessible to tools

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

xacto-0.8.5.tar.gz (13.6 kB view hashes)

Uploaded Source

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