runway.env_mgr package

Base module for environment managers.

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.

class runway.env_mgr.EnvManager[source]

Bases: runway.mixins.DelCachedPropMixin

Base environment manager class.

binPath to the binary of the current version.
current_version

The current binary version being used.

Type

Optional[str]

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: Optional[pathlib.Path] = 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: pathlib.Path

Path to the version binary.

Returns

Path

property command_suffix: str

Return command suffix based on platform.system.

property env_dir: pathlib.Path

Return the directory used to store version binaries.

property versions_dir: pathlib.Path

Return the directory used to store binary.

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

__new__(**kwargs)
property version_file: Optional[pathlib.Path]

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

Returns

Path to the <bin> version file.

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

Ensure <bin> is installed.

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

List installed versions of <bin>.

uninstall(version: Union[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.

Submodules