Skip to content
ASDF Projects Tutorials Community
Back to top
View this page

# Extension

class asdf.extension.Extension

  Bases: `ABC`

  Abstract base class defining an extension to ASDF.

  Implementing classes must provide the `extension_uri`. Other properties are optional.

  Attributes Summary

  `asdf_standard_requirement` | Get the ASDF Standard version requirement for this extension.
  `compressors` | Get the `asdf.extension.Compressor` instances for compression schemes supported by this extension.
  `converters` | Get the `asdf.extension.Converter` instances for tags and Python types supported by this extension.
  `extension_uri` | Get the URI of the extension to the ASDF Standard implemented by this class.
  `legacy_class_names` | Get the set of fully-qualified class names used by older versions of this extension.
  `tags` | Get the YAML tags supported by this extension.
  `validators` | Get the `asdf.extension.Validator` instances for additional schema properties supported by this extension.
  `yaml_tag_handles` | Get a dictionary of custom yaml TAG handles defined by the extension.

  Attributes Documentation

  asdf_standard_requirement

    Get the ASDF Standard version requirement for this extension.

    Returns:
      str or None

        If str, PEP 440 version specifier. If None, support all versions.

  compressors

    Get the `asdf.extension.Compressor` instances for compression schemes supported by this extension.

    Returns:
      iterable of asdf.extension.Compressor
  converters

    Get the `asdf.extension.Converter` instances for tags and Python types supported by this extension.

    Returns:
      iterable of asdf.extension.Converter
  extension_uri

    Get the URI of the extension to the ASDF Standard implemented by this class. Note that this may not uniquely identify the class itself.

    Returns:
      str
  legacy_class_names

    Get the set of fully-qualified class names used by older versions of this extension. This allows a new-style implementation of an extension to prevent warnings when a legacy extension is missing.

    Returns:
      iterable of str
  tags

    Get the YAML tags supported by this extension.

    Returns:
      iterable of str or asdf.extension.TagDefinition
  validators

    Get the `asdf.extension.Validator` instances for additional schema properties supported by this extension.

    Returns:
      iterable of asdf.extension.Validator
  yaml_tag_handles

    Get a dictionary of custom yaml TAG handles defined by the extension.

    The dictionary key indicates the TAG handles to be placed in the YAML header, the value defines the string for tag replacement. See https://yaml.org/spec/1.1/#tag%20shorthand/

    Example: `{"!foo!": "tag:nowhere.org:custom/"}`

    Returns:
      dict