pystac.extensions.version#

Implements the Versioning Indicators Extension.

class pystac.extensions.version.CollectionVersionExtension(collection: pystac.collection.Collection)[source]#

Bases: pystac.extensions.version.VersionExtension[pystac.collection.Collection]

A concrete implementation of VersionExtension on a Collection that extends the properties of the Collection to include properties defined in the Versioning Indicators Extension.

This class should generally not be instantiated directly. Instead, call VersionExtension.ext() on an Collection to extend it.

collection: pystac.collection.Collection#
properties: Dict[str, Any]#

The properties that this extension wraps.

The extension which implements PropertiesExtension can use _get_property and _set_property to get and set values on this instance. Note that _set_properties mutates the properties directly.

class pystac.extensions.version.ItemVersionExtension(item: pystac.item.Item)[source]#

Bases: pystac.extensions.version.VersionExtension[pystac.item.Item]

A concrete implementation of VersionExtension on an Item that extends the properties of the Item to include properties defined in the Versioning Indicators Extension.

This class should generally not be instantiated directly. Instead, call VersionExtension.ext() on an Item to extend it.

item: pystac.item.Item#
properties: Dict[str, Any]#

The properties that this extension wraps.

The extension which implements PropertiesExtension can use _get_property and _set_property to get and set values on this instance. Note that _set_properties mutates the properties directly.

class pystac.extensions.version.VersionExtension(obj: pystac.stac_object.STACObject)[source]#

Bases: Generic[pystac.extensions.version.T], pystac.extensions.base.PropertiesExtension, pystac.extensions.base.ExtensionManagementMixin[Union[pystac.collection.Collection, pystac.item.Item]]

An abstract class that can be used to extend the properties of an Item or Collection with properties from the Versioning Indicators Extension. This class is generic over the type of STAC Object to be extended (e.g. Item, Collection).

To create a concrete instance of VersionExtension, use the VersionExtension.ext() method. For example:

>>> item: pystac.Item = ...
>>> version_ext = VersionExtension.ext(item)
apply(version: str, deprecated: Optional[bool] = None, latest: Optional[pystac.extensions.version.T] = None, predecessor: Optional[pystac.extensions.version.T] = None, successor: Optional[pystac.extensions.version.T] = None) None[source]#

Applies version extension properties to the extended Item or Collection.

Parameters
  • version – The version string for the item.

  • deprecated – Optional flag set to True if an Item is deprecated with the potential to be removed. Defaults to False if not present.

  • latest – Item representing the latest (e.g., current) version.

  • predecessor – Item representing the resource containing the predecessor version in the version history.

  • successor – Item representing the resource containing the successor version

  • history. (in the version) –

property deprecated: Optional[bool]#

Get or sets whether the item is deprecated.

A value of True specifies that the Collection or Item is deprecated with the potential to be removed. It should be transitioned out of usage as soon as possible and users should refrain from using it in new projects. A link with relation type latest-version SHOULD be added to the links and MUST refer to the resource that can be used instead.

classmethod ext(obj: pystac.extensions.version.T, add_if_missing: bool = False) pystac.extensions.version.VersionExtension[pystac.extensions.version.T][source]#

Extends the given STAC Object with properties from the Versioning Indicators Extension.

This extension can be applied to instances of Item or Collection.

Raises

pystac.ExtensionTypeError – If an invalid object type is passed.

classmethod get_schema_uri() str[source]#

Gets the schema URI associated with this extension.

property latest: Optional[pystac.extensions.version.T]#

Gets or sets the Link to the Item representing the most recent version.

obj: pystac.stac_object.STACObject#
property predecessor: Optional[pystac.extensions.version.T]#

Gets or sets the Link to the Item representing the resource containing the predecessor version in the version history.

property successor: Optional[pystac.extensions.version.T]#

Gets or sets the Link to the Item representing the resource containing the successor version in the version history.

property version: str#

Get or sets a version string of the Item or pystac.Collection.

class pystac.extensions.version.VersionExtensionHooks[source]#

Bases: pystac.extensions.hooks.ExtensionHooks

prev_extension_ids = {'version'}#
schema_uri = 'https://stac-extensions.github.io/version/v1.0.0/schema.json'#
stac_object_types = {STACObjectType.COLLECTION, STACObjectType.ITEM}#
class pystac.extensions.version.VersionRelType(value)[source]#

Bases: pystac.utils.StringEnum

A list of rel types defined in the Version Extension.

See the Version Extension Relation types documentation for details.

LATEST = 'latest-version'#

Indicates a link pointing to a resource containing the latest version.

PREDECESSOR = 'predecessor-version'#

Indicates a link pointing to a resource containing the predecessor version in the version history.

SUCCESSOR = 'successor-version'#

Indicates a link pointing to a resource containing the successor version in the version history.