Create an Application Item

Install the package before running this complete example. It creates an Item carrying application metadata and reads that metadata back after serialization.

from datetime import datetime, timezone

import pystac
from pystac.extensions.application import ApplicationExtension

item = pystac.Item(
    id="example-application",
    geometry=None,
    bbox=None,
    datetime=datetime(2026, 1, 1, tzinfo=timezone.utc),
    properties={"title": "Application example"},
)
application = ApplicationExtension.ext(item, add_if_missing=True)
application.apply(
    container="docker",
    entrypoint="main.cwl",
    languages=["CWL"],
)

serialized = item.to_dict()
assert ApplicationExtension.get_schema_uri() in serialized["stac_extensions"]
assert serialized["properties"]["application:container"] == "docker"
assert serialized["properties"]["application:entrypoint"] == "main.cwl"
assert serialized["properties"]["application:languages"] == ["CWL"]

restored_item = pystac.Item.from_dict(serialized)
restored = ApplicationExtension.ext(restored_item)
assert restored.container == application.container
assert restored.entrypoint == application.entrypoint
assert restored.languages == application.languages

add_if_missing=True registers the extension schema on the Item. Subsequent calls to ApplicationExtension.ext(item) require that registration. The wrapper stores metadata; it does not execute the application.

The core Item datetime is supplied by the caller and is independent of the Application fields.

to_dict() serializes the Item without running JSON Schema validation. See validation boundaries for the distinction.