Skip to main content

Writing argparse-based command line applications can become tedious, repetitive, and difficult to do right. Relax and let this library free you from that burden.

Project description

recline

Writing argparse-based command line applications can become tedious, repetitive, and difficult to do right. Relax and let this library free you from that burden.

This library helps you quickly implement an interactive command-based application in Python.

Documentation First

We all know that writing documentation is very important and yet it can easily become and afterthought or a nice to have if we're not diligent. This is often because it means duplicating a piece of your implementation in words, effectively writing the same thing twice. Recline strives to deduplicate this work by taking a documentation first attitude where your documentation becomes the implementation without additional work from you.

Interactive

The default mode is to run a REPL interface where a prompt is given to the user, the user types one of the available commands, the application processes it, displays the result, and then control is returned to the user once more.

But if your user isn't expected to or doesn't always want to run multiple commands, you also get a more traditional command-line interface for free.

Command-based

The application will be command based. Each command will have one or more words that identify the command. It may also have one or more arguments that augment or vary the action that command will take.

Batteries included

While the library is designed to be easy to implement for simple or small applications, it also comes with full power features for larger use cases including:

  • Tab completion
  • Input verification
  • Output formatting
  • Debugger integration

Before getting started

Some things to consider and prepare before you can use this library.

Software requirements

1. Python 3.10 or later

Installing and importing the library

You can install the package from pypi using the pip utility:

pip install recline

You can then import the library into your application:

import recline

Quick Start

After installing the package, you can get started with a few lines in hello.py:

import recline

@recline.command
def hello(name: str = None) -> None:
    """A basic hello world

    You can greet just about anybody with this command if they give you their name!

    Args:
        name: If a name is provided, the greeting will be more personal
    """
    response = "I'm at your command"
    if name:
        response += ", %s" % name
    print(response)

recline.relax()

Interactive mode

The default mode when a recline applciation is run is an interactive style. Running our above hello.py results in the following output:

$ python hello.py
> help
Available Commands:

hello - A basic hello world You can greet just about anybody with this command if

Built-in Commands
-----------------
exit - Exit the application
help - Display a list of available commands and their short description
man - Display the full man page for a given command
> hello ?
A basic hello world You can greet just about anybody with this command if

Optional arguments:
  -name <name> If a name is provided, the greeting will be more personal
    Default: None
> hello
I'm at your command
> hello -name Dave
I'm at your command, Dave
> exit
$

Non-interactive mode

If you would like to use the application as part of a larger script, it is much easier to do in a non-interactive way. This is also possible using recline without needing to change the application. Here's an example:

$ python hello.py -c "hello -name Dave"
I'm at your command, Dave
$

See the full documentation for more advanced usages and examples

Contributing contributions welcome

You may read about the contribution process including how to build and test your changes here.

Why recline?

There are a large number of different command line libraries on PyPi and GitHub. And some of them have the same sort of decorator design. Most, however, are missing the interactive elements that recline focuses on (tab completion, command chaining, background jobs, man pages). If you're still looking for the right fit for your application and recline isn't it, you can check out these other fine projects (in no particular order):

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

recline-2026.5.tar.gz (39.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

recline-2026.5-py3-none-any.whl (33.6 kB view details)

Uploaded Python 3

File details

Details for the file recline-2026.5.tar.gz.

File metadata

  • Download URL: recline-2026.5.tar.gz
  • Upload date:
  • Size: 39.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for recline-2026.5.tar.gz
Algorithm Hash digest
SHA256 2b530b4060f5e52b170c518fd3e3d7c1b6480594374a9fc540b23401cb531ad3
MD5 0b4e3a5219547622a15f5c83bb0b169c
BLAKE2b-256 6e9dcbbc1c62a58e29b25add6cb40f38ae03dce1b13b0fd01197680ca54211b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for recline-2026.5.tar.gz:

Publisher: build.yml on NetApp/recline

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file recline-2026.5-py3-none-any.whl.

File metadata

  • Download URL: recline-2026.5-py3-none-any.whl
  • Upload date:
  • Size: 33.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for recline-2026.5-py3-none-any.whl
Algorithm Hash digest
SHA256 17afb324602d3dbb14d9e6a23e7860ee6fe77ecf451b77047e369e138b4ecec7
MD5 1ea14787f6d0ff0e32f2105493f6c1d6
BLAKE2b-256 a8ab8683444d84267251db34901f0c61dd0cf984ffc4b0daae72e79cc57b9c04

See more details on using hashes here.

Provenance

The following attestation bundles were made for recline-2026.5-py3-none-any.whl:

Publisher: build.yml on NetApp/recline

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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