Skip to content

Installation

Karva is available as karva on PyPI.

Use karva directly with uvx:

Bash
1
2
uvx karva test
uvx karva version

Or install karva with uv, or pip:

Bash
1
2
3
4
5
6
7
8
# With uv.
uv tool install karva@latest

# Add karva to your project.
uv add --dev karva

# With pip.
pip install karva

Once installed, you can use karva to run your tests:

Bash
1
karva test

Or to get the version of karva you're using:

Bash
1
karva version

Shell autocompletion

Karva supports autocompletion for most shells. A shell-specific completion script can be generated by uv run karva generate-shell-completion <SHELL>, where <SHELL> is one of bash, elvish, fish, nushell, powershell, or zsh.

Tip

You can run echo $SHELL to help you determine your shell.

To enable shell autocompletion for Karva, run one of the following:

Bash
1
echo 'eval "$(uv run karva generate-shell-completion bash)"' >> ~/.bashrc
Bash
1
echo 'eval "$(uv run karva generate-shell-completion zsh)"' >> ~/.zshrc
Bash
1
echo 'uv run karva generate-shell-completion fish | source' > ~/.config/fish/completions/karva.fish
Bash
1
echo 'eval (uv run karva generate-shell-completion elvish | slurp)' >> ~/.elvish/rc.elv
PowerShell
1
2
3
4
if (!(Test-Path -Path $PROFILE)) {
  New-Item -ItemType File -Path $PROFILE -Force
}
Add-Content -Path $PROFILE -Value '(& uv run karva generate-shell-completion powershell) | Out-String | Invoke-Expression'
Text Only
1
2
mkdir ($nu.user-autoload-dirs | first)
uv run karva generate-shell-completion nushell | save --force ($nu.user-autoload-dirs | first | path join karva.nu)

Then restart the shell or source the shell config file.