Skip to content

Version Parsing

version_parsing

GodotVersion dataclass

An immutable Godot Engine version: major/minor/patch, release channel, and C# support (Mono/.NET).

str(version) is the canonical form, Godot's own version string (GODOT_VERSION_FULL_CONFIG): 4.3.stable, 4.4.rc2, 4.3.stable.mono. See the version format page in the docs for the full grammar.

Parameters:

Name Type Description Default
major int

The major version number (e.g., 4 in 4.1.0).

required
minor int

The minor version number (e.g., 1 in 4.1.0).

required
patch int

The patch version number (e.g., 0 in 4.1.0).

0
channel str

The release channel: 'dev', 'alpha', 'beta', 'rc' or 'stable'.

CHANNEL_STABLE
channel_num int

The number after the channel (e.g., 2 in 'rc2'); 0 for none.

0
csharp_enabled bool

True if this is a Mono/.NET variant build.

False

Raises:

Type Description
ValueError

For an unknown channel, a negative number, or a channel number on stable.

display_name: str property

A name for people, e.g. 4.3, 4.4-rc2 (.NET) or 3.6 (Mono).

parse accepts it, but store and compare str(version) instead.

is_dotnet: bool property

Checks if the version is a .NET build (Godot 4+ with C#).

is_mono: bool property

Checks if the version is a Mono build (Godot 3.x with C#).

is_stable: bool property

Checks if the version is a stable release.

is_standard: bool property

Checks if the version is the standard (non-C#) build.

major_minor: GodotVersion property

Returns the stable, standard major.minor version (e.g. 4.10 for 4.10.2-rc1 (.NET)).

variant: str property

Returns the variant name (Standard, Mono, or .NET) based on C# support and the major version number.

Godot 3.x uses Mono, Godot 4+ uses .NET.

from_tag(tag: str, csharp_enabled: bool = False) -> GodotVersion classmethod

Parses a GitHub release tag string into a GodotVersion object.

Parameters:

Name Type Description Default
tag str

The string representation of the version tag.

required
csharp_enabled bool

True if this is a Mono/.NET variant build.

False

Returns:

Type Description
GodotVersion

A new GodotVersion instance.

Raises:

Type Description
ValueError

If the version string format is invalid.

from_url(url: str) -> GodotVersion classmethod

Creates a GodotVersion from a GitHub release asset URL.

Parameters:

Name Type Description Default
url str

The full URL of the release asset.

required

Returns:

Type Description
GodotVersion

A new GodotVersion instance.

Raises:

Type Description
ValueError

If the version string cannot be found or parsed from the URL.

parse(version_string: str) -> GodotVersion classmethod

Parses a Godot version string into a GodotVersion object.

Examples of supported strings

"4.3.stable.mono" the canonical form "4.3", "4.3.0" no channel means stable "4.4-rc2", "v4.4.rc2" "4.3 mono", "4.3-dotnet", "4.3_mono", "4.3+mono" "4.6-dev2 (.NET)", "3.6.2 (Mono)" the display_name form

Parameters:

Name Type Description Default
version_string str

The string representation of the version.

required

Returns:

Type Description
GodotVersion

A new GodotVersion instance.

Raises:

Type Description
ValueError

If the string isn't a version, or has an unknown channel, a channel number of 0, or a number on stable.

to_tag() -> str

Returns the GitHub release tag, e.g. "4.3-stable" or "4.4-rc2".

The tag is the same for the standard and C# builds, so csharp_enabled is left out. from_tag(v.to_tag(), v.csharp_enabled) gives back v.