What’s New in ASDF 2.1?

ASDF 2.1 is a minor release, and most of the changes affect only a subset of users. The most notable changes are the following:

  • namedtuple objects can now be serialized. They are automatically converted into list objects, and therefore are not strictly able to round-trip. By default a warning occurs when performing this conversion, but the warning can be disabled by passing ignore_implicit_conversion=True to the AsdfFile constructor.
  • Added a method AsdfFile.get_history_entries for getting a list of history entries from the tree.
  • Added an option to generic_io.get_file to close the underlying file handle.

Please see the Change Log for additional details.

What’s New in ASDF 2.0?

ASDF 2.0 is a major release that includes many improvements, new features, and some API changes. It is the first release of the ASDF package that only supports Python 3.

The full list of changes, including bug fixes, can be found in the Change Log. A brief overview of changes is provided below:

  • Support for Python 2.7 has been removed entirely.
  • There is no longer a hard dependency on astropy. It is still required for some features, and for running the tests. Astropy-related tag implementations have been moved to the Astropy package itself.
  • External packages can now install and register custom ASDF extensions using setuptools entry points (see Extensions from other packages and Overriding built-in extensions). ASDF detects extensions that are installed in this way and automatically uses them when reading and writing files with custom types.
  • A bug was fixed that now allows fully-specified tags from external packages to be properly resolved.
  • The file format now includes metadata about the extensions that were used to create an ASDF file. The software automatically adds this information when writing an ASDF file, and will check for installed extensions when reading a file containing such metadata (see Extension checking).
  • The restrictions on the top-level attributes data, wcs, and fits have been removed.
  • Clients that wish to impose additional validation requirements on files can now provide custom top-level schemas (see Custom schemas).
  • There is a new way to reference array data that is defined in external files (see Array References).
  • Several new commands have been added to the asdftool command line interface:
  • The package now cleanly supports builds in develop mode and can be imported from the source tree.

Change Log

