Skip to content

Release Fetcher

release_fetcher

GodotAsset

A downloadable release file. sha512 is its published hex checksum, or None.

GodotFetcher

Handles fetching and caching of Godot release information.

Releases come from godot-builds' releases/*.json, downloaded with OVERRIDES applied. They're cached in cache_dir for cache_ttl seconds.

fetched_at is when the cached release list was downloaded (timezone-aware UTC), or None before the first fetch.

Use it as a context manager, or call close() when done.

close() -> None

Closes the underlying HTTP client.

fetch_releases(stable_only: bool = True, sort_by: str = 'version', max_releases: int | None = None, platform: str | None = None, arch: str | None = None, refresh_cache: bool = False) -> list[GodotRelease]

Fetches Godot releases.

Parameters:

Name Type Description Default
stable_only bool

If True, returns only stable releases.

True
sort_by str

"version" (newest version first) else newest release date first.

'version'
max_releases int | None

Maximum number of releases to return.

None
platform str | None

Keep only releases with a standard or .NET editor build for this target. If only one of platform/arch is given, the other defaults to this machine. Neither: no filtering.

None
arch str | None

See platform.

None
refresh_cache bool

If True, ignores the memory and disk caches.

False

Returns: A list of GodotRelease objects.

Raises:

Type Description
ValueError

If platform or arch isn't a known name.

DownloadError

If the release list couldn't be downloaded or read.

find_asset(version: GodotVersion, platform: str | None = None, arch: str | None = None) -> GodotAsset

Finds the editor build of version for a target.

Fetches releases first if none are cached. version.csharp_enabled picks the .NET build.

Parameters:

Name Type Description Default
version GodotVersion

The version to find, e.g. GodotVersion.parse("4.3").

required
platform str | None

One of PLATFORMS. Defaults to detect_platform().

None
arch str | None

One of ARCHS. Defaults to detect_architecture().

None

Raises:

Type Description
ReleaseNotFoundError

If no release has this version. Call fetch_releases(refresh_cache=True) first if it's brand new.

AssetNotFoundError

If the release has no build for this target.

DownloadError

If the release list couldn't be downloaded or read.

ValueError

If platform or arch isn't a known name.

GodotRelease

A single Godot release, e.g. the 4.3-stable tag.

version is parsed from tag. A release covers both the standard and .NET builds, so version.csharp_enabled is always False; use get_asset(..., csharp=True) for the .NET build.

published_at is the release day (UTC).

Raises:

Type Description
ValueError

If tag isn't a valid Godot version tag.

get_asset(platform: str | None = None, arch: str | None = None, csharp: bool = False) -> GodotAsset | None

Returns this release's editor build for a target, or None if it has none.

Parameters:

Name Type Description Default
platform str | None

One of PLATFORMS. Defaults to detect_platform().

None
arch str | None

One of ARCHS. Defaults to detect_architecture().

None
csharp bool

True for the .NET build.

False

Raises:

Type Description
ValueError

If platform or arch isn't a known name.

default_cache_dir() -> Path

Per-user cache directory for godotkit.

detect_architecture() -> str

Detects the current CPU architecture and maps it to a supported arch name.

detect_platform() -> str

Detects the current operating system and maps it to a supported platform name.