Skip to content

Installation

StagPy is available on the Python Package Index.

You can use uv to manage Python environments.

Installation as a CLI tool

If you are interested in using the stagpy command line interface, you can install it as a tool with uv:

shell
uv tool install stagpy

This installs stagpy in its own environment, isolated from other packages to avoid conflicts.

You can then update StagPy with the following command:

shell
uv tool upgrade stagpy

More information about uv tools.

Installation in a uv managed environment

A convenient way to use StagPy in script is by leveraging uv environments.

With the following (setting versions as desired for your project):

pyproject.toml
[project]
name = "my-project"
version = "0.1.0"
requires-python = ">=3.10"
dependencies = [
    "stagpy~=0.20.1",
]

You can then run a script using stagpy, for example:

my_script.py
import stagpy

print(stagpy.__version__)

with the following command

shell
uv run my_script.py

You can run any arbitrary command via uv, including stagpy itself:

shell
uv run -- stagpy version

Shell completions

You can enable command-line auto-completion if you use either bash or zsh.

For bash:

shell
# adapt path as appropriate for your system
mkdir -p ~/.local/share/bash-completion/completions
cd !$
stagpy completions --bash

For zsh, with fpath+=~/.zfunc in your .zshrc:

shell
cd ~/.zfunc
stagpy completions --zsh

Enjoy!