ExtensionVersions

class hugr.ext.ExtensionVersions(latest: Extension)[source]

Bases: object

Set of versions of an extension.

Older versions of an extension may be kept for backwards compatibility.

Methods

add

Add an extension to the set, coalescing compatible older versions.

add_lazy

Add an extension to the set, NOT coalescing compatible older versions.

coalesce

Ensures the latest version is up to date and any semver compatible versions are coalesced, with only the latest of that group retained.

get_compatible

Get the highest registered extension compatible with version.

Attributes

id

Get the ID of the extension.

latest

Get latest version of the extension.

versions

Get all versions of the extension.

add(extension: Extension) None[source]

Add an extension to the set, coalescing compatible older versions.

add_lazy(extension: Extension) None[source]

Add an extension to the set, NOT coalescing compatible older versions. Use coalesce to subsequently coalesce all compatible versions.

coalesce() None[source]

Ensures the latest version is up to date and any semver compatible versions are coalesced, with only the latest of that group retained.

This is done automatically by add, but not by add_lazy.

get_compatible(version: Version) Extension[source]

Get the highest registered extension compatible with version.

property id: ExtensionId

Get the ID of the extension.

property latest: Extension

Get latest version of the extension.

property versions: frozenset[Version]

Get all versions of the extension.