2.2.0 (unreleased)

  • Small numeric arrays are now automatically stored inline. This behavior can be overridden using the new inline_threshold argument to the AsdfFile constructor. It can also be controlled with the existing set_array_storage method of AsdfFile and the all_array_storage argument to AsdfFile.write_to. [#557]
  • Add new parameter lazy_load to It is True by default and preserves the default behavior. False detaches the loaded tree from the underlying file: all blocks are fully read and numpy arrays are materialized. Thus it becomes safe to close the file and continue using AsdfFile.tree. However, copy_arrays parameter is still effective and the active memory maps may still require the file to stay open in case copy_arrays is False. [#573]
  • Storage of arbitrary precision integers is now provided by asdf.IntegerType. Reading a file with integer literals that are too large now causes only a warning instead of a validation error. This is to provide backwards compatibility for files that were created with a buggy version of ASDF (see #553 below). [#566]
  • Add AsdfConversionWarning for failures to convert ASDF tree into custom types. This warning is converted to an error when using assert_roundtrip_tree for tests. [#583]
  • Deprecate in favor of [#579]
  • Add readonly protection to memory mapped arrays when the underlying file handle is readonly. [#579]

2.1.1 (unreleased)

  • Make sure extension metadata is written even when constructing the ASDF tree on-the-fly. [#549]
  • Fix large integer validation when storing numpy integer literals in the tree. [#553]
  • Fix bug that caused subclass of external type to be serialized by the wrong tag. [#560]
  • Fix bug that occurred when attempting to open invalid file but Astropy import fails while checking for ASDF-in-FITS. [#562]
  • Fix bug that caused tree creation to fail when unable to locate a schema file for an unknown tag. This now simply causes a warning, and the offending node is converted to basic Python data structures. [#571]

2.1.0 (2018-09-25)

  • Add API function for retrieving history entries. [#501]
  • Store ASDF-in-FITS data inside a 1x1 BINTABLE HDU. [#519]
  • Allow implicit conversion of namedtuple into serializable types. [#534]
  • Fix bug that prevented use of ASDF-in-FITS with HDUs that have names with underscores. [#543]
  • Add option to generic_io.get_file to close underlying file handle. [#544]
  • Add top-level keys method to AsdfFile to access tree keys. [#545]

2.0.3 (2018-09-06)

  • Update asdf-standard to reflect more stringent (and, consequently, more correct) requirements on the formatting of complex numbers. [#526]
  • Fix bug with dangling file handle when using ASDF-in-FITS. [#533]
  • Fix bug that prevented fortran-order arrays from being serialized properly. [#539]

2.0.2 (2018-07-27)

  • Allow serialization of broadcasted numpy arrays. [#507]
  • Fix bug that caused result of set_array_compression to be overwritten by all_array_compression argument to write_to. [#510]
  • Add workaround for Python OSX write limit bug (see [#521]
  • Fix bug with custom schema validation when using out-of-line definitions in schema file. [#522]

2.0.1 (2018-05-08)

  • Allow test suite to run even when package is not installed. [#502]

2.0.0 (2018-04-19)

  • Astropy-specific tags have moved to Astropy core package. [#359]
  • ICRSCoord tag has moved to Astropy core package. [#401]
  • Remove support for Python 2. [#409]
  • Create pytest plugin to be used for testing schema files. [#425]
  • Add metadata about extensions used to create a file to the history section of the file itself. [#475]
  • Remove hard dependency on Astropy. It is still required for testing, and for processing ASDF-in-FITS files. [#476]
  • Add command for extracting ASDF extension from ASDF-in-FITS file and converting it to a pure ASDF file. [#477]
  • Add command for removing ASDF extension from ASDF-in-FITS file. [#480]
  • Add an ExternalArrayReference type for referencing arrays in external files. [#400]
  • Improve the way URIs are detected for ASDF-in-FITS files in order to fix bug with reading gzipped ASDF-in-FITS files. [#416]
  • Explicitly disallow access to entire tree for ASDF file objects that have been closed. [#407]
  • Install and load extensions using setuptools entry points. [#384]
  • Automatically initialize asdf-standard submodule in [#398]
  • Allow foreign tags to be resolved in schemas and files. Deprecate tag_to_schema_resolver property for AsdfFile and AsdfExtensionList. [#399]
  • Fix bug that caused serialized FITS tables to be duplicated in embedded ASDF HDU. [#411]
  • Create and use a new non-standard FITS extension instead of ImageHDU for storing ASDF files embedded in FITS. Explicitly remove support for the .update method of AsdfInFits, even though it didn’t appear to be working previously. [#412]
  • Allow package to be imported and used from source directory and builds in development mode. [#420]
  • Add command to asdftool for querying installed extensions. [#418]
  • Implement optional top-level validation pass using custom schema. This can be used to ensure that particular ASDF files follow custom conventions beyond those enforced by the standard. [#442]
  • Remove restrictions affecting top-level attributes data, wcs, and fits. Bump top-level ASDF schema version to v1.1.0. [#444]

1.3.3 (2018-03-01)

  • Update test infrastructure to rely on new Astropy v3.0 plugins. [#461]
  • Disable use of 2to3. This was causing test failures on Debian builds. [#463]

1.3.2 (2018-02-22)

  • Updates to allow this version of ASDF to be compatible with Astropy v3.0. [#450]
  • Remove tests that are no longer relevant due to latest updates to Astropy’s testing infrastructure. [#458]

1.3.1 (2017-11-02)

  • Relax requirement on semantic_version version to 2.3.1. [#361]
  • Fix bug when retrieving file format version from new ASDF file. [#365]
  • Fix bug when duplicating inline arrays. [#370]
  • Allow tag references using the tag URI scheme to be resolved in schema files. [#371]

1.3.0 (2017-10-24)

  • Fixed a bug in reading data from an “http:” url. [#231]
  • Implements v 1.1.0 of the asdf schemas. [#233]
  • Added a function is_asdf_file which inspects the input and returns True or False. [#239]
  • The open method of AsdfInFits now accepts URIs and open file handles in addition to HDULists. The open method of AsdfFile will now try to parse the given URI or file handle as AsdfInFits if it is not obviously a regular ASDF file. [#241]
  • Updated WCS frame fields obsgeoloc and obsgeovel to reflect recent updates in astropy that changed representation from Quantity to CartesianRepresentation. Updated to reflect astropy change that combines galcen_ra and galcen_dec into galcen_coord. Added support for new field galcen_v_sun. Added support for required module versions for tag classes. [#244]
  • Added support for lz4 compression algorithm [#258]. Also added support for using a different compression algorithm for writing out a file than the one that was used for reading the file (e.g. to convert blocks to use a different compression algorithm) [#257]
  • Tag classes may now use an optional supported_versions attribute to declare exclusive support for particular versions of the corresponding schema. If this attribute is omitted (as it is for most existing tag classes), the tag is assumed to be compatible with all versions of the corresponding schema. If supported_versions is provided, the tag class implementation can include code that is conditioned on the schema version. If an incompatible schema is encountered, or if deserialization of the tagged object fails with an exception, a raw Python data structure will be returned. [#272]
  • Added option to to allow suppression of warning messages when mismatched schema versions are encountered. [#294]
  • Added a diff tool to asdftool to allow for visual comparison of pairs of ASDF files. [#286]
  • Added command to asdftool to display available tags. [#303]
  • When possible, display name of ASDF file that caused version mismatch warning. [#306]
  • Issue a warning when an unrecognized tag is encountered. [#295] This warning is silenced by default, but can be enabled with a parameter to the AsdfFile constructor, or to Also added an option for ignoring warnings from unrecognized schema tags. [#319]
  • Fix bug with loading JSON schemas in Python 3.5. [#317]
  • Remove all remnants of support for Python 2.6. [#333]
  • Fix issues with the type index used for writing out ASDF files. This ensures that items in the type index are not inadvertently overwritten by later versions of the same type. It also makes sure that schema example tests run against the correct version of the ASDF standard. [#350]
  • Update time schema to reflect changes in astropy. This fixes an outstanding bug. [#343]
  • Add copy_arrays option to to control whether or not underlying array data should be memory mapped, if possible. [#355]
  • Allow the tree to be accessed using top-level __getitem__ and __setitem__. [#352]


  • Make asdf conditionally dependent on the version of astropy to allow running it with older versions of astropy. [#228]


  • Added Tabular model. [#214]
  • Forced new blocks to be contiguous [#221]
  • Rewrote code which tags complex objects [#223]
  • Fixed version error message [#224]

1.0.5 (2016-06-28)

  • Fixed a memory leak when reading wcs that grew memory to over 10 Gb. [#200]

1.0.4 (2016-05-25)

  • Added wrapper class for astropy.core.Time, TaggedTime. [#198]

1.0.2 (2016-02-29)

  • Renamed package to ASDF. [#190]
  • Stopped support for Python 2.6 [#191]

1.0.1 (2016-01-08)

  • Fixed installation from the source tarball on Python 3. [#187]
  • Fixed error handling when opening ASDF files not supported by the current version of asdf. [#178]
  • Fixed parse error that could occur sometimes when YAML data was read from a stream. [#183]

1.0.0 (2015-09-18)

  • Initial release.