Installation ¶
To use Leverage CLI you need to install it from the Python Package Index (Pypi). Currently, only Linux and Mac OS are officially supported operative systems.
Requirements
- Python
>= 3.9 - Git
>= 2.25
Having issues with the CLI?
Check out the troubleshooting section to find more help.
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
Update Leverage CLI from previous versions ¶
Upgrade to a specific version.
$ pip3 install -Iv leverage==2.2.0
Upgrade to the latest stable version
$ pip3 install --upgrade 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:
-v, --verbose Increase output verbosity.
--version Show the version and exit.
--help Show this message and exit.
Commands:
aws Run AWS CLI commands in the context of the current project.
credentials Manage AWS cli credentials.
kc Run Kubectl commands in the context of the current project.
kubectl Run Kubectl commands in the context of the current project.
project Manage a Leverage project.
run Perform specified task(s) and all of its dependencies.
terraform Run Terraform commands in the context of the current project.
tf Run OpenTofu commands in the context of the current project.
tfautomv Run TFAutomv commands in the context of the current project.`
tofu Run OpenTofu commands in the context of the current project.
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 uv 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.
Installation using uv ¶
Install uv ¶
Follow the instructions laid out in the official uv installation guide.
Local python version ¶
You can choose to have a python installation exclusive to the local project.
uv python install 3.13
uv python pin 3.13
Initialize the project and install leverage ¶
uv init
uv add leverage
Activate the virtual environment ¶
Once the project is initialized and Leverage CLI is installed you can run commands as
uv run leverage tofu plan
source .venv/bin/activate
leverage tofu plan
¶
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
~/.bashrc:
. ~/.leverage-complete.bash
Save the script:
_LEVERAGE_COMPLETE=zsh_source leverage > ~/.leverage-complete.zsh
~/.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.