Starship Prompt Builder

Python module

Show the Python version and active virtual environment for detected Python projects.

When it appears

It appears when Python is available and a configured file, extension, folder, or environment variable is detected.

Preview

Rendered from the starting configuration in a representative simulated environment.

starship — preview
via  v1.2.3 

Starting configuration

[python]
symbol = " "
format = "via [${symbol}${pyenv_prefix}(${version} )(${virtualenv} )]($style)"
style = "bold yellow"
Open in the builder

The configuration is compressed into the URL fragment and stays in your browser.

Key options

formatstring
The format for the module.
symbolstring
A format string representing the symbol of Python
stylestring
The style for the module.
pyenv_version_nameboolean
Use pyenv to get Python version
pyenv_prefixstring
Prefix before pyenv version display, only used if pyenv is used
python_binaryarray
Configures the python binaries that Starship should execute when getting the version.
detect_extensionsarray
Which extensions should trigger this module
detect_filesarray
Which filenames should trigger this module

Format variables

$symbol
Mirrors the value of option symbol
$version
The version of python
$virtualenv
The current virtualenv name or the parent if matches generic_venv_names
$pyenv_prefix
Mirrors the value of option pyenv_prefix

Common adjustments

  • Keep virtualenv in a conditional group so parentheses vanish when no environment is active.
  • Set pyenv_version_name when the selected pyenv label is more useful than the interpreter version.
  • Adjust python_binary when the expected executable has a project-specific name.