Skip to content

sok.core.updater

Application update management.

Provides functionality to check for updates from GitHub releases, download new versions, and manage the update installation process.

UpdateManager

class UpdateManager()

Manages update verification and retrieval via GitHub Releases.

Initialize the update manager.

Sets up the manager with no cached release data.

Source

Attributes

NameType
API_URL
GITHUB_REPO
latest_releaseOptional[Dict[str, Any]]

check_for_updatesasync

async def check_for_updates() -> Tuple[bool, Optional[str]]:

Check if an update is available.

Returns

  • Tuple[bool, Optional[str]]Tuple[bool, str]: (Is there an update?, Detected version)
Source

download_and_install

def download_and_install(url: str, progress_callback=None):

Download the installer and launch it (on macOS, open the disk image; on Linux, replace the AppImage). The caller then quits the app: this runs in a worker thread, where sys.exit() would only end the thread.

Parameters

NameTypeDefaultDescription
urlstr
progress_callbackNone
Source

get_download_url

def get_download_url() -> Optional[str]:

Get the download URL of the installer for this platform. Windows: the setup .exe first, then any .exe. macOS: the .dmg. Linux: the AppImage of this architecture, when running from an AppImage (it replaces itself). Falls back to the release page.

Source

get_release_notes

def get_release_notes() -> str:

Return the changelog for the latest release.

Source

replace_appimage

def replace_appimage(url: str, progress_callback=None) -> None:

Download the new AppImage over the one the app runs from.

The file keeps its path, so launchers and shortcuts still work. It is downloaded next to it, then renamed: the swap is atomic, and the running app keeps the old file open until it quits.

Parameters

NameTypeDefaultDescription
urlstr
progress_callbackNone

Raises

  • OSErrorThe folder is not writable or the download failed.
Source

restart_appimagestaticmethod

def restart_appimage() -> None:

Start the updated AppImage; the caller then quits the app.

Source

Functions

running_appimage

def running_appimage() -> Optional[Path]:

Return the AppImage file the app runs from (Linux), else None.

The AppImage runtime sets APPIMAGE to the path of the file.

Source

Attributes

NameValue
loggerlogging.getLogger(__name__)
Built with Kiln