runway.env_mgr package

Base module for environment managers.

class runway.env_mgr.EnvManager[source]

Bases: DelCachedPropMixin

Base environment manager class.

binPath to the binary of the current version.
current_version

The current binary version being used.

Type:

str | None

env_dir_name

Name of the directory within the users home directory where binary versions will be stored.

Type:

str

path

The current working directory.

Type:

pathlib.Path

__init__(bin_name: str, dir_name: str, path: Path | None = None) None[source]

Initialize class.

Parameters:
  • bin_name – Name of the binary file (e.g. kubectl)

  • dir_name – Name of the directory within the users home directory where binary versions will be stored.

  • path – The current working directory.

property bin: Path

Path to the version binary.

Returns:

Path

property command_suffix: str

Return command suffix based on platform.system.

property env_dir: Path

Return the directory used to store version binaries.

install(version_requested: str | None = None) str[source]

Ensure <bin> is installed.

list_installed() Generator[Path, None, None][source]

List installed versions of <bin>.

uninstall(version: str | Version) bool[source]

Uninstall a version of the managed binary.

Parameters:

version – Version of binary to uninstall.

Returns:

Whether a version of the binary was uninstalled or not.

property version_file: Path | None

Find and return a “<bin version file>” file if one is present.

Returns:

Path to the <bin> version file.

property versions_dir: Path

Return the directory used to store binary.

When first used, the existence of the directory is checked and it is created if needed.

runway.env_mgr.handle_bin_download_error(exc: URLError, name: str) None[source]

Give user info about their failed download.

Raises:

SystemExit – Always raised after logging reason.

Submodules