Skip to content

Install Leverage CLI

To use Leverage CLI you need to install it from the Python Package Index (Pypi). Currently, only Linux and Mac OS are supported operative systems.

Requirements

  • Python >= 3.8
  • Git >= 2.25
  • Docker engine >= 20.x.y

Install Pip

$ sudo apt install python3-pip
$ sudo yum install python3-pip
$ sudo dnf install python3-pip

Pip should already be installed alongside your Python 3 installation. If for whatever reason this is not the case:

$ brew install python3

Install Leverage CLI

$ pip3 install leverage

Verify your Leverage installation

Verify that your Leverage installation was successful by running

$ leverage --help
Usage: leverage [OPTIONS] COMMAND [ARGS]...

  Leverage Reference Architecture projects command-line tool.

Options:
  -f, --filename TEXT  Name of the build file containing the tasks
                       definitions.  [default: build.py]
  -l, --list-tasks     List available tasks to run.
  -v, --verbose        Increase output verbosity.
  --version            Show the version and exit.
  -h, --help           Show this message and exit.

Commands:
  credentials  Manage AWS cli credentials.
  project      Manage a Leverage project.
  run          Perform specified task(s) and all of its dependencies.
  terraform    Run Terraform commands in a custom containerized...
  tf           Run Terraform commands in a custom containerized...

Installation in an isolated environment

If you prefer not to install the Leverage package globally and would like to limit its influence to only the directory of your project, we recommend using tools like Pipenv or Poetry. These tools are commonly used when working with python applications and help manage common issues that may result from installing and using such applications globally.

Shell completion

To enable autocompletion for Leverage in your shell, do the following:

Add to ~/.bashrc:

eval "$(_LEVERAGE_COMPLETE=bash_source leverage)"

Add to ~/.zshrc:

eval "$(_LEVERAGE_COMPLETE=zsh_source leverage)"

Add to ~/.config/fish/completions/leverage.fish:

eval (env _LEVERAGE_COMPLETE=fish_source leverage)

Or to avoid invoking eval every time a shell starts:

Save the script:

_LEVERAGE_COMPLETE=bash_source leverage > ~/.leverage-complete.bash
Source the script in ~/.bashrc:
. ~/.leverage-complete.bash

Save the script:

_LEVERAGE_COMPLETE=zsh_source leverage > ~/.leverage-complete.zsh
Source the script in ~/.zshrc:
. ~/.leverage-complete.zsh

Save the script to ~/.config/fish/completions/leverage.fish:

_LEVERAGE_COMPLETE=fish_source leverage > ~/.config/fish/completions/leverage.fish

Start a new shell in order to load any changes made to the shell config.